Commit Graph

399 Commits

Author SHA1 Message Date
amaitland 493897983d Core - Rename CefSharp.Internals.CefRequestWrapper to CefSharp.Request
- Made public
- Added public constructor

Related issue #1721
2019-11-23 14:27:27 +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 61e82bc50c ClientAdapter::GetResourceRequestHandler - LoadHtml and (Un)RegisterResource would only work if RequestHandler not null
- Revised login so RequestHandler not required
2019-08-24 07:40:32 +10:00
amaitland e388f5f151 ClientAdapter - Call IWebBrowserInternal Set/On methods when ChromiumWebBrowser is used for hosting popup
IWebBrowserInternal calls like SetLoadingStateChange weren't being made when IsPopup is true, add additional
HasParent check to determine if we're hosting the popup in a ChromiumWebBrowser instance.
2019-08-12 12:01:24 +10:00
amaitland bbef0f3fa6 ClientAdapter::MethodInvocationComplete - Add checking for valid frame
Make we have a frame that matches the Id and that it's valid before attempting to create a IPC message
2019-08-06 14:27:44 +10:00
amaitland 256e7275d5 IRequestHandler.GetAuthCredentials - Replace frame param with sourceUrl
https://bitbucket.org/chromiumembedded/cef/commits/5e9ca096e0bbdbd6661df5d882082e3324237993
2019-07-18 21:18:56 +10:00
amaitland 998c5a280f ClientAdapter - Add ResourceRequestHandlerFactory->HasHandlers check to GetResourceRequestHandler 2019-06-25 19:24:57 +10:00
amaitland ff87529a49 Javascript Legacy Binding - Pass objects on CefBrowserHost::CreateBrowser
Previously objects were sent in OnRenderViewReady, which is only called once for a browser instance, not for process switches
Now objects are passed when the browser is created, still need to check for popup handling
2019-06-25 19:24:57 +10:00
amaitland 0542c5138b SendProcessMessage - Remove frame/browserid from messages
Not complete or tested yet
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 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 a0d74dd63e IDisplayHandler - Add OnLoadingProgressChange
Resolves #2686
2019-03-27 22:05:17 +10:00
amaitland d5a8108ed1 RequestContext.h - Split method implementation out into RequestContext.cpp
Also fix up some other includes that were broken as a result. Still a lot more code cleanup to do.
2019-01-10 07:07:28 +10:00
Chris 98d7262987 Refactoring - Move CefCookie conversion to TypeConversion (#2597) 2018-12-13 10:59:05 +01:00
amaitland cbd87dc7ce OnContextCreated/OnContextDestroyed - only continue if valid frame ptr
Follow up to #2563
2018-11-09 07:13:34 +10:00
Mitch Capper 921929484a Make sure frame is not null before accessing it (#2563)
closes #256
2018-11-09 07:09:39 +10: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 dcff3d0094 IJsDialogHandler - Rename OnJSBeforeUnload to OnBeforeUnloadDialog
Also fix xml doc

Resolves #2523
2018-09-25 20:56:31 +10:00
amaitland 05b37ab615 ClientAdapter::OnBeforePopup - throw exception if return true and newBrowser != null
Hopefully this reduces the number of support requests
2018-09-15 19:46:54 +10: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 e901c05581 Untabify ClientAdapter.cpp 2018-08-07 20:30:03 +10:00
amaitland a9f249e835 ClientAdapter::OnSetFocus - When DevTools is opened, OnSetFocus is called before OnAfterCreated
The causes GetBrowserWrapper to return null when DevTools is opened, for now we'll just create the wrapper
and pass it directly (wrapper is disposed when it goes out of scope).
2018-08-07 19:10:58 +10:00
amaitland 9d4504db99 IDownloadHandler - Add IWebBrowser param to methods
Resolves #2470
2018-07-24 12:38:45 +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 8301090afe Merge branch 'split_ceffiledialogmode_enum' of https://github.com/fuzzykiller/CefSharp 2018-07-02 18:24:44 +10:00
amaitland 552962ba77 IRequestHandler.OnBeforeBrowse - Add userGesture param
The userGesture value will be true if the browser
navigated via explicit user gesture (e.g. clicking a link) or false if it
navigated automatically (e.g. via the DomContentLoaded event).
2018-05-03 12:11:52 +10:00
amaitland 8f7692ae6e JSB - Add JavascriptBindingCompleteEventArgs and config options to CefSharp.BindObjectAsync
CefSharp.BindObjectAsync can now take an optional config object as first param
Include additional information when binding complete
Add option for cefSharp.bindObjectAsync (starting with lowercase latters)
Add new syntax options - not entirely complete, no variant for the options object
Add ignore cache option
2018-04-27 16:40:39 +10:00
amaitland c1b89c62e9 WPF/OffScreen - Code cleanup and minor refactor
IRenderWebBrowser - Method naming now matches CEF, xmldoc updated to be more accurate

CefSharp.Wpf.ChromiumWebBrowser and CefSharp.OffScreen.ChromiumWebBrowser both updated as a result of IRenderWebBrowser changes
Should be minimal public API changes, should only require changes for those that are implementing their own rendering, who will have a major rewrite on their hands regardless of this.
2018-04-20 14:49:25 +10:00
amaitland a87d834409 Add Cef.GetBlockingCookieManager, IRequestHandler.CanGetCookies and IRequestHandler.CanSetCookie
RequestEventHandler example implementation is incomplete
2018-03-28 14:28:38 +10:00
amaitland c37dbcd06a Remove Geolocation API and Upgrade version numbers to 65 2018-03-17 21:31:25 +10:00
João Neves 5a713fdf7d Support uncaught exception handling (#2244)
* Added support for uncaught javascript exception in Render Process Message Handler
* Fixed typo
* Added stack frame column numbers
* Code review
* Code review
* Update JavascriptException.cs
2018-03-07 10:21:31 +10:00
Daniel B 613ddced0a Split CefFileDialogMode into CefFileDialogMode and CefFileDialogFlags 2018-02-18 22:34:51 +01:00
amaitland 43b427bd00 JSB - JavascriptObjectRepository.ResolveObject was only being called when object previously registered
The HasBoundObjects check has been removed, now we always attempt to GetObjects and return a response

Resolves #2273
2018-02-13 09:43:40 +10:00
amaitland 38be769f96 OnConsoleMessage - Add LogSeverity 2018-02-05 17:30:44 +10:00
amaitland 7c699e3ec6 IJavascriptObjectRepositry - Add ObjectBoundInJavascript event
Executed on the thread pool when objects are bound in JS
2018-01-22 12:19:43 +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 127c00554f Rewrite WPF/OffScreen OnPaint
OffScreen
  - Now maintains a raw Byte[] buffer that is used to create the GDI bitmaps
can be overridden and raw buffer access granted (eliminates the forced memory copy to the memory mapped view)

WPF
  - MemoryMappedFile.CreateNew is now used to create the in memory view and copy the buffer
  - InteropBitmapFactory only create new MemoryMappedFile selectively. If the MemoryMappedFile is larger than we require then just reuse it rather than
    releasing then allocating a smaller section of memory that's used for double buffering with InteropBitmap and WritableBitmap
  - Removed CefDirtyRect and used existing Rect class
  - Rename rendering event to Paint, still preferable to implement IBitmapFactory or subclass ChromiumWebBrowser
  - Update ChromiumWebBrowserWithScreenshotSupport to support new rendering method - not very well tested.

Resolves #2237
2018-01-18 11:29:12 +10:00
amaitland 921ea55fff Add IDisplayHandler.OnAutoResize, IBrowserHost.SetAccessibilityState, IBrowserHost.SetAutoResizeEnabled
Wrappers for new methods/callback added
2017-12-21 08:53:56 +10:00
amaitland b78208b505 Untabify ClientAdapter.cpp 2017-06-02 11:34:26 +10:00
amaitland f93a387593 Use fully qualified cli::array as it appears VS2015 gets confused with the generic std::array (must be in the newer C++ library as code builds fine in VS2013)
Resolves #2049
2017-05-16 23:14:02 +10:00
Chris 2b7bdf863f Updated OnTooltipChanged to allow for modifying text (#1953)
* Updated OnTooltipChanged to allow for modifying text

* Updated examples
2017-05-15 02:52:02 +02:00
amaitland c8d0127f31 In rare cases CefStreamReader::CreateForFile returns null - rather than causing a hard crash, log the error and return NULL 2017-05-08 13:22:57 +10:00
amaitland 6691d0080a Refactor ResourceHandler, split FileResourceHandler out into it's own class, rather than relaying on ResourceHandlerType - this allows us to add more underlying CEF type wrappers without a huge amount of effort now.
Add new ByteArrayResourceHandler - uses CefStreamReader::CreateForData to load the byte array, for use with CefStreamResourceHandler
Add ResourceHandler.FromByteArray method for ease of use
Change ResourceHandler.FromString to use the new ByteArrayResourceHandler class
2017-05-05 12:55:44 +10:00
Chris 8df4ec5342 Expanded proxy support, made it easier to set proxy settings (#2007)
- Added a ProxyOptions class
- Added a CefSharpSettings.Proxy property
- Made ClientAdapter::GetAuthCredentials take care of the authentication for the proxy
2017-04-12 02:43:11 +02:00
Chris 41b038a6b5 Fixed NullReferenceException in DoClose (#1980)
* Fixed NullReferenceException in DoClose
2017-03-31 07:29:32 +10:00
amaitland d60d1b73c8 SetCanExecuteJavascriptOnMainFrame was only being set when there was a RenderProcessMessageHandler assigned, change so it's always set
Improve the formatting of the exception thrown
2017-03-28 10:03:21 +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
amaitland 423fc2a806 OnBeforePopup - throw exception if newBrowser == _browserControl (should never be) 2017-03-10 11:59:05 +10:00
amaitland 5d459a5d32 Add IRenderProcessMessageHandler.OnContextReleased - native IPC message sent from render process 2017-03-07 09:23:10 +10:00