"CefSharp.Core.Runtime"
Creates a detailed expection string from a provided Cef V8 exception.
The exception which will be used as base for the message
Assigns the provided cef_string_t object from the given .NET string.
The cef_string_t that should be updated.
The .NET string whose value should be used to update cefStr.
Converts a .NET List of strings to native (unmanaged) format.
The List of strings that should be converted.
An unmanaged representation of the provided List of strings, or an empty List if the input is a nullptr.
Converts a .NET string to native (unmanaged) format. Note that this method does not allocate a new copy of the
The string that should be converted.
An unmanaged representation of the provided string, or an empty string if the input string is a nullptr.
Converts an unmanaged vector of strings to a (managed) .NET List of strings.
The vector of strings that should be converted.
A .NET List of strings.
Converts an unmanaged string to a (managed) .NET string.
The string that should be converted.
A .NET string.
Converts an unmanaged string to a (managed) .NET string.
The string that should be converted.
A .NET string.
Returns true if the underlying POST data includes elements that are not
represented by this IPostData object (for example, multi-part file upload
data). Modifying IPostData objects with excluded elements may result in
the request failing.
Create a new instance
PostDataElement
Remove all existing post data elements.
Remove the specified .
element to be removed.
Returns true if the add succeeds.
Add the specified .
element to be added.
Returns true if the add succeeds.
Retrieve the post data elements.
Returns true if this object is read-only.
Initializes a new instance of the PostData class.
Throw exception if Readonly
Thrown when an exception error condition occurs.
Destructor.
Finalizer.
Form Post Data
Helper method to ensure all ChromiumWebBrowser instances have been
closed/disposed, should be called before Cef.Shutdown.
Disposes all remaning ChromiumWebBrowser instances
then waits for CEF to release it's remaning 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 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.
Returns the mime type for the specified file extension or an empty string if unknown.
file extension
Returns the mime type for the specified file extension or an empty string if unknown.
Sets or clears a specific key-value pair from the crash metadata.
Crash reporting is configured using an INI-style config file named
crash_reporter.cfg. This file must be placed next to
the main application executable. File contents are as follows:
# Comments start with a hash character and must be on their own line.
[Config]
ProductName=<Value of the "prod" crash key; defaults to "cef">
ProductVersion=<Value of the "ver" crash key; defaults to the CEF version>
AppName=<Windows only; App-specific folder name component for storing crash
information; default to "CEF">
ExternalHandler=<Windows only; Name of the external handler exe to use
instead of re-launching the main exe; default to empty>
ServerURL=<crash server URL; default to empty>
RateLimitEnabled=<True if uploads should be rate limited; default to true>
MaxUploadsPerDay=<Max uploads per 24 hours, used if rate limit is enabled;
default to 5>
MaxDatabaseSizeInMb=<Total crash report disk usage greater than this value
will cause older reports to be deleted; default to 20>
MaxDatabaseAgeInDays=<Crash reports older than this value will be deleted;
default to 5>
[CrashKeys]
my_key1=<small|medium|large>
my_key2=<small|medium|large>
Config section:
If "ProductName" and/or "ProductVersion" are set then the specified values
will be included in the crash dump metadata.
If "AppName" is set on Windows then crash report information (metrics,
database and dumps) will be stored locally on disk under the
"C:\Users\[CurrentUser]\AppData\Local\[AppName]\User Data" folder.
If "ExternalHandler" is set on Windows then the specified exe will be
launched as the crashpad-handler instead of re-launching the main process
exe. The value can be an absolute path or a path relative to the main exe
directory.
If "ServerURL" is set then crashes will be uploaded as a multi-part POST
request to the specified URL. Otherwise, reports will only be stored locally
on disk.
If "RateLimitEnabled" is set to true then crash report uploads will be rate
limited as follows:
1. If "MaxUploadsPerDay" is set to a positive value then at most the
specified number of crashes will be uploaded in each 24 hour period.
2. If crash upload fails due to a network or server error then an
incremental backoff delay up to a maximum of 24 hours will be applied for
retries.
3. If a backoff delay is applied and "MaxUploadsPerDay" is > 1 then the
"MaxUploadsPerDay" value will be reduced to 1 until the client is
restarted. This helps to avoid an upload flood when the network or
server error is resolved.
If "MaxDatabaseSizeInMb" is set to a positive value then crash report storage
on disk will be limited to that size in megabytes. For example, on Windows
each dump is about 600KB so a "MaxDatabaseSizeInMb" value of 20 equates to
about 34 crash reports stored on disk.
If "MaxDatabaseAgeInDays" is set to a positive value then crash reports older
than the specified age in days will be deleted.
CrashKeys section:
Any number of crash keys can be specified for use by the application. Crash
key values will be truncated based on the specified size (small = 63 bytes,
medium = 252 bytes, large = 1008 bytes). The value of crash keys can be set
from any thread or process using the Cef.SetCrashKeyValue function. These
key/value pairs will be sent to the crash server along with the crash dump
file. Medium and large values will be chunked for submission. For example,
if your key is named "mykey" then the value will be broken into ordered
chunks and submitted using keys named "mykey-1", "mykey-2", etc.
Returns true if crash reporting is enabled.
Helper function (wrapper around the CefColorSetARGB macro) which combines
the 4 color components into an uint32 for use with BackgroundColor property
Alpha
Red
Green
Blue
Returns the color.
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.
Returns the global request context or null if the RequestContext has not been initialized yet.
Returns true if called on the specified CEF thread.
Returns true if called on the specified thread.
Call during process startup to enable High-DPI support on Windows 7 or newer.
Older versions of Windows should be left DPI-unaware because they do not
support DirectWrite and GDI fonts are kerned very badly.
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().
Returns false on error.
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
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.
Called prior to calling Cef.Shutdown, this diposes of any remaning
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.
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.
If non-NULL it will be executed asnychronously on the CEF UI thread after the manager's storage has been initialized.
A the global cookie manager or null if the RequestContext has not yet been initialized.
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
- Use the GetGlobalCookieManager(ICompletionCallback) overload and 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.
A the global cookie manager or null if the RequestContext has not yet been initialized.
Remove all entries from the cross-origin access whitelist.
Remove all entries from the cross-origin access whitelist. Returns false if
the whitelist cannot be accessed.
Remove entry from cross-origin whitelist
The origin allowed to be accessed by the target protocol/domain.
The target protocol allowed to access the source origin.
The optional target domain allowed to access the source origin.
If set to true would allow a blah.example.com if the
was set to example.com
Remove an entry from the cross-origin access whitelist. Returns false if
is invalid or the whitelist cannot be accessed.
Add an entry to the cross-origin whitelist.
The origin allowed to be accessed by the target protocol/domain.
The target protocol allowed to access the source origin.
The optional target domain allowed to access the source origin.
If set to true would allow a blah.example.com if the
was set to example.com
Returns false if is invalid or the whitelist cannot be accessed.
The same-origin policy restricts how scripts hosted from different origins
(scheme + domain + port) can communicate. By default, scripts can only access
resources with the same origin. Scripts hosted on the HTTP and HTTPS schemes
(but no other schemes) can use the "Access-Control-Allow-Origin" header to
allow cross-origin requests. For example, https://source.example.com can make
XMLHttpRequest requests on http://target.example.com if the
http://target.example.com request returns an "Access-Control-Allow-Origin:
https://source.example.com" response header.
Scripts in separate frames or iframes and hosted from the same protocol and
domain suffix can execute cross-origin JavaScript if both pages set the
document.domain value to the same domain suffix. For example,
scheme://foo.example.com and scheme://bar.example.com can communicate using
JavaScript if both domains set document.domain="example.com".
This method is used to allow access to origins that would otherwise violate
the same-origin policy. Scripts hosted underneath the fully qualified
URL (like http://www.example.com) will be allowed access to
all resources hosted on the specified and .
If is non-empty and if false only
exact domain matches will be allowed. If contains a top-
level domain component (like "example.com") and is
true sub-domain matches will be allowed. If is empty and
if true all domains and IP addresses will be
allowed.
This method cannot be used to bypass the restrictions on local or display
isolated schemes. See the comments on for more
information.
This function may be called on any thread. Returns false if
is invalid or the whitelist cannot be accessed.
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).
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.
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.
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.
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.
CefSharp configuration settings.
Check that all relevant dependencies avaliable, throws exception if any are missing
Implement this interface to provide handler implementations. Null if you don't wish to handle these events
true if successful; otherwise, false.
Initializes CefSharp with user-provided settings.
It's important to note that Initialize/Shutdown MUST be called on your main
applicaiton thread (Typically the UI thead). If you call them on different
threads, your application will hang. See the documentation for Cef.Shutdown() for more details.
CefSharp configuration settings.
Check that all relevant dependencies avaliable, throws exception if any are missing
The handler for functionality specific to the browser process. Null if you don't wish to handle these events
true if successful; otherwise, false.
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.
CefSharp configuration settings.
Check that all relevant dependencies avaliable, throws exception if any are missing
true if successful; otherwise, false.
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.
CefSharp configuration settings.
true if successful; otherwise, false.
Parse the specified url into its component parts.
Uses a GURL to parse the Url. GURL is Google's URL parsing library.
url
Returns null if the URL is empty or invalid.
Gets a value that indicates the Git Hash for CEF version currently being used.
The Git Commit Hash
Gets a value that indicates the Chromium version currently being used.
The Chromium version.
Gets a value that indicates the CEF version currently being used.
The CEF Version
Gets a value that indicates the version of CefSharp currently being used.
The CefSharp version.
Gets a value that indicates whether CefSharp was shutdown.
true if CefSharp was shutdown; otherwise, false.
Gets a value that indicates whether CefSharp is initialized.
true if CefSharp is initialized; otherwise, false.
Global CEF methods are exposed through this class. e.g. CefInitalize maps to Cef.Initialize
CEF API Doc https://magpcss.org/ceforum/apidocs3/projects/(default)/(_globals).html
This class cannot be inherited.
Registers a custom scheme using the provided settings.
The CefCustomScheme which provides the details about the scheme.
GUID string used for identifying the application. This is passed to the system AV function for scanning downloaded files. By
default, the GUID will be an empty string and the file will be treated as an untrusted file when the GUID is empty.
If CookieableSchemesExcludeDefaults is false the
default schemes ("http", "https", "ws" and "wss") will also be supported.
Specifying a CookieableSchemesList value and setting
CookieableSchemesExcludeDefaults to true will disable all loading
and saving of cookies for this manager. Can be overridden
for individual RequestContext instances via the
RequestContextSettings.CookieableSchemesList and
RequestContextSettings.CookieableSchemesExcludeDefaults values.
Comma delimited list of schemes supported by the associated
ICookieManager. If CookieableSchemesExcludeDefaults is false the
default schemes ("http", "https", "ws" and "wss") will also be supported.
Specifying a CookieableSchemesList value and setting
CookieableSchemesExcludeDefaults to true will disable all loading
and saving of cookies for this manager. Can be overridden
for individual RequestContext instances via the
RequestContextSettings.CookieableSchemesList and
RequestContextSettings.CookieableSchemesExcludeDefaults values.
Background color used for the browser before a document is loaded and when no document color is specified. The alpha
component must be either fully opaque (0xFF) or fully transparent (0x00). If the alpha component is fully opaque then the RGB
components will be used as the background color. If the alpha component is fully transparent for a WinForms browser then the
default value of opaque white be used. If the alpha component is fully transparent for a windowless (WPF/OffScreen) browser
then transparent painting will be enabled.
Comma delimited ordered list of language codes without any whitespace that will be used in the "Accept-Language" HTTP header.
May be set globally using the CefSettings.AcceptLanguageList value. If both values are empty then "en-US,en" will be used.
To persist user preferences as a JSON file in the cache path directory set this value to true. A CachePath value must also be
specified to enable this feature. Also configurable using the "persist-user-preferences" command-line switch. Can be
overridden for individual RequestContext instances via the RequestContextSettings.PersistUserPreferences value.
To persist session cookies (cookies without an expiry date or validity interval) by default when using the global cookie
manager set this value to true. Session cookies are generally intended to be transient and most Web browsers do not persist
them. A CachePath value must also be specified to enable this feature. Also configurable using the "persist-session-cookies"
command-line switch. Can be overridden for individual RequestContext instances via the
RequestContextSettings.PersistSessionCookies value.
Set to true (1) to enable windowless (off-screen) rendering support. Do not enable this value if the application does not use
windowless rendering as it may reduce rendering performance on some systems.
Value that will be returned as the User-Agent HTTP header. If empty the default User-Agent string will be used. Also
configurable using the "user-agent" command-line switch.
The number of stack trace frames to capture for uncaught exceptions. Specify a positive value to enable the
CefRenderProcessHandler:: OnUncaughtException() callback. Specify 0 (default value) and OnUncaughtException() will not be
called. Also configurable using the "uncaught-exception-stack-size" command-line switch.
Set to a value between 1024 and 65535 to enable remote debugging on the specified port. For example, if 8080 is specified the
remote debugging URL will be http://localhost:8080. CEF can be remotely debugged from any CEF or Chrome browser window. Also
configurable using the "remote-debugging-port" command-line switch.
Value that will be inserted as the product portion of the default User-Agent string. If empty the Chromium product version
will be used. If UserAgent is specified this value will be ignored. Also configurable using the "user-agent-product" command-
line switch.
Set to true to disable loading of pack files for resources and locales. A resource bundle handler must be provided for the
browser and render processes via CefApp::GetResourceBundleHandler() if loading of pack files is disabled. Also configurable
using the "disable-pack-loading" command- line switch.
Custom flags that will be used when initializing the V8 JavaScript engine. The consequences of using custom flags may not be
well tested. Also configurable using the "js-flags" command-line switch.
The log severity. Only messages of this severity level or higher will be logged. When set to
no messages will be written to the log file, but Fatal messages will still be
output to stderr. Also configurable using the "log-severity" command-line switch with a value of "verbose", "info", "warning",
"error", "fatal", "error-report" or "disable".
The directory and file name to use for the debug log. If empty a default log file name and location will be used. On Windows
a "debug.log" file will be written in the main executable directory. Also configurable using the"log-file" command- line
switch.
The fully qualified path for the resources directory. If this value is empty the cef.pak and/or devtools_resources.pak files
must be located in the module directory. Also configurable using the "resources-dir-path" command-line switch.
The fully qualified path for the locales directory. If this value is empty the locales directory must be located in the
module directory. If this value is non-empty then it must be an absolute path. Also configurable using the "locales-dir-path"
command-line switch.
The locale string that will be passed to WebKit. If empty the default locale of "en-US" will be used. Also configurable using
the "lang" command-line switch.
The location where user data such as the Widevine CDM module and spell checking dictionary files will be stored on disk.
If this value is empty then "Local Settings\Application Data\CEF\User Data" directory under the user profile directory
will be used. If this value is non-empty then it must be an absolute path.
The root directory that all CefSettings.CachePath and RequestContextSettings.CachePath values must have in common. If this
value is empty and CefSettings.CachePath is non-empty then it will default to the CefSettings.CachePath value.
If this value is non-empty then it must be an absolute path. Failure to set this value correctly may result in the sandbox
blocking read/write access to the CachePath directory. NOTE: CefSharp does not implement the CHROMIUM SANDBOX. A non-empty
RootCachePath can be used in conjuncation with an empty CefSettings.CachePath in instances where you would like browsers
attached to the Global RequestContext (the default) created in "incognito mode" and instances created with a custom
RequestContext using a disk based cache.
The location where data for the global browser cache will be stored on disk. In this value is non-empty then it must be
an absolute path that is must be either equal to or a child directory of CefSettings.RootCachePath (if RootCachePath is
empty it will default to this value). If the value is empty then browsers will be created in "incognito mode" where
in-memory caches are used for storage and no data is persisted to disk. HTML5 databases such as localStorage will only
persist across sessions if a cache path is specified. Can be overridden for individual RequestContext instances via the
RequestContextSettings.CachePath value.
The path to a separate executable that will be launched for sub-processes. By default the browser process executable is used.
See the comments on Cef.ExecuteProcess() for details. If this value is non-empty then it must be an absolute path.
Also configurable using the "browser-subprocess-path" command-line switch.
Defaults to using the provided CefSharp.BrowserSubprocess.exe instance
Set to true to have the browser process message loop run in a separate thread. If false than the CefDoMessageLoopWork()
function must be called from your application message loop. This option is only supported on Windows. The default value is
true.
Set to true to control browser process main (UI) thread message pump scheduling via the
IBrowserProcessHandler.OnScheduleMessagePumpWork callback. This option is recommended for use in combination with the
Cef.DoMessageLoopWork() function in cases where the CEF message loop must be integrated into an existing application message
loop (see additional comments and warnings on Cef.DoMessageLoopWork). Enabling this option is not recommended for most users;
leave this option disabled and use either MultiThreadedMessageLoop (the default) if possible.
Set to true to disable configuration of browser process features using standard CEF and Chromium command-line arguments.
Configuration can still be specified using CEF data structures or by adding to CefCommandLineArgs.
**Experimental**
Set to true to enable use of the Chrome runtime in CEF. This feature is
considered experimental and is not recommended for most users at this time.
See issue https://bitbucket.org/chromiumembedded/cef/issues/2969/support-chrome-windows-with-cef-callbacks for details.
Add custom command line argumens to this collection, they will be added in OnBeforeCommandLineProcessing. The
CefSettings.CommandLineArgsDisabled value can be used to start with an empty command-line object. Any values specified in
CefSettings that equate to command-line arguments will be set before this method is called.
Add Customs schemes to this collection.
Destructor.
Finalizer.
Default Constructor.
CefCustomScheme collection
CefSettings unmanaged pointer
Command Line Arguments Dictionary.
Initialization settings. Many of these and other settings can also configured using command-line switches.
WPF/WinForms/OffScreen each have their own CefSettings implementation that sets
relevant settings e.g. OffScreen starts with audio muted.
Constructor.
The popup features.
Class representing popup window features.
Get the image hotspot (drag start location relative to image dimensions).
Get the image representation of drag data.
May return NULL if no image representation is available.
Returns the image width in density independent pixel(DIP) units.
Removes the representation for scaleFactor.
true for success
Returns true if this Image and that Image share the same underlying storage.
image to compare
returns true if share same underlying storage
Returns true if this Image is empty.
Returns true if this image contains a representation for scaleFactor.
Returns the image height in density independent pixel(DIP) units.
Returns information for the representation that most closely matches scaleFactor.
scale factor
actual scale factor
pixel width
pixel height
return if information found for scale factor
Returns the PNG representation that most closely matches scaleFactor.
scale factor
is the PNG transparent
pixel width
pixel height
A stream represending the PNG or null.
Returns the JPEG representation that most closely matches scaleFactor.
scale factor
image quality
pixel width
pixel height
A stream representing the JPEG or null.
Returns the bitmap representation that most closely matches scaleFactor.
scale factor
color type
alpha type
pixel width
pixel height
A stream represending the bitmap or null.
ref
Interface that should be implemented by the CefUrlRequest client.
The methods of this class will be called on the same thread that created
the request unless otherwise documented.
True if dispose should be called after this object is used
Gets a value indicating if the browser settings has been disposed.
The maximum rate in frames per second (fps) that CefRenderHandler::OnPaint
will be called for a windowless browser. The actual fps may be lower if
the browser cannot generate frames at the requested rate. The minimum
value is 1 and the maximum value is 60 (default 30). This value can also be
changed dynamically via IBrowserHost.SetWindowlessFrameRate.
Comma delimited ordered list of language codes without any whitespace that
will be used in the "Accept-Language" HTTP header. May be overridden on a
per-browser basis using the CefBrowserSettings.AcceptLanguageList value.
If both values are empty then "en-US,en" will be used. Can be overridden
for individual RequestContext instances via the
RequestContextSettings.AcceptLanguageList value.
Background color used for the browser before a document is loaded and when no document color
is specified. The alpha component must be either fully opaque (0xFF) or fully transparent (0x00).
If the alpha component is fully opaque then the RGB components will be used as the background
color. If the alpha component is fully transparent for a WinForms browser then the
CefSettings.BackgroundColor value will be used. If the alpha component is fully transparent
for a windowless (WPF/OffScreen) browser then transparent painting will be enabled.
Controls whether WebGL can be used. Note that WebGL requires hardware
support and may not work on all systems even when enabled. Also
configurable using the "disable-webgl" command-line switch.
Controls whether databases can be used. Also configurable using the
"disable-databases" command-line switch.
Controls whether local storage can be used. Also configurable using the
"disable-local-storage" command-line switch.
Controls whether the tab key can advance focus to links. Also configurable
using the "disable-tab-to-links" command-line switch.
Controls whether text areas can be resized. Also configurable using the
"disable-text-area-resize" command-line switch.
Controls whether standalone images will be shrunk to fit the page. Also
configurable using the "image-shrink-standalone-to-fit" command-line
switch.
Controls whether image URLs will be loaded from the network. A cached image
will still be rendered if requested. Also configurable using the
"disable-image-loading" command-line switch.
Controls whether DOM pasting is supported in the editor via
execCommand("paste"). The |javascript_access_clipboard| setting must also
be enabled. Also configurable using the "disable-javascript-dom-paste"
command-line switch.
Controls whether JavaScript can access the clipboard. Also configurable
using the "disable-javascript-access-clipboard" command-line switch.
Controls whether JavaScript can be used to close windows that were not
opened via JavaScript. JavaScript can still be used to close windows that
were opened via JavaScript. Also configurable using the
"disable-javascript-close-windows" command-line switch.
Controls whether JavaScript can be executed. (Used to Enable/Disable javascript)
Also configurable using the "disable-javascript" command-line switch.
Controls the loading of fonts from remote sources. Also configurable using
the "disable-remote-fonts" command-line switch.
Default encoding for Web content. If empty "ISO-8859-1" will be used. Also
configurable using the "default-encoding" command-line switch.
MinimumLogicalFontSize
MinimumFontSize
DefaultFixedFontSize
DefaultFontSize
FantasyFontFamily
CursiveFontFamily
SansSerifFontFamily
SerifFontFamily
FixedFontFamily
StandardFontFamily
Destructor.
Finalizer.
Default Constructor
Internal Constructor
Browser initialization settings. Specify NULL or 0 to get the recommended
default values. The consequences of using custom values may not be well
tested. Many of these and other settings can also configured using command-
line switches.
Load the request represented by the |request| object.
Gets the inner most instance
current instance
Load an extension. If extension resources will be read from disk using the default load implementation then rootDirectoy
should be the absolute path to the extension resources directory and manifestJson should be null.
If extension resources will be provided by the client (e.g. via IRequestHandler and/or IExtensionHandler) then rootDirectory
should be a path component unique to the extension (if not absolute this will be internally prefixed with the PK_DIR_RESOURCES path)
and manifestJson should contain the contents that would otherwise be read from the "manifest.json" file on disk.
The loaded extension will be accessible in all contexts sharing the same storage (HasExtension returns true).
However, only the context on which this method was called is considered the loader (DidLoadExtension returns true) and only the
loader will receive IRequestContextHandler callbacks for the extension. will be
called on load success or will be called on load failure.
If the extension specifies a background script via the "background" manifest key then
will be called to create the background browser. See that method for additional information about background scripts.
For visible extension views the client application should evaluate the manifest to determine the correct extension URL to load and then pass
that URL to the IBrowserHost.CreateBrowser* function after the extension has loaded. For example, the client can look for the "browser_action"
manifest key as documented at https://developer.chrome.com/extensions/browserAction. Extension URLs take the form "chrome-extension:///".
Browsers that host extensions differ from normal browsers as follows: - Can access chrome.* JavaScript APIs if allowed by the manifest.
Visit chrome://extensions-support for the list of extension APIs currently supported by CEF. - Main frame navigation to non-extension
content is blocked.
- Pinch-zooming is disabled.
- returns the hosted extension.
- CefBrowserHost::IsBackgroundHost returns true for background hosts. See https://developer.chrome.com/extensions for extension implementation and usage documentation.
If extension resources will be read from disk using the default load implementation then rootDirectoy
should be the absolute path to the extension resources directory and manifestJson should be null
If extension resources will be provided by the client then rootDirectory should be a path component unique to the extension
and manifestJson should contain the contents that would otherwise be read from the manifest.json file on disk
handle events related to browser extensions
Returns true if this context has access to the extension identified by extensionId.
This may not be the context that was used to load the extension (see DidLoadExtension).
This method must be called on the CEF UI thread.
extension id
Returns true if this context has access to the extension identified by extensionId
Use Cef.UIThreadTaskFactory to execute this method if required,
and ChromiumWebBrowser.IsBrowserInitializedChanged are both
executed on the CEF UI thread, so can be called directly.
When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
application thread will be the CEF UI thread.
Retrieve the list of all extensions that this context has access to (see HasExtension).
will be populated with the list of extension ID values.
This method must be called on the CEF UI thread.
output a list of extensions Ids
returns true on success otherwise false
Use Cef.UIThreadTaskFactory to execute this method if required,
and ChromiumWebBrowser.IsBrowserInitializedChanged are both
executed on the CEF UI thread, so can be called directly.
When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
application thread will be the CEF UI thread.
Returns the extension matching extensionId or null if no matching extension is accessible in this context (see HasExtension).
This method must be called on the CEF UI thread.
extension Id
Returns the extension matching extensionId or null if no matching extension is accessible in this context
Use Cef.UIThreadTaskFactory to execute this method if required,
and ChromiumWebBrowser.IsBrowserInitializedChanged are both
executed on the CEF UI thread, so can be called directly.
When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
application thread will be the CEF UI thread.
Returns true if this context was used to load the extension identified by extensionId. Other contexts sharing the same storage will also have access to the extension (see HasExtension).
This method must be called on the CEF UI thread.
Returns true if this context was used to load the extension identified by extensionId
Use Cef.UIThreadTaskFactory to execute this method if required,
and ChromiumWebBrowser.IsBrowserInitializedChanged are both
executed on the CEF UI thread, so can be called directly.
When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
application thread will be the CEF UI thread.
Attempts to resolve origin to a list of associated IP addresses.
host name to resolve
A task that represents the Resoolve Host operation. The value of the TResult parameter contains ResolveCallbackResult.
Clears all active and idle connections that Chromium currently has.
This is only recommended if you have released all other CEF objects but
don't yet want to call Cef.Shutdown().
If is non-NULL it will be executed on the CEF UI thread after
completion. This param is optional
Clears all HTTP authentication credentials that were added as part of handling
.
If is non-NULL it will be executed on the CEF UI thread after
completion. This param is optional
Clears all certificate exceptions that were added as part of handling
. If you call this it is
recommended that you also call or you risk not
being prompted again for server certificates if you reconnect quickly.
If is non-NULL it will be executed on the CEF UI thread after
completion. This param is optional
Set the value associated with preference name. If value is null the
preference will be restored to its default value. If setting the preference
fails then error will be populated with a detailed description of the
problem. This method must be called on the CEF UI thread.
Preferences set via the command-line usually cannot be modified.
preference key
preference value
out error
Returns true if the value is set successfully and false otherwise.
Use Cef.UIThreadTaskFactory to execute this method if required,
and ChromiumWebBrowser.IsBrowserInitializedChanged are both
executed on the CEF UI thread, so can be called directly.
When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
application thread will be the CEF UI thread.
Returns true if the preference with the specified name can be modified
using SetPreference. As one example preferences set via the command-line
usually cannot be modified. This method must be called on the CEF UI thread.
preference key
Returns true if the preference with the specified name can be modified
using SetPreference
Use Cef.UIThreadTaskFactory to execute this method if required,
and ChromiumWebBrowser.IsBrowserInitializedChanged are both
executed on the CEF UI thread, so can be called directly.
When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
application thread will be the CEF UI thread.
Returns all preferences as a dictionary. The returned
object contains a copy of the underlying preference values and
modifications to the returned object will not modify the underlying
preference values. This method must be called on the browser process UI
thread.
If true then
preferences currently at their default value will be included.
Preferences (dictionary can have sub dictionaries)
Returns the value for the preference with the specified name. Returns
NULL if the preference does not exist. The returned object contains a copy
of the underlying preference value and modifications to the returned object
will not modify the underlying preference value. This method must be called
on the CEF UI thread.
preference name
Returns the value for the preference with the specified name
Use Cef.UIThreadTaskFactory to execute this method if required,
and ChromiumWebBrowser.IsBrowserInitializedChanged are both
executed on the CEF UI thread, so can be called directly.
When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
application thread will be the CEF UI thread.
Returns true if a preference with the specified name exists. This method
must be called on the CEF UI thread.
name of preference
bool if the preference exists
Use Cef.UIThreadTaskFactory to execute this method if required,
and ChromiumWebBrowser.IsBrowserInitializedChanged are both
executed on the CEF UI thread, so can be called directly.
When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
application thread will be the CEF UI thread.
Returns the cache path for this object. If empty an "incognito mode"
in-memory cache is being used.
Clear all registered scheme handler factories.
Returns false on error.
Register a scheme handler factory for the specified schemeName and optional domainName.
An empty domainName value for a standard scheme will cause the factory to match all domain
names. The domainName value will be ignored for non-standard schemes. If schemeName is
a built-in scheme and no handler is returned by factory then the built-in scheme handler
factory will be called. If schemeName is a custom scheme then you must also implement the
IApp.OnRegisterCustomSchemes() method in all processes. This function may be called multiple
times to change or remove the factory that matches the specified schemeName and optional
domainName.
Scheme Name
Optional domain name
Scheme handler factory
Returns false if an error occurs.
Returns true if this object is the global context. The global context is
used by default when creating a browser or URL request with a NULL context
argument.
Returns the default cookie manager for this object. This will be the global
cookie manager if this object is the global request context.
If callback is non-NULL it will be executed asnychronously on the CEF IO thread
after the manager's storage has been initialized.
Returns the default cookie manager for this object
Returns true if this object is sharing the same storage as the specified context.
context to compare
Returns true if same storage
Returns true if this object is pointing to the same context object.
context to compare
Returns true if the same
Creates a new context object that shares storage with other and uses an
optional handler.
shares storage with this RequestContext
optional requestContext handler
Returns a new RequestContext
Creates a new context object that shares storage with | other | and uses an optional | handler | .
A request context provides request handling for a set of related browser objects.
A request context is specified when creating a new browser object via the CefBrowserHost
static factory methods. Browser objects with different request contexts will never be
hosted in the same render process. Browser objects with the same request context may or
may not be hosted in the same render process depending on the process model.
Browser objects created indirectly via the JavaScript window.open function or targeted
links will share the same render process and the same request context as the source browser.
When running in single-process mode there is only a single render process (the main process)
and so all browsers created in single-process mode will share the same request context.
This will be the first request context passed into a CefBrowserHost static factory method
and all other request context objects will be ignored.
If CookieableSchemesExcludeDefaults is false the
default schemes ("http", "https", "ws" and "wss") will also be supported.
Specifying a CookieableSchemesList value and setting
CookieableSchemesExcludeDefaults to true will disable all loading
and saving of cookies for this manager. This value will be ignored if
matches the value.
Comma delimited list of schemes supported by the associated
ICookieManager. If CookieableSchemesExcludeDefaults is false the
default schemes ("http", "https", "ws" and "wss") will also be supported.
Specifying a CookieableSchemesList value and setting
CookieableSchemesExcludeDefaults to true will disable all loading
and saving of cookies for this manager. This value will be ignored if
matches the value.
Comma delimited ordered list of language codes without any whitespace that
will be used in the "Accept-Language" HTTP header. Can be set globally
using the CefSettings.accept_language_list value or overridden on a per-
browser basis using the BrowserSettings.AcceptLanguageList value. If
all values are empty then "en-US,en" will be used. This value will be
ignored if CachePath matches the CefSettings.CachePath value.
The location where cache data for this request context will be stored on
disk. If this value is non-empty then it must be an absolute path that is
either equal to or a child directory of CefSettings.RootCachePath.
If the value is empty then browsers will be created in "incognito mode"
where in-memory caches are used for storage and no data is persisted to disk.
HTML5 databases such as localStorage will only persist across sessions if a
cache path is specified. To share the global browser cache and related
configuration set this value to match the CefSettings.CachePath value.
To persist user preferences as a JSON file in the cache path directory set
this value to true. Can be set globally using the
CefSettings.PersistUserPreferences value. This value will be ignored if
CachePath is empty or if it matches the CefSettings.CachePath value.
To persist session cookies (cookies without an expiry date or validity
interval) by default when using the global cookie manager set this value to
true. Session cookies are generally intended to be transient and most
Web browsers do not persist them. Can be set globally using the
CefSettings.PersistSessionCookies value. This value will be ignored if
CachePath is empty or if it matches the CefSettings.CachePath value.
Initializes a new instance of the RequestContextSettings class.
RequestContextSettings