Chromium Embedded Framework (CEF)  126.2.0+g5c56e98+chromium-126.0.6478.62
CefResourceRequestHandler Class Reference

Implement this interface to handle events related to browser requests. More...

#include "include/cef_resource_request_handler.h"

Inheritance diagram for CefResourceRequestHandler:
CefBaseRefCounted

Public Types

typedef cef_return_value_t ReturnValue
 
typedef cef_urlrequest_status_t URLRequestStatus
 

Public Member Functions

virtual CefRefPtr< CefCookieAccessFilterGetCookieAccessFilter (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, CefRefPtr< CefRequest > request)
 Called on the IO thread before a resource request is loaded. More...
 
virtual ReturnValue OnBeforeResourceLoad (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, CefRefPtr< CefRequest > request, CefRefPtr< CefCallback > callback)
 Called on the IO thread before a resource request is loaded. More...
 
virtual CefRefPtr< CefResourceHandlerGetResourceHandler (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, CefRefPtr< CefRequest > request)
 Called on the IO thread before a resource is loaded. More...
 
virtual void OnResourceRedirect (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, CefRefPtr< CefRequest > request, CefRefPtr< CefResponse > response, CefString &new_url)
 Called on the IO thread when a resource load is redirected. More...
 
virtual bool OnResourceResponse (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, CefRefPtr< CefRequest > request, CefRefPtr< CefResponse > response)
 Called on the IO thread when a resource response is received. More...
 
virtual CefRefPtr< CefResponseFilterGetResourceResponseFilter (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, CefRefPtr< CefRequest > request, CefRefPtr< CefResponse > response)
 Called on the IO thread to optionally filter resource response content. More...
 
virtual void OnResourceLoadComplete (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, CefRefPtr< CefRequest > request, CefRefPtr< CefResponse > response, URLRequestStatus status, int64_t received_content_length)
 Called on the IO thread when a resource load has completed. More...
 
virtual void OnProtocolExecution (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, CefRefPtr< CefRequest > request, bool &allow_os_execution)
 Called on the IO thread to handle requests for URLs with an unknown protocol component. More...
 
- Public Member Functions inherited from CefBaseRefCounted
virtual void AddRef () const =0
 Called to increment the reference count for the object. More...
 
virtual bool Release () const =0
 Called to decrement the reference count for the object. More...
 
virtual bool HasOneRef () const =0
 Returns true if the reference count is 1. More...
 
virtual bool HasAtLeastOneRef () const =0
 Returns true if the reference count is at least 1. More...
 

Additional Inherited Members

- Protected Member Functions inherited from CefBaseRefCounted
virtual ~CefBaseRefCounted ()
 

Detailed Description

Implement this interface to handle events related to browser requests.

The methods of this class will be called on the IO thread unless otherwise indicated.

Member Typedef Documentation

◆ ReturnValue

◆ URLRequestStatus

Member Function Documentation

◆ GetCookieAccessFilter()

virtual CefRefPtr<CefCookieAccessFilter> CefResourceRequestHandler::GetCookieAccessFilter ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefFrame frame,
CefRefPtr< CefRequest request 
)
inlinevirtual

Called on the IO thread before a resource request is loaded.

The |browser| and |frame| values represent the source of the request, and may be NULL for requests originating from service workers or CefURLRequest. To optionally filter cookies for the request return a CefCookieAccessFilter object. The |request| object cannot not be modified in this callback.

◆ GetResourceHandler()

virtual CefRefPtr<CefResourceHandler> CefResourceRequestHandler::GetResourceHandler ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefFrame frame,
CefRefPtr< CefRequest request 
)
inlinevirtual

Called on the IO thread before a resource is loaded.

The |browser| and |frame| values represent the source of the request, and may be NULL for requests originating from service workers or CefURLRequest. To allow the resource to load using the default network loader return NULL. To specify a handler for the resource return a CefResourceHandler object. The |request| object cannot not be modified in this callback.

◆ GetResourceResponseFilter()

