/// <param name="performDependencyCheck">Check that all relevant dependencies available, throws exception if any are missing</param>
/// <param name="browserProcessHandler">The handler for functionality specific to the browser process. Null if you don't wish to handle these events</param>
/// <returns>true if successful; otherwise, false.</returns>
/// <param name="browserProcessHandler">The handler for functionality specific to the browser process. Null if you don't wish to handle these events</param>
/// 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.
/// </summary>
publicstaticvoidRunMessageLoop()
{
Core.Cef.RunMessageLoop();
}
/// <summary>
/// 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.
/// </summary>
publicstaticvoidQuitMessageLoop()
{
Core.Cef.QuitMessageLoop();
}
/// <summary>
/// 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.
/// </summary>
publicstaticvoidDoMessageLoopWork()
{
Core.Cef.DoMessageLoopWork();
}
/// <summary>
/// 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).
/// </summary>
publicstaticintExecuteProcess()
{
returnCore.Cef.ExecuteProcess();
}
/// <summary>Add an entry to the cross-origin whitelist.</summary>
/// <param name="sourceOrigin">The origin allowed to be accessed by the target protocol/domain.</param>
/// <param name="targetProtocol">The target protocol allowed to access the source origin.</param>
/// <param name="targetDomain">The optional target domain allowed to access the source origin.</param>
/// <param name="allowTargetSubdomains">If set to true would allow a blah.example.com if the
/// <paramref name="targetDomain"/> was set to example.com
/// </param>
/// <returns>Returns false if is invalid or the whitelist cannot be accessed.</returns>
/// <remarks>
/// 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
/// <paramref name="sourceOrigin"/> URL (like http://www.example.com) will be allowed access to
/// all resources hosted on the specified <paramref name="targetProtocol"/> and <paramref name="targetDomain"/>.
/// If <paramref name="targetDomain"/> is non-empty and <paramref name="allowTargetSubdomains"/> if false only
/// exact domain matches will be allowed. If <paramref name="targetDomain"/> contains a top-
/// level domain component (like "example.com") and <paramref name="allowTargetSubdomains"/> is
/// true sub-domain matches will be allowed. If <paramref name="targetDomain"/> is empty and
/// <paramref name="allowTargetSubdomains"/> 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 <see cref="CefCustomScheme"/> for more
/// information.
///
/// This function may be called on any thread. Returns false if <paramref name="sourceOrigin"/>
/// is invalid or the whitelist cannot be accessed.
/// </remarks>
publicstaticboolAddCrossOriginWhitelistEntry(
stringsourceOrigin,
stringtargetProtocol,
stringtargetDomain,
boolallowTargetSubdomains)
{
returnCore.Cef.AddCrossOriginWhitelistEntry(
sourceOrigin,
targetProtocol,
targetDomain,
allowTargetSubdomains);
}
/// <summary>Remove entry from cross-origin whitelist</summary>
/// <param name="sourceOrigin">The origin allowed to be accessed by the target protocol/domain.</param>
/// <param name="targetProtocol">The target protocol allowed to access the source origin.</param>
/// <param name="targetDomain">The optional target domain allowed to access the source origin.</param>
/// <param name="allowTargetSubdomains">If set to true would allow a blah.example.com if the
/// <paramref name="targetDomain"/> was set to example.com
/// </param>
/// <remarks>
/// Remove an entry from the cross-origin access whitelist. Returns false if
/// <paramref name="sourceOrigin"/> is invalid or the whitelist cannot be accessed.
/// <summary>Remove all entries from the cross-origin access whitelist.</summary>
/// <remarks>
/// Remove all entries from the cross-origin access whitelist. Returns false if
/// the whitelist cannot be accessed.
/// </remarks>
publicstaticboolClearCrossOriginWhitelist()
{
returnCore.Cef.ClearCrossOriginWhitelist();
}
/// <summary>
/// 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.
/// </summary>
/// <param name="callback">If non-NULL it will be executed asynchronously on the CEF UI thread after the manager's storage has been initialized.</param>
/// <returns>A the global cookie manager or null if the RequestContext has not yet been initialized.</returns>