Cef Methods |
The Cef type exposes the following members.
Name | Description | |
---|---|---|
AddCrossOriginWhitelistEntry | Add an entry to the cross-origin whitelist. | |
AddDisposable | ||
ClearCrossOriginWhitelist | Remove all entries from the cross-origin access whitelist. | |
ClearSchemeHandlerFactories |
Clear all scheme handler factories registered with the global request context.
Returns false on error. This function may be called on any thread in the browser process.
Using this function is equivalent to calling Cef.GetGlobalRequestContext().ClearSchemeHandlerFactories().
| |
ColorSetARGB |
Helper function (wrapper around the CefColorSetARGB macro) which combines
the 4 color components into an uint32 for use with BackgroundColor property
| |
CurrentlyOnThread |
Returns true if called on the specified CEF thread.
| |
DoMessageLoopWork |
Perform a single iteration of CEF message loop processing.This function is
provided for cases where the CEF message loop must be integrated into an
existing application message loop. Use of this function is not recommended
for most users; use CefSettings.MultiThreadedMessageLoop if possible (the default).
When using this function care must be taken to balance performance
against excessive CPU usage. It is recommended to enable the
CefSettings.ExternalMessagePump option when using
this function so that IBrowserProcessHandler.OnScheduleMessagePumpWork()
callbacks can facilitate the scheduling process. This function should only be
called on the main application thread and only if Cef.Initialize() is called
with a CefSettings.MultiThreadedMessageLoop value of false. This function
will not block.
| |
EnableWaitForBrowsersToClose |
WaitForBrowsersToClose is not enabled by default, call this method
before Cef.Initialize to enable. If you aren't calling Cef.Initialize
explicitly then this should be called before creating your first
ChromiumWebBrowser instance.
| |
ExecuteProcess |
This function should be called from the application entry point function to execute a secondary process.
It can be used to run secondary processes from the browser client executable (default behavior) or
from a separate executable specified by the CefSettings.browser_subprocess_path value.
If called for the browser process (identified by no "type" command-line value) it will return immediately with a value of -1.
If called for a recognized secondary process it will block until the process should exit and then return the process exit code.
The |application| parameter may be empty. The |windows_sandbox_info| parameter is only used on Windows and may be NULL (see cef_sandbox_win.h for details).
| |
GetGlobalCookieManager |
Returns the global cookie manager. By default data will be stored at CefSettings.CachePath if specified or in memory otherwise.
Using this method is equivalent to calling Cef.GetGlobalRequestContext().GetCookieManager()
The cookie managers storage is created in an async fashion, whilst this method may return a cookie manager instance,
there may be a short delay before you can Get/Write cookies.
To be sure the cookie manager has been initialized use one of the following
- Access the ICookieManager after ICompletionCallback.OnComplete has been called
- Access the ICookieManager instance in IBrowserProcessHandler.OnContextInitialized.
- Use the ChromiumWebBrowser BrowserInitialized (OffScreen) or IsBrowserInitializedChanged (WinForms/WPF) events.
| |
GetGlobalRequestContext |
Gets the Global Request Context. Make sure to Dispose of this object when finished.
The earlier possible place to access the IRequestContext is in IBrowserProcessHandler.OnContextInitialized.
Alternative use the ChromiumWebBrowser BrowserInitialized (OffScreen) or IsBrowserInitializedChanged (WinForms/WPF) events.
| |
GetMimeType |
Returns the mime type for the specified file extension or an empty string if unknown.
| |
GetMinLogLevel |
Gets the current log level.
When LogSeverity is set to Disable then
no messages will be written to the log file, but FATAL messages will still be output to stderr.
When logging is disabled this method will return Fatal.
| |
Initialize(CefSettingsBase) |
Initializes CefSharp with user-provided settings.
It's important to note that Initialize and Shutdown MUST be called on your main
application thread (typically the UI thread). If you call them on different
threads, your application will hang. See the documentation for Cef.Shutdown() for more details.
| |
Initialize(CefSettingsBase, Boolean) |
Initializes CefSharp with user-provided settings.
It's important to note that Initialize/Shutdown MUST be called on your main
application thread (typically the UI thread). If you call them on different
threads, your application will hang. See the documentation for Cef.Shutdown() for more details.
| |
Initialize(CefSettingsBase, Boolean, IApp) |
Initializes CefSharp with user-provided settings.
It's important to note that Initialize/Shutdown MUST be called on your main
application thread (typically the UI thread). If you call them on different
threads, your application will hang. See the documentation for Cef.Shutdown() for more details.
| |
Initialize(CefSettingsBase, Boolean, IBrowserProcessHandler) |
Initializes CefSharp with user-provided settings.
It's important to note that Initialize/Shutdown MUST be called on your main
application thread (typically the UI thread). If you call them on different
threads, your application will hang. See the documentation for Cef.Shutdown() for more details.
| |
InitializeAsync |
Initializes CefSharp with user-provided settings. This method allows you to wait for
OnContextInitialized to be called before continuing.
It's important to note that Initialize and Shutdown MUST be called on your main
application thread (typically the UI thread). If you call them on different
threads, your application will hang. See the documentation for Cef.Shutdown() for more details.
| |
ParseUrl |
Parse the specified url into its component parts.
Uses a GURL to parse the Url. GURL is Google's URL parsing library.
| |
PostAction |
Post an action for execution on the specified thread.
| |
PostDelayedAction |
Post an action for delayed execution on the specified thread.
| |
PreShutdown |
Called prior to calling Cef.Shutdown, this disposes of any remaining
ChromiumWebBrowser instances. In WPF this is used from Dispatcher.ShutdownStarted
to release the unmanaged resources held by the ChromiumWebBrowser instances.
Generally speaking you don't need to call this yourself.
| |
QuitMessageLoop |
Quit the CEF message loop that was started by calling Cef.RunMessageLoop().
This function should only be called on the main application thread and only
if Cef.RunMessageLoop() was used.
| |
RemoveCrossOriginWhitelistEntry | Remove entry from cross-origin whitelist | |
RemoveDisposable | ||
RunMessageLoop |
Run the CEF message loop. Use this function instead of an application-
provided message loop to get the best balance between performance and CPU
usage. This function should only be called on the main application thread and
only if Cef.Initialize() is called with a
CefSettings.MultiThreadedMessageLoop value of false. This function will
block until a quit message is received by the system.
| |
SetCrashKeyValue |
Sets or clears a specific key-value pair from the crash metadata.
| |
Shutdown |
Shuts down CefSharp and the underlying CEF infrastructure. This method is safe to call multiple times; it will only
shut down CEF on the first call (all subsequent calls will be ignored).
This method should be called on the main application thread to shut down the CEF browser process before the application exits.
If you are Using CefSharp.OffScreen then you must call this explicitly before your application exits or it will hang.
This method must be called on the same thread as Initialize. If you don't call Shutdown explicitly then CefSharp.Wpf and CefSharp.WinForms
versions will do their best to call Shutdown for you, if your application is having trouble closing then call thus explicitly.
| |
ShutdownWithoutChecks |
This method should only be used by advanced users, if you're unsure then use Cef.Shutdown().
This function should be called on the main application thread to shut down
the CEF browser process before the application exits. This method simply obtains a lock
and calls the native CefShutdown method, only IsInitialized is checked. All ChromiumWebBrowser
instances MUST be Disposed of before calling this method. If calling this method results in a crash
or hangs then you're likely hanging on to some unmanaged resources or haven't closed all of your browser
instances
| |
WaitForBrowsersToClose |
Helper method to ensure all ChromiumWebBrowser instances have been
closed/disposed, should be called before Cef.Shutdown.
Disposes all remaining ChromiumWebBrowser instances
then waits for CEF to release its remaining CefBrowser instances.
Finally a small delay of 50ms to allow for CEF to finish it's cleanup.
Should only be called when MultiThreadedMessageLoop = true;
(Hasn't been tested when when CEF integrates into main message loop).
| |
WaitForBrowsersToClose(Int32) |
Helper method to ensure all ChromiumWebBrowser instances have been
closed/disposed, should be called before Cef.Shutdown.
Disposes all remaining ChromiumWebBrowser instances
then waits for CEF to release its remaining CefBrowser instances.
Finally a small delay of 50ms to allow for CEF to finish it's cleanup.
Should only be called when MultiThreadedMessageLoop = true;
(Hasn't been tested when when CEF integrates into main message loop).
|