android-components / mozilla.components.concept.engine / Engine

Engine

interface Engine : WebExtensionRuntime (source)

Entry point for interacting with the engine implementation.

Types

Name Summary
BrowsingData class BrowsingData
Describes a combination of browsing data types stored by the engine.

Properties

Name Summary
settings abstract val settings: Settings
Provides access to the settings of this engine.
trackingProtectionExceptionStore open val trackingProtectionExceptionStore: TrackingProtectionExceptionStorage
Provides access to the tracking protection exception list for this engine.
version abstract val version: EngineVersion
Returns the version of the engine as EngineVersion object.

Functions

Name Summary
clearData open fun clearData(data: BrowsingData = BrowsingData.all(), host: String? = null, onSuccess: () -> Unit = { }, onError: (Throwable) -> Unit = { }): Unit
Clears browsing data stored by the engine.
createSession abstract fun createSession(private: Boolean = false): EngineSession
Creates a new engine session.
createSessionState abstract fun createSessionState(json: <ERROR CLASS>): EngineSessionState
Create a new EngineSessionState instance from the serialized JSON representation.
createView abstract fun createView(context: <ERROR CLASS>, attrs: <ERROR CLASS>? = null): EngineView
Creates a new view for rendering web content.
getTrackersLog open fun getTrackersLog(session: EngineSession, onSuccess: (List<TrackerLog>) -> Unit, onError: (Throwable) -> Unit = { }): Unit
Fetch a list of trackers logged for a given session .
name abstract fun name(): String
Returns the name of this engine. The returned string might be used in filenames and must therefore only contain valid filename characters.
registerWebNotificationDelegate open fun registerWebNotificationDelegate(webNotificationDelegate: WebNotificationDelegate): Unit
Registers a WebNotificationDelegate to be notified of engine events related to web notifications
registerWebPushDelegate open fun registerWebPushDelegate(webPushDelegate: WebPushDelegate): WebPushHandler
Registers a WebPushDelegate to be notified of engine events related to web extensions.
speculativeConnect abstract fun speculativeConnect(url: String): Unit
Opens a speculative connection to the host of url.
warmUp open fun warmUp(): Unit
Makes sure all required engine initialization logic is executed. The details are specific to individual implementations, but the following must be true:

Inherited Functions

Name Summary
disableWebExtension open fun disableWebExtension(extension: WebExtension, source: EnableSource = EnableSource.USER, onSuccess: (WebExtension) -> Unit, onError: (Throwable) -> Unit = { }): Unit
Disables the provided WebExtension. If the extension is already disabled the onSuccess callback will be invoked, but this method has no effect on the extension.
enableWebExtension open fun enableWebExtension(extension: WebExtension, source: EnableSource = EnableSource.USER, onSuccess: (WebExtension) -> Unit = { }, onError: (Throwable) -> Unit = { }): Unit
Enables the provided WebExtension. If the extension is already enabled the onSuccess callback will be invoked, but this method has no effect on the extension.
installWebExtension open fun installWebExtension(id: String, url: String, allowContentMessaging: Boolean = true, supportActions: Boolean = false, onSuccess: (WebExtension) -> Unit = { }, onError: (String, Throwable) -> Unit = { _, _ -> }): Unit
Installs the provided extension in this engine.
listInstalledWebExtensions open fun listInstalledWebExtensions(onSuccess: (List<WebExtension>) -> Unit, onError: (Throwable) -> Unit = { }): Unit
Lists the currently installed web extensions in this engine.
registerWebExtensionDelegate open fun registerWebExtensionDelegate(webExtensionDelegate: WebExtensionDelegate): Unit
Registers a WebExtensionDelegate to be notified of engine events related to web extensions
uninstallWebExtension open fun uninstallWebExtension(ext: WebExtension, onSuccess: () -> Unit = { }, onError: (String, Throwable) -> Unit = { _, _ -> }): Unit
Uninstalls the provided extension from this engine.
updateWebExtension open fun updateWebExtension(extension: WebExtension, onSuccess: (WebExtension?) -> Unit = { }, onError: (String, Throwable) -> Unit = { _, _ -> }): Unit
Updates the provided extension if a new version is available.

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.

Inheritors

Name Summary
GeckoEngine class GeckoEngine : Engine, WebExtensionRuntime
Gecko-based implementation of Engine interface.
SystemEngine class SystemEngine : Engine
WebView-based implementation of the Engine interface.