Commit Graph

112 Commits

Author SHA1 Message Date
Alex Maitland 93e5161bbb Example - Remove Newtonsoft.Json
Wasn't used
2022-05-04 10:52:59 +10:00
Alex Maitland 67a08c47ee BrowserSubProcess/Examples/Tests - Migrate to newer SDK Style projects
- Migrate to new SDK style projects
- Migrate to chromiumembeddedframework.runtime packages
- Remove old packages.config files
- Update post build event for BrowserSubprocess to set TSAware/LargeAddressAware
- Change project build order

Issue #3706
2021-10-12 19:48:11 +10:00
ValentinNikin d0bdc735eb Updated example for Audio Handler (#3724)
* Implemented example for Audio Handler

* Rename AudioHandlerExample to AudioHandler

* Allow unsafe code

* Remove UnmanagedMemoryStream using

* Fix problem with build

* Allow unsafe code for .NET Core project

* Remove excess PropertyGroup

Co-authored-by: Valentin Nikin <nikin.v@tecomgroup.ru>
2021-07-31 06:30:59 +10:00
Alex Maitland d5c74771f1 Test - Add Test to verify workaround for issue #3470 2021-04-06 13:12:44 +10:00
Alex Maitland 0cdbef1d44 Test/Example - Upgrade to .Net 4.7.2
- Update .vsconfig to include the .Net 4.7.2 requirement and add the Net Core 3.1 feature.
2021-01-22 14:58:40 +10:00
Alex Maitland 8a367fbdc4 Refactor CefSharp.Core into CefSharp.Core.Runtime (#3311)
* Net Core - Rename CefSharp.Core.dll to CefSharp.Core.Runtime.dll

Partial rename, only Net Core, folder not renamed

* Net Core - Rename CefSharp.Core.RefAssembly to CefSharp.Core.netcore

Remove GenApi

* Core - Rename CefDragDataWrapper to DragData

Move into CefSharp.Core namespace

* WinForms/WPF/OffScreen - Migrate from GitLink command line to Nuget package

* Net Core - Refactor to have CefSharp.Core.dll contain only public Api

* Net Core - Remove CefSharp.Core.RefAssembly

* Net Core - Change CefSharp.Core.netcore output folder

* Net Core - Restructure nuget packages

* Net Core - Add Cefsharp.Core.Runtime.RefAssembly

* Net Core - Hide CLI/C++ classes from intellisense

Make sure users don't attempt to load them directly

* Rename CefSharp.Core to CefSharp.Core.Runtime

* Core - Restructure Net 4.5.2 packages to use CefSharp.Core.dll anycpu variant

Attempt to load CefSharp.Core.Runtime at runtime rather than having to use msbuild to copy the correct version

* Rename CefSharp.Core.netcore to CefSharp.Core

* WPF/WinForms/OffScreen - Change from x86/64 to AnyCPU

As they are all managed assemblies they can target AnyCPU.
Includes CefSharp.dll

* Convert RequestContextBuilder from C++ to C#

Now part of the CefSharp.Core PublicApi

* Update version number to 87.1.11

* Migrate more of the public Api to C#

* Net Core - Basic restructure complete

* Net Core - ModuleInitializer (Doesn't work yet)

* Remove direct references to BrowserSettings

* Net Core - ModuleInitializer load CefShar.Core.Runtime.dl

* Net Core - Load libcef.dll via CLR Module initializer

If no RID is specified then we can load libcef.dll using the module initializer

* Add version to CefSharp.Core

* Remove dependency on CefSharp.Core.Runtime
Rewrite common targets

* AnyCPU app.config transform

Improve AnyCPU support

* Improve Net Core 3 support
Only delete CefSharp.Core.Runtime.dll when AnyCPU

* Nuget - Add CefSharp.Core.Runtime reference when TargetFramework = NetCore

* Fix Typos

Based on #3306

* Net Core - Rename CefSharp.Core.Runtime RefAssembly source file

* Net Full - Generate CefSharp.Core.Runtime Ref Assembly

For now the powershell build script generates the .cs file based on a x86 release build.ps1
It's not possible to directly install GenApi as it requires a Sdk style project

* Net Core - Old packages copy files to required folders

* Test - Install newer .Net Compiler and set Lang Version to 7.3

* Net Core - Exclude Net 452 Runtime generated reference source

* Core - Add Refactoring TODO

* Ref Assembly - Generate source as part of build

- Move ref assembly source generate into GenerateRefAssemblySource.ps1
- Call before project build

Runs locally, see if Appveyor has a problem with the powershell script execution

* Core - Add more factory methods to create instances of managed wrappers

* Net Core - Make Initialzier properties internal

Not quite sure what the public API should look like as yet, so making internal for now.
2020-12-16 10:47:34 +10:00
amaitland e149cabe07 Example - Move RequestContextHandler into CefSharp.Example
Was previously only in WPF project, move into the common CefSharp.Example
as there was nothing WPF specific out the class.
2020-10-02 10:25:23 +10:00
Alex Maitland 78e32a3b9f Enhancement - Add DevToolsClient (#3229)
* Core - Add DevToolsClient

Issue #3165

* DevTools Client - Add Network domain class

- Add hand written class to get a better sense of how the code should be structured.
- Improve exception handling

* Devtools - First draft of devtools protocol methods (generated)

Not complete yet

* Devtools - Simple method execution working

* DevTools - Add .Net Style cased property names to response objects

- Use internal field and datacontract attributes

* DevTools - Improve mapping

* DevTools - Strongly typed enums

* DevTools Client - Generated from active browser instance (M84)

* Devtools Client - Extract IDevToolsClient interface for testability

Improve xml doc comments

* DevTools Client - Improve error handling

* DevTools Client - Improve enum conversion

* Revert to older c# syntax

* DevTools Client - Fix failing tests

* Devtools Client - Add SetCookie Tests

* DevTools Client - Add Capture SyncContext by default

- Add option to capture the SyncContext
- Add option to provide custom SyncContext (can just pass in UI SyncContext and all continuations will happen there).
- Fix bug in ExecuteDevToolsMethodAsync sending the command twice when exeucted on the CEF UI thread

* Devtools Client - Add missing file reference

The problem with developing with the .Net Core project where files are automatically included is you
forget to include them in the regular csproj file.

* Devtools Client - Add CanCanEmulate Test case

* DevTools Client - Add AddScriptToEvaluateOnNewDocumentAsync test

* DevTools Client - OnDevToolsEvent only parse data if event handler != null

* DevTools Client - GetDevToolsClient remove ThrowExceptionIfDisposed/ThrowExceptionIfBrowserNotInitialized calls

Those methods were removed as the GetBrowser call handles the checks for us.

* DevTools Client - Improve error handling

* DevTools Client - Update xml doc comments

* DevTools Client - Add validation method (partial)

Add ability to manually add validation logic

* DevTools Client - Comment out failing test

Was working when targeting M84, now with M85 it fails.

The mapping appears to be correct, will need to investigate further

* OffScreen Example - Remove test code
2020-09-21 19:32:25 +10:00
amaitland 53f15f22eb Upgrade to CEF 85.3.6+gacfac2f+chromium-85.0.4183.102 / Chromium 85.0.4183.102
- Remove CefSettings.RegisterExtension (#3184)
- Add IRenderProcessHandler.OnWebKitInitialized
- Add Cef.RegisterExtension (Browser SubProcess specific implementation)

Resolves #3184
2020-09-16 13:49:37 +10:00
amaitland 22d494b230 Net Core - Split Binding Test into Sync/Async
- In preparation for adding a Net Core Specific XUnit project file

Issue #3197
2020-07-24 20:42:14 +10:00
Alex Maitland 8d25b71490 Core - Re-Add IAudioHandler (#3153)
Resolves #3152
2020-07-08 08:06:16 +10:00
amaitland eee134c70f Example - Add DevToolsExtensions.CaptureScreenShotAsPng
Example of taking a screenshot as a png using the new devtools interface
2020-06-29 13:58:06 +10:00
amaitland ae41e10d71 Core - Javascript Binding Configure Property Name
- Rename settings object to JavascriptBindingSettings
- Validate JavascriptBindingSettings.JsBindingGlobalObjectName in setter to provide immediate
  feedback
- Add FreezableBase which throws exception when frozen (we can reuse this for some other settings classes)
- Add some basic Unit Tests (More would be better)

Follow on from #3126
2020-05-30 19:28:50 +10:00
amaitland 7e121305ae Example - Add AcceptRangeResourceHandler demo
CEF in theory now supports partial range requests see https://bitbucket.org/chromiumembedded/cef/issues/2873/streamreaderurlloader-doesnt-correctly

Not production tested, just a rough working prototype at this point in time. It's not clear that CEF
2020-04-23 17:10:37 +10:00
amaitland a9d39d7965 Core - Add StreamResponseFilter
- Moved from the Cefsharp.Example.Filters.StreamResponseFilter
- Added CanWrite checks in InitFilter
- Updated example to reflect namespace change.
2019-12-10 18:31:38 +10:00
David M Iserovich a843407dab Core - Add IURLRequest #1721 (#2881)
* Core - Add IURLRequest #1721

Add IURLRequest, IURLRequestClient, and GetURLRequest to IFrame

* Rename URL classes to Url, add xmldoc and licenses

* Add UrlRequestClient to CefSharp.Example, more minor cleanup

* Getters

* Rebase tweaks

* Fix filenames, remove unused

* Use UnmanagedMemoryStream instead of byte array for IUrlRequestClient.OnDownloadData
2019-10-01 20:11:10 +10:00
amaitland 802bb7f43c Remove IAudioHandler
The Chromium implementation has changed so dramatically that CEF has removed support see https://bitbucket.org/chromiumembedded/cef/commits/1f893c76a97eaa88e3ff782b8e2e47dd0f5d27b2

Track https://bitbucket.org/chromiumembedded/cef/issues/2755/reimplement-audio-mirroring-for for details on when it will be reimplemented

Original Issue #2727
2019-10-01 20:06:37 +10:00
amaitland 0d236b3b45 Example - Update ResponseFilter example to reflect NetworkService changes
- MemoryStreamResponseFilter renamed to StreamResponseFilter
- Stream is now passed into StreamResponseFilter constructor
- ExampleResourceRequestHandler updated to reflect that it now represents a single resource request
- ExampleResourceRequestHandler is now used for all requests from the CefSharpSchemeHandlerFactory.SchemeName custom scheme

Issue #2743
2019-09-29 14:19:25 +10:00
amaitland e438e22741 Example - Add JSB Qunit Tests for Binder UInt conversion
Issue #2906
2019-09-27 08:07:37 +10:00
amaitland 750fc9f22e Javascript Binding - Add support for JsonString
JsonString is parsed into CefValue using the CefParseJson function
If your data is already stored in JSON then it can be parsed directly
or you can use a serializer of your choosing to turn a object into JSON
2019-07-20 12:11:43 +10:00
amaitland aa238b2f9d RequestEventHandler - Inherit from RequestHandler
- Remove commented out code
- Remove event args for methods that now don't exist in RequestHandler
- Basic code cleanup.
2019-06-25 19:24:57 +10:00
amaitland 8942b68336 ResourceRequestHandler - Move commented out methods in ExampleResourceRequestHandler 2019-06-25 19:24:57 +10:00
amaitland 7e731b0fa9 Code Cleanup - Rename DefaultRequestHandler to RequestHandler
Also renamed CefSharp.Example.Handlers.RequestHandler to CefSharp.Example.Handlers.ExampleRequestHandler

Will Add in Obsolete DefaultRequestHandler
2019-06-25 19:24:57 +10:00
amaitland 73a156fdc5 Initial version 75 upgrade and NetworkService changes
Compiles, that's about it at this point, there are major CEF breaking changes, and lots to be addressed.

Browser Process (main process)
- Removed IResourceHandlerFactory as it no longer fits with the structure that CEF provides
- New IResourceRequestHandler interface added, not plumbed in yet
- CefSettings - Add RootCachePath and ApplicationClientIdForFileScanning

BrowserSubprocess (render process)
- SendProcessMessage was moved from CefBrowser to CefFrame
- OnBrowserCreated added extraInfo param

The BrowserSubprocess changes for this upgrade should be complete
2019-06-25 19:24:57 +10:00
Alex Maitland fe98124c9b Async JavascriptBinding - Add support for returning Task (#2771)
* Async JavascriptBinding - Add support for returning Task

Remove Parallel Task execution code from MethodRunnerQueue
Add ParallelMethodRunnerQueue
  - For the new code path the Func is executed, if the Result is a generic Task we wait for it's completion
  - If the task is not generic then we return immediately

This is only enabled when CefSharpSettings.ConcurrentTaskExecution = true;
* MethodRunnerQueue - Display error message when method returns Task
* ParallelMethodRunnerQueue - Rename to ConcurrentMethodRunnerQueue
* MethodRunnerQueue - Improve formatting of error message when method returns Task
* Async JavascriptBinding Return Task - Add Basic xUnit Test

Very quick test, needs to be refined a little. The basics are working as expected.

* Add Binding Test Async Task Example to the WPF Example menu

* Async JSB Task - Add additional tests and improve error messaging
2019-06-08 17:21:49 +10:00
Alex Maitland 1a2c8ffcb6 Add CefSharp.PostMessage (#2799)
- JavascriptMessageReceived event added to ChromiumWebBrowser/IWebBrowser
- CefSharp.PostMessage and cefSharp.postMessage added to V8Context on creation for use in Javascript
- Add PostMessageTest.html
2019-06-03 21:08:03 +10:00
Alex Maitland 76e5a8d5c0 Add IAudioHandler (#2727)
* Feature Request - Add IAudioHandler

- For performance reasons we return NULL if no audiohandler is assigned
- No example is provided currently

Initial implementation for #2714
2019-05-03 12:54:40 +10:00
amaitland 335c884b08 Javascript Callback - Add additional tests
Add Basic tests, still need some more work.
Test changes added in #2748
2019-04-26 14:17:58 +10:00
João Neves 6692749728 WPF - Implement UpdateDragCursor (#2691)
* Close cefsharp subprocess if main process dies

* Implemented UpdateDragCursor

* Fixed braces position

* Added license header

* Fixed cursor flickering

* Added test

* Fixed build

* Fixed move cursor

* Fixed braces

* Simplified solution

* Fixed dropping Link effect

* Fixed encoding + Removed leftovers
2019-04-05 11:58:27 +10:00
Alex Maitland 02e3084af3 Add Chromium Extension Support (#2613)
* Add Chromium Extension Support

Add IRequestContext.LoadExtension
Add IExtensionHandler
Add IExtension
Add example (import from cefclient) - was added to CefSharp.WinForms.Example projct
Add RequestContextExtensions - to make loading an extension slightly easier
2018-12-31 13:12:10 +10:00
amaitland 2612c68002 Add IBrowserHost.RunFileDialog
Demo added to WinForms project

Resolves #2594
2018-12-28 13:39:33 +10:00
amaitland 4f71295941 CefSharp.Example - Move example classes into handlers/javascriptbinding folders/namespaces
Basic code cleanup
2018-10-29 16:21:42 +10:00
amaitland cfb0db1c3f RequestEventHandler - Add CanGetCookies and CanSetCookie 2018-03-28 14:40:26 +10:00
amaitland 4b4e568f7d Add BindingTestSingle.html
Simple test page that can be used to test cases in isolation (useful for debugging purposes)
2018-03-05 14:02:59 +10:00
Alex Maitland 9b01b69d2f Implement Javascript Binding v2 (#2247)
* JSB Rewrite - Add CefSharp.RegisterBoundObject javascript method

To get around the problem of IPC timing, I've reversed the communication, now it's the render process requesting
the bound objects, the implementation is incomplete at this stage, more just a basic proof of concept

Rewrite BindingTest.html using QUnit
One of the tests doesn't map correctly as it requires def user interaction

TODO:

- Get objects by name
- Rename Messages.h values that relate to this change so they are more descriptive
- Better error handling
- Caching of objects within a render process
- Investigate global context options, don't think it's possible to call an async method directly in the global context

# Conflicts:
#	CefSharp.Example/Resources/BindingTest.html

* JSB Improve Request/Response message names

* BindingTest.html - Output stress test results

* Remove JavascriptRootObject was leftover from time we used WCF to transmit objects

* JavascriptObjectRepository - Objects are now sent in the same list with an IsAsync flag

Separation when sending over IPC with two unique lists isn't necessary

* JavascriptObjectRepository - Return objects by name or return all by default

Untabify CefAppUnmanagedWrapper.cpp
Add minor comment to CefBrowserWrapper for a reminder that we use Frame Identifier as dictionary key

* Add //TODO: JSB comments for work that's left to be done

Ideally within a render process we cache bound objects once they've been communicated,
It would also be nice to make multiple binding requests so objects can later be added dynamically

* JSB Allow multiple calls to CefSharp.RegisterBoundObject

Update BindingTest.html to name two distinct calls to different bound objects

* JSB - Add some notes about caching, no working implementation yet

* JSB - Dynamically Register object on Request

* JSB Add ability to unbind an object and rename RegisterBoundObject to BindObjectAsync

# Conflicts:
#	CefSharp.Example/Resources/BindingTest.html

* JSB BindObjectAsync - if objects already bound then return false

* JSB - Ignore Indexer properties

Were previously throwing an exception

* JSB - Add LegacyJavascriptBindingEnabled option so preserve existing behaviour

This is only useful for SPA application and those that only navigate to pages
hosting within a single domain. Any sort of cross-site navigation and a new
render process will be spawned and objects won't be bound automatically
(You can use the new methods to request they're bound yourself, at least in theory,
more testing required on this)

* Add LegacyBindingTest.html

Current disabled by default. To enable uncomment CefSharpSettings.LegacyJavascriptBindingEnabled = true;
in CefExample.cs

* RegisterJsObject and RegisterAsyncJsObject can now only be used when CefSharpSettings.LegacyJavascriptBindingEnabled = true

See https://github.com/cefsharp/CefSharp/issues/2246 for details
2018-01-22 10:24:25 +10:00
amaitland e27c9c3c21 Add ExperimentalStreamResponseFilter - buffers all data before performing text processing 2018-01-18 10:25:52 +10:00
amaitland c303e1ca0f JSB - Add support for async methods to return classes
Structs and classes can now be returned from an async method
Properties and fields are supported now. The returned class/struct is readonly effectively, no updates will be sent to the bound object.

Just to clarify this is only for objects bound using RegisterAsyncJsObject
2018-01-08 15:12:52 +10:00
amaitland 464dd14b6f Update Example RequestHandler to inherit from DefaultRequestHandler
A new default implementation was added in #2157
BrowserTabView - cleanup usings and remove unused code
2017-12-20 10:01:34 +10:00
amaitland f5e2a938ec Follow up to #2015
Add license disclaimer
Move example MethodInterceptorLogger into CefSharp.Example project
Reword the IMethodInterceptor xml doc a little bit, probably still needs some work
2017-06-01 11:32:06 +10:00
amaitland 504d04dc43 Include FindReplaceMultiResponseFilter in example project, update it's copyright year and tweak it's formatting 2017-05-08 16:02:46 +10:00
amaitland 2cb7753b0b Add MemoryStreamResponseFilter example - data is copied into a memoryStream which can be read in IRequestHandler.OnResourceLoadComplete 2017-05-08 15:57:51 +10:00
amaitland 0067d02360 Add UnicodeExamples one equal to 32kb (the default buffer size) and one slightly greater.
Change CefSharpSchemeHandlerFactory to always include a BOM (premable) to the front of the response data
2017-05-05 13:06:26 +10:00
amaitland 6ded700373 Add Recaptcha test - https://cefsharp.com/Recaptcha.html 2017-03-30 07:55:47 +10:00
amaitland 04ff93817e Add https://pixabay.com/en/beach-pacific-coastline-ocean-coast-2089936/ to CefSharp.Example as embedded resource - test loading of image using browser.RegisterResourceHandler 2017-03-06 08:57:11 +10:00
Justin Stenning 2298ea0a93 Implementation of Cef.RegisterWidevineCdm (#1935)
* Added Cef.RegisterWidevineCdm for CEF Widevine CDM registration #1934
* Added test page for WidevineCdm registration and example registration #1934
* Noted additional steps for Widevine and proprietary codecs to CdmSupportTest.html
* Link for more information changed to issue #1934 in CefExample.cs
* replaced Cef.RegisterCdmCallback's async result with IRegisterCdmCallback parameter
* RegisterCdmCallback now uses taskCompletionSource
2017-02-13 15:37:55 +10:00
Florian Obermayer ee563827ac Request event handler (#1918)
* Create RequestEventArgs.cs

* Create RequestEventHandler

* Update RequestEventArgs.cs

corrected namespace

* removed regions, splitted up classes per file

* reformatted code

* removed wrong class doc

* deleted empty line

* removed TODOs (moved them in pr comments)

* adapted @amaitland 's pr notes

* made code backwards compatible to c# < 6

* made code backwards compatible to c# < 6 ++ (moved default values for event args to ctor)

* made code backwards compatible to c# < 6 ++ (added private setters to properties)
2017-02-10 09:24:27 +10:00
amaitland 2b4840fc90 Add CssAnimation example for testing purposes 2017-02-01 09:37:08 +10:00
Alex Maitland d4feffb554 Feature - Add IBinder (#1749)
* Add basic ModelBinding which was imported from NancyFx framework - more can be stripped out that's unused

* Add IBinder as a param when registering an object for binding
Binding is disabled by default

* Add license and remove unused using statements

* Make bind method virtual to allow for overriding
Make methods protected

* Add very basic collection support - only primitive types supported for now.
Remove unused exceptions

* Support binding a list of sub objects

* Add null check for null params

* Add BindingOptions class - remove binder and CamelCaseJavascriptNames properties - allow for additional options in the future
Breaking change.

* Add support for List<object> binding type
2016-07-20 13:38:24 +10:00
amaitland 63ef6beb5f Refactor OnContextInitialized out as part of IBrowserProcessHandler interface
Add OnScheduleMessagePumpWork for use with integrating into existing message loop - probably better for WinForms integration, will look at providing an example later
2016-07-20 13:08:47 +10:00
amaitland c8f6017fa5 Change TestCallbackFromObject to use new DynamicDictionary helper class 2016-07-06 11:06:00 +10:00