Overview   Project   Class   Tree   Index 
CEF3 C++ API Docs - Version 80.1.4+g8927396+chromium-80.0.3987.149
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD

(default)
Class CefExtensionHandler

CefBaseRefCounted
   |
   +--CefExtensionHandler

   in cef_extension_handler.h

class CefExtensionHandler
extends CefBaseRefCounted

Implement this interface to handle events related to browser extensions. The methods of this class will be called on the UI thread. See CefRequestContext::LoadExtension for information about extension loading.


Method Summary
 virtual bool CanAccessBrowser( CefRefPtr< CefExtension > extension, CefRefPtr< CefBrowser > browser, bool include_incognito, CefRefPtr< CefBrowser > target_browser )
          Called when the tabId associated with |target_browser| is specified to an extension API call that accepts a tabId parameter (e.g. chrome.tabs.*).
 virtual CefRefPtr< CefBrowser > GetActiveBrowser( CefRefPtr< CefExtension > extension, CefRefPtr< CefBrowser > browser, bool include_incognito )
          Called when no tabId is specified to an extension API call that accepts a tabId parameter (e.g. chrome.tabs.*).
 virtual bool GetExtensionResource( CefRefPtr< CefExtension > extension, CefRefPtr< CefBrowser > browser, const CefString& file, CefRefPtr< CefGetExtensionResourceCallback > callback )
          Called to retrieve an extension resource that would normally be loaded from disk (e.g. if a file parameter is specified to chrome.tabs.executeScript).
 virtual bool OnBeforeBackgroundBrowser( CefRefPtr< CefExtension > extension, const CefString& url, CefRefPtr< CefClient >& client, CefBrowserSettings& settings )
          Called when an extension needs a browser to host a background script specified via the "background" manifest key.
 virtual bool OnBeforeBrowser( CefRefPtr< CefExtension > extension, CefRefPtr< CefBrowser > browser, CefRefPtr< CefBrowser > active_browser, int index, const CefString& url, bool active, CefWindowInfo& windowInfo, CefRefPtr< CefClient >& client, CefBrowserSettings& settings )
          Called when an extension API (e.g. chrome.tabs.create) requests creation of a new browser.
 virtual void OnExtensionLoaded( CefRefPtr< CefExtension > extension )
          Called if the CefRequestContext::LoadExtension request succeeds.
 virtual void OnExtensionLoadFailed( cef_errorcode_t result )
          Called if the CefRequestContext::LoadExtension request fails.
 virtual void OnExtensionUnloaded( CefRefPtr< CefExtension > extension )
          Called after the CefExtension::Unload request has completed.
   
Methods inherited from class CefBaseRefCounted
AddRef, Release, HasOneRef, HasAtLeastOneRef
 

Method Detail

CanAccessBrowser

public virtual bool CanAccessBrowser( CefRefPtr< CefExtension > extension, CefRefPtr< CefBrowser > browser, bool include_incognito, CefRefPtr< CefBrowser > target_browser );
Called when the tabId associated with |target_browser| is specified to an extension API call that accepts a tabId parameter (e.g. chrome.tabs.*). |extension| and |browser| are the source of the API call. Return true to allow access of false to deny access. Access to incognito browsers should not be allowed unless the source extension has incognito access enabled, in which case |include_incognito| will be true.

GetActiveBrowser

public virtual CefRefPtr< CefBrowser > GetActiveBrowser( CefRefPtr< CefExtension > extension, CefRefPtr< CefBrowser > browser, bool include_incognito );
Called when no tabId is specified to an extension API call that accepts a tabId parameter (e.g. chrome.tabs.*). |extension| and |browser| are the source of the API call. Return the browser that will be acted on by the API call or return NULL to act on |browser|. The returned browser must share the same CefRequestContext as |browser|. Incognito browsers should not be considered unless the source extension has incognito access enabled, in which case |include_incognito| will be true.

GetExtensionResource

public virtual bool GetExtensionResource( CefRefPtr< CefExtension > extension, CefRefPtr< CefBrowser > browser, const CefString& file, CefRefPtr< CefGetExtensionResourceCallback > callback );
Called to retrieve an extension resource that would normally be loaded from disk (e.g. if a file parameter is specified to chrome.tabs.executeScript). |extension| and |browser| are the source of the resource request. |file| is the requested relative file path. To handle the resource request return true and execute |callback| either synchronously or asynchronously. For the default behavior which reads the resource from the extension directory on disk return false. Localization substitutions will not be applied to resources handled via this method.

OnBeforeBackgroundBrowser

public virtual bool OnBeforeBackgroundBrowser( CefRefPtr< CefExtension > extension, const CefString& url, CefRefPtr< CefClient >& client, CefBrowserSettings& settings );
Called when an extension needs a browser to host a background script specified via the "background" manifest key. The browser will have no visible window and cannot be displayed. |extension| is the extension that is loading the background script. |url| is an internally generated reference to an HTML page that will be used to load the background script via a