Click or drag to resize
CfxRequestHandler Class

[This is preliminary documentation and is subject to change.]

Implement this structure to handle events related to browser requests. The functions of this structure will be called on the thread indicated.
Inheritance Hierarchy
SystemObject
  ChromiumCfxObject
    ChromiumCfxBase
      ChromiumCfxClientBase
        ChromiumCfxRequestHandler

Namespace: Chromium
Assembly: ChromiumFX (in ChromiumFX.dll)
Syntax
public class CfxRequestHandler : CfxClientBase

The CfxRequestHandler type exposes the following members.

Constructors
  NameDescription
Public methodCfxRequestHandler
Initializes a new instance of the CfxRequestHandler class
Top
Properties
  NameDescription
Public propertyCallbacksDisabled
When true, all CEF callback events are disabled for this handler. Incoming callbacks will return default values to CEF.
(Inherited from CfxClientBase.)
Public propertyNativePtr
Provides access to the underlying native cef struct. This is a refcounted client struct derived from cef_base_t. Add a ref in order to keep it alive when this managed object go out of scope.
(Inherited from CfxClientBase.)
Top
Events
  NameDescription
Public eventGetAuthCredentials
Called on the IO thread when the browser needs credentials from the user. |IsProxy| indicates whether the host is a proxy server. |Host| contains the hostname and |Port| contains the port number. |Realm| is the realm of the challenge and may be NULL. |Scheme| is the authentication scheme used, such as "basic" or "digest", and will be NULL if the source of the request is an FTP server. Return true (1) to continue the request and call CfxAuthCallback.Continue() either in this function or at a later time when the authentication information is available. Return false (0) to cancel the request immediately.
Public eventGetResourceHandler
Called on the IO thread before a resource is loaded. To allow the resource to load normally return NULL. To specify a handler for the resource return a CfxResourceHandler object. The |Request| object should not be modified in this callback.
Public eventGetResourceResponseFilter
Called on the IO thread to optionally filter resource response content. |Request| and |Response| represent the request and response respectively and cannot be modified in this callback.
Public eventOnBeforeBrowse
Called on the UI thread before browser navigation. Return true (1) to cancel the navigation or false (0) to allow the navigation to proceed. The |Request| object cannot be modified in this callback. CfxLoadHandler.OnLoadingStateChange will be called twice in all cases. If the navigation is allowed CfxLoadHandler.OnLoadStart and CfxLoadHandler.OnLoadEnd will be called. If the navigation is canceled CfxLoadHandler.OnLoadError will be called with an |ErrorCode| value of ERR_ABORTED.
Public eventOnBeforeResourceLoad
Called on the IO thread before a resource request is loaded. The |Request| object may be modified. Return RV_CONTINUE to continue the request immediately. Return RV_CONTINUE_ASYNC and call CfxRequestCallback:: cont() at a later time to continue or cancel the request asynchronously. Return RV_CANCEL to cancel the request immediately.
Public eventOnCertificateError
Called on the UI thread to handle requests for URLs with an invalid SSL certificate. Return true (1) and call CfxRequestCallback.Continue() either in this function or at a later time to continue or cancel the request. Return false (0) to cancel the request immediately. If CfxSettings.IgnoreCertificateErrors is set all invalid certificates will be accepted without calling this function.
Public eventOnOpenUrlfromTab
Called on the UI thread before OnBeforeBrowse in certain limited cases where navigating a new or different browser might be desirable. This includes user-initiated navigation that might open in a special way (e.g. links clicked via middle-click or ctrl + left-click) and certain types of cross-origin navigation initiated from the renderer process (e.g. navigating the top-level frame to/from a file URL). The |Browser| and |Frame| values represent the source of the navigation. The |TargetDisposition| value indicates where the user intended to navigate the browser based on standard Chromium behaviors (e.g. current tab, new tab, etc). The |UserGesture| value will be true (1) if the browser navigated via explicit user gesture (e.g. clicking a link) or false (0) if it navigated automatically (e.g. via the DomContentLoaded event). Return true (1) to cancel the navigation or false (0) to allow the navigation to proceed in the source browser's top-level frame.
Public eventOnPluginCrashed
Called on the browser process UI thread when a plugin has crashed. |PluginPath| is the path of the plugin that crashed.
Public eventOnProtocolExecution
Called on the UI thread to handle requests for URLs with an unknown protocol component. Set |AllowOsExecution| to true (1) to attempt execution via the registered OS protocol handler, if any. SECURITY WARNING: YOU SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED ON SCHEME, HOST OR OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION.
Public eventOnQuotaRequest
Called on the IO thread when JavaScript requests a specific storage quota size via the webkitStorageInfo.requestQuota function. |OriginUrl| is the origin of the page making the request. |NewSize| is the requested quota size in bytes. Return true (1) to continue the request and call CfxRequestCallback.Continue() either in this function or at a later time to grant or deny the request. Return false (0) to cancel the request immediately.
Public eventOnRenderProcessTerminated
Called on the browser process UI thread when the render process terminates unexpectedly. |Status| indicates how the process terminated.
Public eventOnRenderViewReady
Called on the browser process UI thread when the render view associated with |Browser| is ready to receive/handle IPC messages in the render process.
Public eventOnResourceLoadComplete
Called on the IO thread when a resource load has completed. |Request| and |Response| represent the request and response respectively and cannot be modified in this callback. |Status| indicates the load completion status. |ReceivedContentLength| is the number of response bytes actually read.
Public eventOnResourceRedirect
Called on the IO thread when a resource load is redirected. The |Request| parameter will contain the old URL and other request-related information. The |Response| parameter will contain the response that resulted in the redirect. The |NewUrl| parameter will contain the new URL and can be changed if desired. The |Request| object cannot be modified in this callback.
Public eventOnResourceResponse
Called on the IO thread when a resource response is received. To allow the resource to load normally return false (0). To redirect or retry the resource modify |Request| (url, headers or post body) and return true (1). The |Response| object cannot be modified in this callback.
Public eventOnSelectClientCertificate
Called on the UI thread when a client certificate is being requested for authentication. Return false (0) to use the default behavior and automatically select the first certificate available. Return true (1) and call CfxSelectClientCertificateCallback.Select either in this function or at a later time to select a certificate. Do not call Select or call it with NULL to continue without using any certificate. |IsProxy| indicates whether the host is an HTTPS proxy or the origin server. |Host| and |Port| contains the hostname and port of the SSL server. |Certificates| is the list of certificates to choose from; this list has already been pruned by Chromium so that it only contains certificates from issuers that the server trusts.
Top
Remarks
See also the original CEF documentation in cef/include/capi/cef_request_handler_capi.h.
See Also