378 Commits

Author SHA1 Message Date
Alex Maitland fd9d52ebeb WinForms ChromiumWebBrowser - Change BrowserSettings property to use IBrowserSettings
Should resolve issue with WinForms Designer

Also make IBrowserSettings inherit from IDisposable.

Issue #2667
2019-02-28 15:01:57 +10:00
Mike Bragg 468ebea598 WinForms avoid throwing exception when setting BrowserSettings to null (#2637) 2019-02-07 15:08:42 +10:00
campersau 6e82717f3f add spaces in exception messages (#2620) 2019-01-12 08:00:07 +10:00
amaitland ee666b3cb6 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-10 18:59:26 +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
amaitland a9c29ae279 Refactor Dispose pattern - remove new Dispose override and destructor
Design time checks are now implemented in the protected Dispose override
Rename some methods
2017-02-16 19:14:09 +10:00
Chris e844bed531 Add Minimal WinForms Designer Support (#1946)
* Fixed designer support
* Adapted to feedback
* Revert "Adapted to feedback"
This reverts commit a1541c9cee.
* Adapted to feedback
* Added missing summary
2017-02-16 19:11:33 +10:00
amaitland 84930b0784 Update sandcastle help file version numbers to 55.0.0
Fix some other xml comments and remove some unused fields - still lots of comments that could be added
2017-02-06 15:00:45 +10:00
amaitland e23ad38a11 WinForms - Override IsKeyInput to get arrows + tab working when use MultiThreadedMessageLoop = false
Solution from http://stackoverflow.com/a/5606692
Post on ceforum for background info http://magpcss.org/ceforum/viewtopic.php?f=6&t=14557
2016-10-10 12:54:43 +10:00
smcilveen d1142e6374 Fixing nullreferenceexception on ControlExtensions.IsActive (#1788) 2016-08-30 23:16:02 +10:00
amaitland 79f3844cab Follow up to #1764
- Call SetHandlersToNull() in a consistent fashion across all three implementations
- Reword comments slightly
2016-08-09 12:40:58 +10:00
Dan Backes 7108ae3f43 Fix LifeSpanHandler not Called During Dispose (#1764)
- Make it so that the lifespan handler is still called when the
  ChromiumWebBrowser is disposed We need to make sure that the
  LifeSpanHandler is still around when `managedCefBrowserAdapter`
  is disposed since it is going to call `CloseBrowser`. That way,
  we can implement LifeSpanHandler and reject closing the entire
  application as described in #1574
2016-08-09 12:32:41 +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 933bad3dcc Add a more detailed description of what thread events are executed on
Should be enough to generate some meaningful API docs now
2016-06-15 14:14:39 +10:00
amaitland afe758eb51 Use GhostDoc to generate bulk xml documentation - it's not perfect at least a lot of the interface doco has been copied into the
ChromiumWebBrowser instance classes
2016-06-15 13:44:16 +10:00
amaitland d1d754cf58 Remove CefWindowInfo from ClientAdapter::OnBeforePopup they will now need to be made in client code
(This is now possible as IWindowInfo exposes all the relevant pieces).
This will allow for a little more flexibility, specially on the WinForms front, it should be possible to create the control and then show the window later
2016-05-19 12:11:29 +10:00
amaitland 54f7fccdaa Upgrade to .Net 4.5.2
Resolve #1572
2016-05-10 20:28:21 +10:00
amaitland af457916e3 Implement IFindHandler
Resolves #1459
2016-03-07 12:44:49 +10:00
amaitland 71ce888073 First steps to publishing a symbols package
Add pdb files to nuspec - they're only included when the -symbol flag is used
Add src files to nuspec - they're only included when the -symbol flag is used
Update appveyor.yml to push symbol packages to the MyGet feed
Add -symbol flag to build.ps1 so the symbol packages are generated
WinForms project not outputs pdb files
WinForms release builds are not optimized - probably should have been already
2016-02-26 11:49:52 +10:00
amaitland 627f80c8ec Pass in only the required params into BrowserProcessServiceHost - was passing in the browser adapter which wasn't strictly required.
Pass the IBrowser instance into IWebBrowserInternal.OnAfterBrowserCreated
Keep a reference to IBrowser in the ChromiumWebBrowser instances (reduces the number of GetBrowser calls and also makes it clearer internally when the browser variable is set)
2016-01-12 14:01:37 +10:00
amaitland bae3c28e92 Update copyright to 2016 2016-01-11 14:11:30 +10:00