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

Engine

interface Engine : WebExtensionRuntime, DataCleanable (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
profiler abstract val profiler: Profiler?
Provides access to Firefox Profiler features. See Profiler for more information.
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
clearSpeculativeSession open fun clearSpeculativeSession(): Unit
Removes and closes a speculative session created by speculativeCreateSession. This is useful in case the session should no longer be used e.g. because engine settings have changed.
createSession abstract fun createSession(private: Boolean = false, contextId: String? = null): EngineSession
Creates a new engine session. If speculativeCreateSession is supported this method returns the prepared EngineSession if it is still applicable i.e. the parameter(s) (private) are equal.
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.
speculativeCreateSession open fun speculativeCreateSession(private: Boolean = false, contextId: String? = null): Unit
Informs the engine that an EngineSession is likely to be requested soon via createSession. This is useful in case creating an engine session is costly and an application wants to decide when the session should be created without having to manage the session itself i.e. when it may or may not need it.
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
clearData open fun clearData(data: BrowsingData = Engine.BrowsingData.all(), host: String? = null, onSuccess: () -> Unit = { }, onError: (Throwable) -> Unit = { }): Unit
Clears browsing data stored.
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, onSuccess: (WebExtension) -> Unit = { }, onError: (String, Throwable) -> Unit = { _, _ -> }): CancellableOperation
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
setAllowedInPrivateBrowsing open fun setAllowedInPrivateBrowsing(extension: WebExtension, allowed: Boolean, onSuccess: (WebExtension) -> Unit = { }, onError: (Throwable) -> Unit = { }): Unit
Sets whether the provided WebExtension should be allowed to run in private browsing or not.
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.