virtual CefRefPtr<CefResponseFilter> CefResourceRequestHandler::GetResourceResponseFilter ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefFrame frame,
CefRefPtr< CefRequest request,
CefRefPtr< CefResponse response 
)
inlinevirtual

Called on the IO thread to optionally filter resource response content.

The |browser| and |frame| values represent the source of the request, and may be NULL for requests originating from service workers or CefURLRequest. |request| and |response| represent the request and response respectively and cannot be modified in this callback.

◆ OnBeforeResourceLoad()

virtual ReturnValue CefResourceRequestHandler::OnBeforeResourceLoad ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefFrame frame,
CefRefPtr< CefRequest request,
CefRefPtr< CefCallback callback 
)
inlinevirtual

Called on the IO thread before a resource request is loaded.

The |browser| and |frame| values represent the source of the request, and may be NULL for requests originating from service workers or CefURLRequest. To redirect or change the resource load optionally modify |request|. Modification of the request URL will be treated as a redirect. Return RV_CONTINUE to continue the request immediately. Return RV_CONTINUE_ASYNC and call CefCallback methods at a later time to continue or cancel the request asynchronously. Return RV_CANCEL to cancel the request immediately.

◆ OnProtocolExecution()

virtual void CefResourceRequestHandler::OnProtocolExecution ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefFrame frame,
CefRefPtr< CefRequest request,
bool &  allow_os_execution 
)
inlinevirtual

Called on the IO thread to handle requests for URLs with an unknown protocol component.

The |browser| and |frame| values represent the source of the request, and may be NULL for requests originating from service workers or CefURLRequest. |request| cannot be modified in this callback. Set |allow_os_execution| to true 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.

◆ OnResourceLoadComplete()

virtual void CefResourceRequestHandler::OnResourceLoadComplete ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefFrame frame,
CefRefPtr< CefRequest request,
CefRefPtr< CefResponse response,
URLRequestStatus  status,
int64_t  received_content_length 
)
inlinevirtual

Called on the IO thread when a resource load has completed.

The |browser| and |frame| values represent the source of the request, and may be NULL for requests originating from service workers or CefURLRequest. |request| and |response| represent the request and response respectively and cannot be modified in this callback. |status| indicates the load completion status. |received_content_length| is the number of response bytes actually read. This method will be called for all requests, including requests that are aborted due to CEF shutdown or destruction of the associated browser. In cases where the associated browser is destroyed this callback may arrive after the CefLifeSpanHandler::OnBeforeClose callback for that browser. The CefFrame::IsValid method can be used to test for this situation, and care should be taken not to call |browser| or |frame| methods that modify state (like LoadURL, SendProcessMessage, etc.) if the frame is invalid.

◆ OnResourceRedirect()

virtual void CefResourceRequestHandler::OnResourceRedirect ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefFrame frame,
CefRefPtr< CefRequest request,
CefRefPtr< CefResponse response,
CefString new_url 
)
inlinevirtual

Called on the IO thread when a resource load is redirected.

The |browser| and |frame| values represent the source of the request, and may be NULL for requests originating from service workers or CefURLRequest. 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 |new_url| parameter will contain the new URL and can be changed if desired. The |request| and |response| objects cannot be modified in this callback.

◆ OnResourceResponse()

virtual bool CefResourceRequestHandler::OnResourceResponse ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefFrame frame,
CefRefPtr< CefRequest request,
CefRefPtr< CefResponse response 
)
inlinevirtual

Called on the IO thread when a resource response is received.

The |browser| and |frame| values represent the source of the request, and may be NULL for requests originating from service workers or CefURLRequest. To allow the resource load to proceed without modification return false. To redirect or retry the resource load optionally modify |request| and return true. Modification of the request URL will be treated as a redirect. Requests handled using the default network loader cannot be redirected in this callback. The |response| object cannot be modified in this callback.

WARNING: Redirecting using this method is deprecated. Use OnBeforeResourceLoad or GetResourceHandler to perform redirects.


The documentation for this class was generated from the following file: