Chromium Embedded Framework (CEF)  126.2.0+g5c56e98+chromium-126.0.6478.62
CefMessageRouterBrowserSide Class Referenceabstract

Implements the browser side of query routing. More...

#include "include/wrapper/cef_message_router.h"

Inheritance diagram for CefMessageRouterBrowserSide:
base::RefCountedThreadSafe< CefMessageRouterBrowserSide >

Classes

class  Callback
 Callback associated with a single pending asynchronous query. More...
 
class  Handler
 Implement this interface to handle queries. More...
 

Public Member Functions

virtual bool AddHandler (Handler *handler, bool first)=0
 Add a new query handler. More...
 
virtual bool RemoveHandler (Handler *handler)=0
 Remove an existing query handler. More...
 
virtual void CancelPending (CefRefPtr< CefBrowser > browser, Handler *handler)=0
 Cancel all pending queries associated with either |browser| or |handler|. More...
 
virtual int GetPendingCount (CefRefPtr< CefBrowser > browser, Handler *handler)=0
 Returns the number of queries currently pending for the specified |browser| and/or |handler|. More...
 
virtual void OnBeforeClose (CefRefPtr< CefBrowser > browser)=0
 The below methods should be called from other CEF handlers. More...
 
virtual void OnRenderProcessTerminated (CefRefPtr< CefBrowser > browser)=0
 Call from CefRequestHandler::OnRenderProcessTerminated. More...
 
virtual void OnBeforeBrowse (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame)=0
 Call from CefRequestHandler::OnBeforeBrowse only if the navigation is allowed to proceed. More...
 
virtual bool OnProcessMessageReceived (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, CefProcessId source_process, CefRefPtr< CefProcessMessage > message)=0
 Call from CefClient::OnProcessMessageReceived. More...
 
- Public Member Functions inherited from base::RefCountedThreadSafe< CefMessageRouterBrowserSide >
 RefCountedThreadSafe ()
 
 RefCountedThreadSafe (const RefCountedThreadSafe &)=delete
 
RefCountedThreadSafeoperator= (const RefCountedThreadSafe &)=delete
 
void AddRef () const
 
void Release () const
 

Static Public Member Functions

static CefRefPtr< CefMessageRouterBrowserSideCreate (const CefMessageRouterConfig &config)
 Create a new router with the specified configuration. More...
 

Protected Member Functions

virtual ~CefMessageRouterBrowserSide ()=default
 
- Protected Member Functions inherited from base::RefCountedThreadSafe< CefMessageRouterBrowserSide >
 ~RefCountedThreadSafe ()=default
 

Friends

class base::RefCountedThreadSafe< CefMessageRouterBrowserSide >
 

Additional Inherited Members

- Static Public Attributes inherited from base::RefCountedThreadSafe< CefMessageRouterBrowserSide >
static constexpr cef_subtle::StartRefCountFromZeroTag kRefCountPreference
 

Detailed Description

Implements the browser side of query routing.

The methods of this class may be called on any browser process thread unless otherwise indicated.

Constructor & Destructor Documentation

◆ ~CefMessageRouterBrowserSide()

virtual CefMessageRouterBrowserSide::~CefMessageRouterBrowserSide ( )
protectedvirtualdefault

Member Function Documentation

◆ AddHandler()

virtual bool CefMessageRouterBrowserSide::AddHandler ( Handler handler,
bool  first 
)
pure virtual

Add a new query handler.

If |first| is true it will be added as the first handler, otherwise it will be added as the last handler. Returns true if the handler is added successfully or false if the handler has already been added. Must be called on the browser process UI thread. The Handler object must either outlive the router or be removed before deletion.

◆ CancelPending()

virtual void CefMessageRouterBrowserSide::CancelPending ( CefRefPtr< CefBrowser browser,
Handler handler 
)
pure virtual

Cancel all pending queries associated with either |browser| or |handler|.

If both |browser| and |handler| are NULL all pending queries will be canceled. Handler::OnQueryCanceled will be called and the associated JavaScript onFailure callback will be executed in all cases with an error code of -1.

◆ Create()

static CefRefPtr<CefMessageRouterBrowserSide> CefMessageRouterBrowserSide::Create ( const CefMessageRouterConfig config)
static

Create a new router with the specified configuration.

◆ GetPendingCount()

virtual int CefMessageRouterBrowserSide::GetPendingCount ( CefRefPtr< CefBrowser browser,
Handler handler 
)
pure virtual

Returns the number of queries currently pending for the specified |browser| and/or |handler|.

Either or both values may be empty. Must be called on the browser process UI thread.

◆ OnBeforeBrowse()

virtual void CefMessageRouterBrowserSide::OnBeforeBrowse ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefFrame frame 
)
pure virtual

Call from CefRequestHandler::OnBeforeBrowse only if the navigation is allowed to proceed.

If |frame| is the main frame then any pending queries associated with |browser| will be canceled and Handler::OnQueryCanceled will be called. No JavaScript callbacks will be executed since this indicates destruction of the context.

◆ OnBeforeClose()

virtual void CefMessageRouterBrowserSide::OnBeforeClose ( CefRefPtr< CefBrowser browser)
pure virtual

The below methods should be called from other CEF handlers.

They must be called exactly as documented for the router to function correctly. Call from CefLifeSpanHandler::OnBeforeClose. Any pending queries associated with |browser| will be canceled and Handler::OnQueryCanceled will be called. No JavaScript callbacks will be executed since this indicates destruction of the browser.

◆ OnProcessMessageReceived()

virtual bool CefMessageRouterBrowserSide::OnProcessMessageReceived ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefFrame frame,
CefProcessId  source_process,
CefRefPtr< CefProcessMessage message 
)
pure virtual

Call from CefClient::OnProcessMessageReceived.

Returns true if the message is handled by this router or false otherwise.

◆ OnRenderProcessTerminated()

virtual void CefMessageRouterBrowserSide::OnRenderProcessTerminated ( CefRefPtr< CefBrowser browser)
pure virtual

Call from CefRequestHandler::OnRenderProcessTerminated.

Any pending queries associated with |browser| will be canceled and Handler::OnQueryCanceled will be called. No JavaScript callbacks will be executed since this indicates destruction of the context.

◆ RemoveHandler()

virtual bool CefMessageRouterBrowserSide::RemoveHandler ( Handler handler)
pure virtual

Remove an existing query handler.

Any pending queries associated with the handler will be canceled. Handler::OnQueryCanceled will be called and the associated JavaScript onFailure callback will be executed with an error code of -1. Returns true if the handler is removed successfully or false if the handler is not found. Must be called on the browser process UI thread.

Friends And Related Function Documentation

◆ base::RefCountedThreadSafe< CefMessageRouterBrowserSide >


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