android-components / mozilla.components.concept.engine.webextension / WebExtensionDelegate

WebExtensionDelegate

interface WebExtensionDelegate (source)

Notifies applications or other components of engine events related to web extensions e.g. an extension was installed, or an extension wants to open a new tab.

Functions

Name Summary
onBrowserActionDefined open fun onBrowserActionDefined(webExtension: WebExtension, action: Action): Unit
Invoked when a web extension defines a browser action. To listen for session-specific overrides of Actions and other action-specific events (e.g. opening a popup) see WebExtension.registerActionHandler.
onCloseTab open fun onCloseTab(webExtension: WebExtension?, engineSession: EngineSession): Boolean
Invoked when a web extension attempts to close a tab via browser.tabs.remove.
onDisabled open fun onDisabled(webExtension: WebExtension): Unit
Invoked when a web extension was disabled successfully.
onEnabled open fun onEnabled(webExtension: WebExtension): Unit
Invoked when a web extension was enabled successfully.
onInstallPermissionRequest open fun onInstallPermissionRequest(webExtension: WebExtension): Boolean
Invoked during installation of a WebExtension to confirm the required permissions.
onInstalled open fun onInstalled(webExtension: WebExtension): Unit
Invoked when a web extension was installed successfully.
onNewTab open fun onNewTab(webExtension: WebExtension?, url: String, engineSession: EngineSession): Unit
Invoked when a web extension attempts to open a new tab via browser.tabs.create.
onPageActionDefined open fun onPageActionDefined(webExtension: WebExtension, action: Action): Unit
Invoked when a web extension defines a page action. To listen for session-specific overrides of Actions and other action-specific events (e.g. opening a popup) see WebExtension.registerActionHandler.
onToggleActionPopup open fun onToggleActionPopup(webExtension: WebExtension, engineSession: EngineSession, action: Action): EngineSession?
Invoked when a browser or page action wants to toggle a popup view.
onUninstalled open fun onUninstalled(webExtension: WebExtension): Unit
Invoked when a web extension was uninstalled successfully.
onUpdatePermissionRequest open fun onUpdatePermissionRequest(current: WebExtension, updated: WebExtension, newPermissions: List<String>, onPermissionsGranted: (Boolean) -> Unit): Unit
Invoked when a web extension has changed its permissions while trying to update to a new version. This requires user interaction as the updated extension will not be installed, until the user grants the new permissions.

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.