Commit Graph

394 Commits

Author SHA1 Message Date
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
amaitland f725ab3907 WinForms - DefaultFocusHandler now allows browser to take focus on initial load
Previously on LoadUrl etc we didn't take focus, we now take focus on the initial Load so touch screens work
The behaviour when using ChromiumWebBrowser.ActivateBrowserOnCreation = true is still the same as versions prior to 73 (version 73 is the only different version)

Issue #2776
2019-06-04 20:10:47 +10:00
amaitland 7c3d66817b WinForms - Add ChromiumWebBrowser.ActivateBrowserOnCreation
Set ActivateBrowserOnCreation = true to restore the old behaviour where the browser was activated upon creation.

Issue #2776
2019-06-04 19:50:16 +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
amaitland b09b5fd959 WinForms - Replace EditorBrowsable(EditorBrowsableState.Never) with DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)
Was hiding the methods from Intellisense

Resolves #2784
2019-05-28 13:56:24 +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 3cff24cf1f DefaultFocusHandler.OnGotFocus - Add browser null check
For the print dialog we appear to be passed a CefRefPtr<CefBrowser> reference which doesn't appear to trigger an OnAfterCreated call
so we have no reference to it. Looking at the `CefBrowser`, there's no real data of value, empty url, no frame information (just an invalid frame id)
so for now we'll just ignore it in DefaultFocusHandler, we don't want to handle for popups anyway

Resolves #2725
2019-04-17 20:34:47 +10:00
Chris e22d1c2fd2 Removed IsBrowserInitializedChangedEventArgs (#2710) 2019-04-10 19:51:34 +10:00
Alex Maitland c3bbd37cce Reorder dispose pattern in ChromiumWebBrowser (#2701)
* WinForms/Wpf/OffScreen - Reorder Dispose methods

- Set browser initialized to false
- Release event handlers
- Dispose managedCefBrowserAdapter
- Set handlers to null

* WinForms/WPF/OffScreen - Set Handlers to null immediately after event handlers cleared

The one exception is LifeSpanHandler which is released after managedCefBrowserAdapter.Dispose
2019-03-26 20:14:13 +10:00
Chris 987f988dac Refactoring - Moved RegisterJsObject and RegisterAsyncJsObject to WebBrowserExtensions (#2703) 2019-03-23 13:31:09 +10:00
Chris 86b2d8cecd Improved dispose pattern in ChromiumWebBrowser (#2651)
* Code Cleanup - Improved ChromiumWebBrowser Dispose/Finalise

* Added thread safe dispose pattern
* Added IsDisposed

* Wpf - Cleanup and improvements to the dispose pattern

* WinForms - Cleanup and improvements to the dispose pattern

* OffScreen - Cleanup and improvements to the dispose pattern

* Added IsDisposed to IWebBrowser

* Fixed comments

* WinForms - Removed Finalizer and Dispose()

* WPF - ChromiumWebBrowser.Dispose add comment for Interlocked.CompareExchange

* WinForms - ChromiumWebBrowser.Dispose add comment for Interlocked.CompareExchange
2019-03-22 21:49:02 +10:00
amaitland d2d1e6f879 WPF/WinForms/OffScreen - Move BrowserSettings Dispose into ManagedCefBrowserAdapter::CreateBrowser
- Improve BrowserSettings disposed check message

Follow up to #2643
2019-03-22 10:46:54 +10:00
amaitland 3423670740 WinForms/WPF/OffScreen - Dispose of BrowserSettings only if created by CefSharp framework
- Add OffScreen project to internals visible to list for CefSharp.Core
- Add BrowserSettings.FrameworkCreated property which can only be set through an internal constructor
- Dispose of BrowserSettings immediately after call to CreateBrowser if created by CefSharp framework
- managedCefBrowserAdapter::CreateBrowser  throw exception if browserSettings already disposed

Resolves #2643
2019-03-21 20:13:02 +10:00
Chris 16115724a4 EditorConfig: Added missing csharp_indent_case_contents_when_block (#2699) 2019-03-21 10:23:30 +10:00
amaitland f3d4fe8b20 WinForms - Add example to xml doc of CreateBrowserWindowInfo 2019-03-21 10:07:56 +10:00
amaitland a7a73dc930 WinForms - Disable Window Activation by default
WS_EX_NOACTIVATE added to WindowInfo.ExStyle

To re-enable Window activation when the browser is created inherit from ChromiumWebBrowser and override CreateBrowserWindowInfo
and remove WS_EX_NOACTIVATE from WindowInfo.ExStyle

Resolves #1811
2019-03-21 09:56:09 +10:00
amaitland 1c5d4000fa WinForms/WPF - Dispose of IFrame after calling LoadUrl 2019-03-18 20:11:48 +10:00
amaitland 2c9155f1cb WinForms/WPF - Change browserSettings to use the private field to avoid throw exception in dispose
- Changed to expose only the public interface (this is better for scenarios where the designer attempts to query the property and subsequently attempts to load libcef and fails).
- Make IBrowserSettings implement IDisposable
- ManagedCefBrowserAdapter::CreateBrowser now throws exception if browserSettings param is null

The WPF version won't actually throw an exception, just standardised it's code so they're both the same.

Issue #2638
2019-02-08 10:14:32 +10:00
campersau b31069633e add spaces in exception messages (#2620) 2019-01-11 08:57:28 +10:00
amaitland 4a41fdfd07 WinForms - Dispose of BrowserSettings after browser created
BrowserSettings must be set before the call to CefBrowserHost::CreateBrowser for this reason we enforce these checks.
Throw exception if attempt to set BrowserSettings after browser has been created

Initially I was going to make BrowserSettings a private set, unfortunately that probably won't work if you are using the designer
as there would be no way to instantiate a new instance. It was possible to lazy initialize in the get method, that doesn't really provide
a descriptive error message, I could have updated the documentation to describe the behaviour, unfortunately people just don't really the docs.
2019-01-09 17:12:28 +10:00
amaitland 821a44fecc WinForms - ChromiumWebBrowser remove workaround for address not always loading correctly when passed into CreateBrowser
Manually reverts commit https://github.com/cefsharp/CefSharp/commit/1ab416895845e07706d8b798a78945d72b72871f
2018-12-31 13:27:50 +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 bbf7795d80 WPF/OffScreen - Add OnAcceleratedPaint
Exposes the CEF API for Shared D3D11 Texture support. This should be considered experimental as there are quite a few known bugs in the CEF implementation
(PDF Viewer not working correctly)

OffScreen.ChromiumWebBrowser.CreateBrowser API changed (breaking change) now pass in `WindowInfo` to customise settings
Refactor CreateBrowser to support windowed and OSR rendering (now accepts IWindowInfo)

Resolves #2527
2018-12-16 19:37:12 +10:00
Chris ac6e6356b8 WinForms - Added missing Browsable Attribute on JavascriptObjectRepository (#2590)
WinForms - Added missing Browsable attribute on JavascriptObjectRepository + Updated DefaultValue attribute on UseParentFormMessageInterceptor
2018-12-07 04:40:36 +01:00
Alex Sukhovy 304a300b0c Call OnContextCreated and OnContextReleased for each frame (#2373)
* ContextEvents for each frame

* set CanExecuteJavascriptOnMainFrame

* example and comments

* whitespace fix

* comments

* whitespace

* update comments
2018-10-28 16:48:50 +10:00
amaitland 1b39c2a70a WinForms/WPF/OffScreen - Cleanup some xml doc around BrowserInitialized event
Probably still needs some work, would be nice if the event was the same in all three instances, difficult with the WPF version being a DependencyPropertyChangedEventHandler
2018-09-27 22:02:00 +10:00
Chris 30ee538ce0 Added EditorConfig (#2514) 2018-09-17 00:46:21 +02:00
Chris bef5dd37c4 Maintenance - Fixed formatting, file encoding, and copyright year (#2504)
* Applied formatting

* Fixed file encoding + Updated copyright year

* Updated License

* Fixed more file encoding

* Copyright notice now shows the year the file was created
2018-09-10 10:41:13 +10:00
amaitland 28f43261b6 Xml Doc - Add more comments and fixes 2018-09-05 13:02:43 +10:00
amaitland 8ed2681619 Xml Doc - Add some more xml doc
Some of it's just placeholder doc to keep sandcastle happy
2018-09-05 13:01:41 +10:00
amaitland 2f12fe1672 WinForms - Further refine parameterless constructor xmldoc comment 2018-08-17 21:31:26 +10:00
amaitland ce870405bd WinForms - Add additional wording to constructor obsolete message 2018-08-17 10:42:22 +10:00
amaitland d87e795000 WinForms/Wpf/OffScreen - Create specific CefSettings class for each version
- This is a breaking change as there is no common `CefSharp.CefSettings`, there is no `CefSharp.Wpf.CefSettings`, `CefSharp.WinForms.CefSettings` and `CefSharp.OffScreen.CefSettings`
 - Cef.Initialize has been removed, the `ChromiumWebBrowser` constructor will call the `Cef.Initialize` with the defaults for your flavour
 - CefSettings.FocusedNodeChangedEnabled has been moved to CefSharpSettings.FocusedNodeChangedEnabled

Resolves #2477
2018-08-02 10:47:12 +10:00
amaitland 430c439690 IFocusHandler - Add IWebBrowser and IBrowser Params
IFocusHandler methods are now called for popups, use browser.IsPopup to differentiate
DefaultFocusHandler has been updated accordingly

Resolves #2468
2018-07-24 12:26:04 +10:00
amaitland d99d6d87fe Set event handlers to null in Dispose
Not all event handlers were set to null on Dispose in ChromiumWebBrowser instances and JavascriptObjectRepository

Resolves #2307
2018-04-13 16:18:57 +10:00
amaitland 44b9f14599 WinForms - Add UseParentFormMessageInterceptor property, defaults to true
Allow for disabling of parentFormMessageInterceptor, should only be required for multithreademessageloop = true
2018-03-23 14:53:37 +10:00
amaitland c37dbcd06a Remove Geolocation API and Upgrade version numbers to 65 2018-03-17 21:31:25 +10:00
Chris 6175648e80 WinForms: Prevent designer from setting any default values (#2265) 2018-02-06 09:20:57 +10:00
amaitland 1ab4168958 WinForms - Temp workaround for a bug where the address passed into the constructor isn't always loading 2018-02-05 13:56:54 +10:00
Chris 456ec8b935 WinForms: Prevent designer from setting default values (#2261) 2018-02-05 10:36:55 +10:00
Chris 29fc52e6da Revert build breaking change (#2262) 2018-02-05 10:35:32 +10:00
amaitland bfbd30cce5 WinForms - Add custom Designer
Add some custom designer attributes
Converted the logo.png to a 16x16 bmp as a short term placeholder (someone is welcome to contribute something better)
Hide all the handlers from the designer
2018-02-02 15:51:21 +10:00
amaitland efc77d4fcc Fix typo 2018-01-22 11:03:49 +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 85e32974ae WinForms - If the ChromiumWebBrowser has it's handle recreated then in OnHandleCreated we will now attempt to reparent a existing instance rather than creating a new browser
# Conflicts:
#	CefSharp.WinForms/ChromiumWebBrowser.cs
2018-01-18 10:25:51 +10:00
amaitland 93a329bc7a WinForms/WPF Fix incorrect type check when setting RequestContext 2017-12-20 12:26:50 +10:00
amaitland d585348887 Add RequestContext getter property to IWebBrowser
WPF - Add checks so if RequestContext is set after browser created an exception is thrown
WinForms - Add checks so if RequestContext is set after browser created an exception is thrown
2017-12-20 12:26:49 +10:00
amaitland eecf3aded9 Add IWebBrowser.CanExecuteJavascriptInMainFrame property, set to true/false when V8Context is created/released
Added checks in the execute/eval javscript methods in WebBrowserExtensions
Made possibly by the addition of OnContextReleased IPC message being added
2017-03-28 09:43:59 +10:00
Chris cd934267c6 Updated copyright year and made sure it used same format everywhere (#1966) 2017-03-06 08:44:37 +10:00
amaitland c827af48b3 Re-add call to Cef.RemoveDisposable 2017-02-16 19:24:49 +10:00