android-components / mozilla.components.support.webextensions / WebExtensionSupport

WebExtensionSupport

object WebExtensionSupport (source)

Provides functionality to make sure web extension related events in the WebExtensionRuntime are reflected in the browser state by dispatching the corresponding actions to the BrowserStore.

Note that this class can be removed once the browser-state migration is completed and the WebExtensionRuntime has direct access to the BrowserStore: https://github.com/orgs/mozilla-mobile/projects/31

Properties

Name Summary
installedExtensions val installedExtensions: ConcurrentHashMap<String, WebExtension>

Functions

Name Summary
awaitInitialization suspend fun awaitInitialization(): Unit
Awaits for completion of the initialization process (completes when the state of all installed extensions is known).
initialize fun initialize(runtime: WebExtensionRuntime, store: BrowserStore, openPopupInTab: Boolean = false, onNewTabOverride: (WebExtension?, EngineSession, String) -> String = null, onCloseTabOverride: (WebExtension?, String) -> Unit = null, onSelectTabOverride: (WebExtension?, String) -> Unit = null, onUpdatePermissionRequest: (current: WebExtension, updated: WebExtension, newPermissions: List<String>, onPermissionsGranted: (Boolean) -> Unit) -> Unit = { _, _, _, _ -> }): Unit
Registers a listener for web extension related events on the provided WebExtensionRuntime and reacts by dispatching the corresponding actions to the provided BrowserStore.
markExtensionAsUpdated fun markExtensionAsUpdated(store: BrowserStore, updatedExtension: WebExtension): Unit
Marks the provided updatedExtension as updated in the store.

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.