-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
CefSharp 43
CefSharp 43 provides much better access to the underlying CEF API
and as such there are many changes over version 41
. A number of changes will be required when updating. This document provides some information.
- Expose
IFrame
andIBrowser
interfaces. - Access to the underlying popup browser wrappers.
- Breaking changes for many handlers
- List methods that will be deprecated
- Include information on any areas that were rewritten, e.g. resource handling
PR's tagged as breaking change
can be found at https://github.com/cefsharp/CefSharp/issues?utf8=%E2%9C%93&q=label%3Abreaking-change+is%3Amerged
- WCF can now be disabled via
CefSharpSettings.WcfEnabled = false;
. Disables JavaScript object binding. Native ChromeIPC
used instead for allIPC
,ExecuteScriptAsync
andEvaluateScriptAsync
.
Breaking Changes
CEF
- Built-in PDF viewer removed. See #1144 for workaround.
Deployment
- New CEF binary files need to be included with
libcef.dll
, etc.: natives_blob.bin
snapshot_blob.bin
ISchemeHandlerFactory
Old: ISchemeHandler Create()
New: ISchemeHandler Create(IBrowser browser, IFrame frame, string schemeName, IRequest request)
To upgrade: add new parameters. Code logic does not need to change.
ISchemeHandler
ProcessRequestAsync
turns into 2 methods: ProcessRequestAsync
and GetResponse
.
Old: bool ProcessRequestAsync(IRequest request, ISchemeHandlerResponse response, OnRequestCompletedHandler requestCompletedCallback)
New: bool ProcessRequestAsync(IRequest request, ICallback callback)
New: Stream GetResponse(IResponse response, out long responseLength, out string redirectUrl)
To upgrade: store the response stream in a class field, then call callback.Continue()
instead of the old requestCompletedCallback
. See here for example of new usage: https://github.com/cefsharp/CefSharp/blob/master/CefSharp.Example/CefSharpSchemeHandler.cs
IKeyboardHandler
Old: public bool OnKeyEvent(IWebBrowser browserControl, KeyType type, int windowsKeyCode, CefEventFlags modifiers, bool isSystemKey)
New: bool OnPreKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut);
To upgrade: add new parameters IBrowser browser
, int nativeKeyCode
and ref bool isKeyboardShortcut
. Code logic does not need to change.