[This is preliminary documentation and is subject to change.]
The CefRuntime type exposes the following members.Methods
Name | Description | |
---|---|---|
AddCrossOriginWhitelistEntry |
Add an entry to the cross-origin access whitelist.
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
|source_origin| URL (like http://www.example.com) will be allowed access to
all resources hosted on the specified |target_protocol| and |target_domain|.
If |target_domain| is non-empty and |allow_target_subdomains| if false only
exact domain matches will be allowed. If |target_domain| contains a top-
level domain component (like "example.com") and |allow_target_subdomains| is
true sub-domain matches will be allowed. If |target_domain| is empty and
|allow_target_subdomains| 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 CefRegisterCustomScheme for more
information.
This function may be called on any thread. Returns false if |source_origin|
is invalid or the whitelist cannot be accessed.
| |
AddWebPluginDirectory |
Add a plugin directory. This change may not take affect until after
CefRefreshWebPlugins() is called. Can be called on any thread in the browser
process.
| |
AddWebPluginPath |
Add a plugin path (directory + file). This change may not take affect until
after CefRefreshWebPlugins() is called. Can be called on any thread in the
browser process.
| |
ClearCrossOriginWhitelist |
Remove all entries from the cross-origin access whitelist. Returns false if
the whitelist cannot be accessed.
| |
ClearSchemeHandlerFactories |
Clear all registered scheme handler factories. Returns false on error. This
function may be called on any thread in the browser process.
| |
CurrentlyOn |
CEF maintains multiple internal threads that are used for handling different
types of tasks in different processes. See the cef_thread_id_t definitions in
cef_types.h for more information. This function will return true if called on
the specified thread. It is an error to request a thread from the wrong
process.
| |
DoMessageLoopWork |
Perform a single iteration of CEF message loop processing. This function is
used to integrate the CEF message loop into an existing application message
loop. Care must be taken to balance performance against excessive CPU usage.
This function should only be called on the main application thread and only
if CefInitialize() is called with a CefSettings.multi_threaded_message_loop
value of false. This function will not block.
| |
ExecuteProcess(CefMainArgs, CefApp) | Obsolete. | |
ExecuteProcess(CefMainArgs, CefApp, IntPtr) |
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).
| |
ForceWebPluginShutdown |
Force a plugin to shutdown. Can be called on any thread in the browser
process but will be executed on the IO thread.
| |
GetGeolocation |
Request a one-time geolocation update. This function bypasses any user
permission checks so should only be used by code that is allowed to access
location information.
| |
GetPath |
Retrieve the path associated with the specified |key|. Returns true on
success. Can be called on any thread in the browser process.
| |
Initialize(CefMainArgs, CefSettings, CefApp) | Obsolete. | |
Initialize(CefMainArgs, CefSettings, CefApp, IntPtr) |
This function should be called on the main application thread to initialize
the CEF browser process. The |application| parameter may be empty. A return
value of true indicates that it succeeded and false indicates that it failed.
The |windows_sandbox_info| parameter is only used on Windows and may be NULL
(see cef_sandbox_win.h for details).
| |
IsWebPluginUnstable |
Query if a plugin is unstable. Can be called on any thread in the browser
process.
| |
LaunchProcess |
Launches the process specified via |command_line|. Returns true upon
success. Must be called on the browser process TID_PROCESS_LAUNCHER thread.
Unix-specific notes:
- All file descriptors open in the parent process will be closed in the
child process except for stdin, stdout, and stderr.
- If the first argument on the command line does not contain a slash,
PATH will be searched. (See man execvp.)
| |
Load |
Loads CEF runtime.
| |
Load(String) |
Loads CEF runtime from specified path.
| |
PostTask(CefThreadId, CefTask) |
Post a task for execution on the specified thread. This function may be
called on any thread. It is an error to request a thread from the wrong
process.
| |
PostTask(CefThreadId, CefTask, Int64) |
Post a task for delayed execution on the specified thread. This function may
be called on any thread. It is an error to request a thread from the wrong
process.
| |
QuitMessageLoop |
Quit the CEF message loop that was started by calling CefRunMessageLoop().
This function should only be called on the main application thread and only
if CefRunMessageLoop() was used.
| |
RefreshWebPlugins |
Cause the plugin list to refresh the next time it is accessed regardless
of whether it has already been loaded. Can be called on any thread in the
browser process.
| |
RegisterExtension |
Register a new V8 extension with the specified JavaScript extension code and
handler. Functions implemented by the handler are prototyped using the
keyword 'native'. The calling of a native function is restricted to the scope
in which the prototype of the native function is defined. This function may
only be called on the render process main thread.
Example JavaScript extension code:
// create the 'example' global object if it doesn't already exist. if (!example) example = {}; // create the 'example.test' global object if it doesn't already exist. if (!example.test) example.test = {}; (function() { // Define the function 'example.test.myfunction'. example.test.myfunction = function() { // Call CefV8Handler::Execute() with the function name 'MyFunction' // and no arguments. native function MyFunction(); return MyFunction(); }; // Define the getter function for parameter 'example.test.myparam'. example.test.__defineGetter__('myparam', function() { // Call CefV8Handler::Execute() with the function name 'GetMyParam' // and no arguments. native function GetMyParam(); return GetMyParam(); }); // Define the setter function for parameter 'example.test.myparam'. example.test.__defineSetter__('myparam', function(b) { // Call CefV8Handler::Execute() with the function name 'SetMyParam' // and a single argument. native function SetMyParam(); if(b) SetMyParam(b); }); // Extension definitions can also contain normal JavaScript variables // and functions. var myint = 0; example.test.increment = function() { myint += 1; return myint; }; })(); // Call the function. example.test.myfunction(); // Set the parameter. example.test.myparam = value; // Get the parameter. value = example.test.myparam; // Call another function. example.test.increment(); | |
RegisterSchemeHandlerFactory |
Register a scheme handler factory for the specified |scheme_name| and
optional |domain_name|. An empty |domain_name| value for a standard scheme
will cause the factory to match all domain names. The |domain_name| value
will be ignored for non-standard schemes. If |scheme_name| is a built-in
scheme and no handler is returned by |factory| then the built-in scheme
handler factory will be called. If |scheme_name| is a custom scheme then
also implement the CefApp::OnRegisterCustomSchemes() method in all processes.
This function may be called multiple times to change or remove the factory
that matches the specified |scheme_name| and optional |domain_name|.
Returns false if an error occurs. This function may be called on any thread
in the browser process.
| |
RegisterWebPluginCrash |
Register a plugin crash. Can be called on any thread in the browser process
but will be executed on the IO thread.
| |
RemoveCrossOriginWhitelistEntry |
Remove an entry from the cross-origin access whitelist. Returns false if
|source_origin| is invalid or the whitelist cannot be accessed.
| |
RemoveWebPluginPath |
Remove a plugin path (directory + file). This change may not take affect
until after CefRefreshWebPlugins() is called. Can be called on any thread in
the browser process.
| |
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 CefInitialize() is called with a
CefSettings.multi_threaded_message_loop value of false. This function will
block until a quit message is received by the system.
| |
SetOSModalLoop |
Set to true before calling Windows APIs like TrackPopupMenu that enter a
modal message loop. Set to false after exiting the modal message loop.
| |
Shutdown |
This function should be called on the main application thread to shut down
the CEF browser process before the application exits.
| |
UnregisterInternalWebPlugin |
Unregister an internal plugin. This may be undone the next time
CefRefreshWebPlugins() is called. Can be called on any thread in the browser
process.
| |
VisitWebPluginInfo |
Visit web plugin information. Can be called on any thread in the browser
process.
|
See Also