# Interface ICefRequestHandler

Description
Hierarchy
Fields
Methods
Properties

## Unit

uCEFInterfaces

## Declaration

`type ICefRequestHandler = interface(ICefBaseRefCounted)`

## Description

Implement this interface to handle events related to browser requests. The functions of this interface will be called on the thread indicated.

UNKNOWN

<see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_request_handler_capi.h">CEF source file: /include/capi/cef_request_handler_capi.h (cef_request_handler_t))

## Hierarchy

- IInterface
- ICefBaseRefCounted
- ICefRequestHandler

## Overview

### Methods

| `function OnBeforeBrowse(const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; user_gesture, isRedirect: Boolean): Boolean;`
| `function OnOpenUrlFromTab(const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean): Boolean;`
| `procedure GetResourceRequestHandler(const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; is_navigation, is_download: boolean; const request_initiator: ustring; var disable_default_handling: boolean; var aResourceRequestHandler : ICefResourceRequestHandler);`
| `function GetAuthCredentials(const browser: ICefBrowser; const originUrl: ustring; isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; const callback: ICefAuthCallback): Boolean;`
| `function OnCertificateError(const browser: ICefBrowser; certError: TCefErrorcode; const requestUrl: ustring; const sslInfo: ICefSslInfo; const callback: ICefCallback): Boolean;`
| `function OnSelectClientCertificate(const browser: ICefBrowser; isProxy: boolean; const host: ustring; port: integer; certificatesCount: NativeUInt; const certificates: TCefX509CertificateArray; const callback: ICefSelectClientCertificateCallback): boolean;`
| `procedure OnRenderViewReady(const browser: ICefBrowser);`
| `function OnRenderProcessUnresponsive(const browser: ICefBrowser; const callback: ICefUnresponsiveProcessCallback): boolean;`
| `procedure OnRenderProcessResponsive(const browser: ICefBrowser);`
| `procedure OnRenderProcessTerminated(const browser: ICefBrowser; status: TCefTerminationStatus; error_code: integer; const error_string: ustring);`
| `procedure OnDocumentAvailableInMainFrame(const browser: ICefBrowser);`
| `procedure RemoveReferences;`

## Description

### Methods

| `function OnBeforeBrowse(const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; user_gesture, isRedirect: Boolean): Boolean;`

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. ICefLoadHandler.OnLoadingStateChange will be called twice in all cases. If the navigation is allowed ICefLoadHandler.OnLoadStart and ICefLoadHandler.OnLoadEnd will be called. If the navigation is canceled ICefLoadHandler.OnLoadError will be called with an |errorCode| value of ERR_ABORTED. The |user_gesture| 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).

###### Attributes

GUID['{050877A9-D1F8-4EB3-B58E-50DC3E3D39FD}']

| `function OnOpenUrlFromTab(const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean): Boolean;`

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 |target_disposition| value indicates where the user intended to navigate the browser based on standard Chromium behaviors (e.g. current tab, new tab, etc). The |user_gesture| 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.

| `procedure GetResourceRequestHandler(const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; is_navigation, is_download: boolean; const request_initiator: ustring; var disable_default_handling: boolean; var aResourceRequestHandler : ICefResourceRequestHandler);`

Called on the browser process IO thread before a resource request is initiated. The |browser| and |frame| values represent the source of the request. |request| represents the request contents and cannot be modified in this callback. |is_navigation| will be true (1) if the resource request is a navigation. |is_download| will be true (1) if the resource request is a download. |request_initiator| is the origin (scheme + domain) of the page that initiated the request. Set |disable_default_handling| to true (1) to disable default handling of the request, in which case it will need to be handled via ICefResourceRequestHandler.GetResourceHandler or it will be canceled. To allow the resource load to proceed with default handling return NULL. To specify a handler for the resource return a ICefResourceRequestHandler object. If this callback returns NULL the same function will be called on the associated ICefRequestContextHandler, if any.

| `function GetAuthCredentials(const browser: ICefBrowser; const originUrl: ustring; isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; const callback: ICefAuthCallback): Boolean;`

Called on the IO thread when the browser needs credentials from the user. |origin_url| is the origin making this authentication request. |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 ICefAuthCallback.cont() either in this function or at a later time when the authentication information is available. Return false (0) to cancel the request immediately.

| `function OnCertificateError(const browser: ICefBrowser; certError: TCefErrorcode; const requestUrl: ustring; const sslInfo: ICefSslInfo; const callback: ICefCallback): Boolean;`
Called on the UI thread to handle requests for URLs with an invalid SSL certificate. Return true (1) and call ICefCallback functions either in this function or at a later time to continue or cancel the request. Return false (0) to cancel the request immediately. If TCefSettings.ignore_certificate_errors is set all invalid certificates will be accepted without calling this function.

| `function OnSelectClientCertificate(const browser: ICefBrowser; isProxy: boolean; const host: ustring; port: integer; certificatesCount: NativeUInt; const certificates: TCefX509CertificateArray; const callback: ICefSelectClientCertificateCallback): boolean;`

Called on the UI thread when a client certificate is being requested for authentication. Return false (0) to use the default behavior. If the |certificates| list is not NULL the default behavior will be to display a dialog for certificate selection. If the |certificates| list is NULL then the default behavior will be not to show a dialog and it will continue without using any certificate. Return true (1) and call ICefSelectClientCertificateCallback.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.

| `procedure OnRenderViewReady(const browser: ICefBrowser);`
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.

| `function OnRenderProcessUnresponsive(const browser: ICefBrowser; const callback: ICefUnresponsiveProcessCallback): boolean;`

Called on the browser process UI thread when the render process is unresponsive as indicated by a lack of input event processing for at least 15 seconds. Return false (0) for the default behavior which is to continue waiting with Alloy style or display of the "Page unresponsive" dialog with Chrome style. Return true (1) and don't execute the callback to continue waiting without display of the Chrome style dialog. Return true (1) and call ICefUnresponsiveProcessCallback.Wait either in this function or at a later time to reset the wait timer. In cases where you continue waiting there may be another call to this function if the process remains unresponsive. Return true (1) and call ICefUnresponsiveProcessCallback.Terminate either in this function or at a later time to terminate the unresponsive process, resulting in a call to OnRenderProcessTerminated. OnRenderProcessResponsive will be called if the process becomes responsive after this function is called. This functionality depends on the hang monitor which can be disabled by passing the `–disable-hang-monitor` command-line flag.

| `procedure OnRenderProcessResponsive(const browser: ICefBrowser);`
Called on the browser process UI thread when the render process becomes responsive after previously being unresponsive. See documentation on OnRenderProcessUnresponsive.

| `procedure OnRenderProcessTerminated(const browser: ICefBrowser; status: TCefTerminationStatus; error_code: integer; const error_string: ustring);`

Called on the browser process UI thread when the render process terminates unexpectedly. |status| indicates how the process terminated. |error_code| and |error_string| represent the error that would be displayed in Chrome's "Aw, Snap!" view. Possible |error_code| values include TCefResultCode non-normal exit values and platform-specific crash values (for example, a Posix signal or Windows hardware exception).

| `procedure OnDocumentAvailableInMainFrame(const browser: ICefBrowser);`
Called on the browser process UI thread when the window.document object of the main frame has been created.

| `procedure RemoveReferences;`
Custom procedure to clear all references.

Generated by PasDoc 0.17.0.snapshot.