index.md 16.8 KB
Newer Older
1
2
3
4
[android-components](../../index.md) / [mozilla.components.concept.engine](../index.md) / [Engine](./index.md)

# Engine

MickeyMoz's avatar
MickeyMoz committed
5
`interface Engine : `[`WebExtensionRuntime`](../../mozilla.components.concept.engine.webextension/-web-extension-runtime/index.md)`, `[`DataCleanable`](../-data-cleanable/index.md) [(source)](https://github.com/mozilla-mobile/android-components/blob/master/components/concept/engine/src/main/java/mozilla/components/concept/engine/Engine.kt#L23)
6
7
8

Entry point for interacting with the engine implementation.

MickeyMoz's avatar
MickeyMoz committed
9
10
11
12
13
14
### Types

| Name | Summary |
|---|---|
| [BrowsingData](-browsing-data/index.md) | `class BrowsingData`<br>Describes a combination of browsing data types stored by the engine. |

15
16
17
18
19
### Properties

| Name | Summary |
|---|---|
| [settings](settings.md) | `abstract val settings: `[`Settings`](../-settings/index.md)<br>Provides access to the settings of this engine. |
MickeyMoz's avatar
MickeyMoz committed
20
| [trackingProtectionExceptionStore](tracking-protection-exception-store.md) | `open val trackingProtectionExceptionStore: `[`TrackingProtectionExceptionStorage`](../../mozilla.components.concept.engine.content.blocking/-tracking-protection-exception-storage/index.md)<br>Provides access to the tracking protection exception list for this engine. |
MickeyMoz's avatar
MickeyMoz committed
21
| [version](version.md) | `abstract val version: `[`EngineVersion`](../../mozilla.components.concept.engine.utils/-engine-version/index.md)<br>Returns the version of the engine as [EngineVersion](../../mozilla.components.concept.engine.utils/-engine-version/index.md) object. |
22
23
24
25
26

### Functions

| Name | Summary |
|---|---|
MickeyMoz's avatar
MickeyMoz committed
27
| [createSession](create-session.md) | `abstract fun createSession(private: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = false, contextId: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`? = null): `[`EngineSession`](../-engine-session/index.md)<br>Creates a new engine session. If [speculativeCreateSession](speculative-create-session.md) is supported this method returns the prepared [EngineSession](../-engine-session/index.md) if it is still applicable i.e. the parameter(s) ([private](create-session.md#mozilla.components.concept.engine.Engine$createSession(kotlin.Boolean, kotlin.String)/private)) are equal. |
MickeyMoz's avatar
MickeyMoz committed
28
29
| [createSessionState](create-session-state.md) | `abstract fun createSessionState(json: <ERROR CLASS>): `[`EngineSessionState`](../-engine-session-state/index.md)<br>Create a new [EngineSessionState](../-engine-session-state/index.md) instance from the serialized JSON representation. |
| [createView](create-view.md) | `abstract fun createView(context: <ERROR CLASS>, attrs: <ERROR CLASS>? = null): `[`EngineView`](../-engine-view/index.md)<br>Creates a new view for rendering web content. |
MickeyMoz's avatar
MickeyMoz committed
30
| [getTrackersLog](get-trackers-log.md) | `open fun getTrackersLog(session: `[`EngineSession`](../-engine-session/index.md)`, onSuccess: (`[`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<`[`TrackerLog`](../../mozilla.components.concept.engine.content.blocking/-tracker-log/index.md)`>) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`, onError: (`[`Throwable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` = { }): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Fetch a list of trackers logged for a given [session](get-trackers-log.md#mozilla.components.concept.engine.Engine$getTrackersLog(mozilla.components.concept.engine.EngineSession, kotlin.Function1((kotlin.collections.List((mozilla.components.concept.engine.content.blocking.TrackerLog)), kotlin.Unit)), kotlin.Function1((kotlin.Throwable, kotlin.Unit)))/session) . |
31
| [name](name.md) | `abstract fun name(): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)<br>Returns the name of this engine. The returned string might be used in filenames and must therefore only contain valid filename characters. |
MickeyMoz's avatar
MickeyMoz committed
32
| [registerWebNotificationDelegate](register-web-notification-delegate.md) | `open fun registerWebNotificationDelegate(webNotificationDelegate: `[`WebNotificationDelegate`](../../mozilla.components.concept.engine.webnotifications/-web-notification-delegate/index.md)`): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Registers a [WebNotificationDelegate](../../mozilla.components.concept.engine.webnotifications/-web-notification-delegate/index.md) to be notified of engine events related to web notifications |
MickeyMoz's avatar
MickeyMoz committed
33
| [registerWebPushDelegate](register-web-push-delegate.md) | `open fun registerWebPushDelegate(webPushDelegate: `[`WebPushDelegate`](../../mozilla.components.concept.engine.webpush/-web-push-delegate/index.md)`): `[`WebPushHandler`](../../mozilla.components.concept.engine.webpush/-web-push-handler/index.md)<br>Registers a [WebPushDelegate](../../mozilla.components.concept.engine.webpush/-web-push-delegate/index.md) to be notified of engine events related to web extensions. |
34
| [speculativeConnect](speculative-connect.md) | `abstract fun speculativeConnect(url: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Opens a speculative connection to the host of [url](speculative-connect.md#mozilla.components.concept.engine.Engine$speculativeConnect(kotlin.String)/url). |
MickeyMoz's avatar
MickeyMoz committed
35
| [speculativeCreateSession](speculative-create-session.md) | `open fun speculativeCreateSession(private: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = false, contextId: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`? = null): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Informs the engine that an [EngineSession](../-engine-session/index.md) is likely to be requested soon via [createSession](create-session.md). 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. |
MickeyMoz's avatar
MickeyMoz committed
36
| [warmUp](warm-up.md) | `open fun warmUp(): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Makes sure all required engine initialization logic is executed. The details are specific to individual implementations, but the following must be true: |
37

MickeyMoz's avatar
MickeyMoz committed
38
39
40
41
### Inherited Functions

| Name | Summary |
|---|---|
MickeyMoz's avatar
MickeyMoz committed
42
| [clearData](../-data-cleanable/clear-data.md) | `open fun clearData(data: `[`BrowsingData`](-browsing-data/index.md)` = Engine.BrowsingData.all(), host: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`? = null, onSuccess: () -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` = { }, onError: (`[`Throwable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` = { }): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Clears browsing data stored. |
MickeyMoz's avatar
MickeyMoz committed
43
44
| [disableWebExtension](../../mozilla.components.concept.engine.webextension/-web-extension-runtime/disable-web-extension.md) | `open fun disableWebExtension(extension: `[`WebExtension`](../../mozilla.components.concept.engine.webextension/-web-extension/index.md)`, source: `[`EnableSource`](../../mozilla.components.concept.engine.webextension/-enable-source/index.md)` = EnableSource.USER, onSuccess: (`[`WebExtension`](../../mozilla.components.concept.engine.webextension/-web-extension/index.md)`) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`, onError: (`[`Throwable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` = { }): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Disables the provided [WebExtension](../../mozilla.components.concept.engine.webextension/-web-extension/index.md). If the extension is already disabled the [onSuccess](../../mozilla.components.concept.engine.webextension/-web-extension-runtime/disable-web-extension.md#mozilla.components.concept.engine.webextension.WebExtensionRuntime$disableWebExtension(mozilla.components.concept.engine.webextension.WebExtension, mozilla.components.concept.engine.webextension.EnableSource, kotlin.Function1((mozilla.components.concept.engine.webextension.WebExtension, kotlin.Unit)), kotlin.Function1((kotlin.Throwable, kotlin.Unit)))/onSuccess) callback will be invoked, but this method has no effect on the extension. |
| [enableWebExtension](../../mozilla.components.concept.engine.webextension/-web-extension-runtime/enable-web-extension.md) | `open fun enableWebExtension(extension: `[`WebExtension`](../../mozilla.components.concept.engine.webextension/-web-extension/index.md)`, source: `[`EnableSource`](../../mozilla.components.concept.engine.webextension/-enable-source/index.md)` = EnableSource.USER, onSuccess: (`[`WebExtension`](../../mozilla.components.concept.engine.webextension/-web-extension/index.md)`) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` = { }, onError: (`[`Throwable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` = { }): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Enables the provided [WebExtension](../../mozilla.components.concept.engine.webextension/-web-extension/index.md). If the extension is already enabled the [onSuccess](../../mozilla.components.concept.engine.webextension/-web-extension-runtime/enable-web-extension.md#mozilla.components.concept.engine.webextension.WebExtensionRuntime$enableWebExtension(mozilla.components.concept.engine.webextension.WebExtension, mozilla.components.concept.engine.webextension.EnableSource, kotlin.Function1((mozilla.components.concept.engine.webextension.WebExtension, kotlin.Unit)), kotlin.Function1((kotlin.Throwable, kotlin.Unit)))/onSuccess) callback will be invoked, but this method has no effect on the extension. |
MickeyMoz's avatar
MickeyMoz committed
45
| [installWebExtension](../../mozilla.components.concept.engine.webextension/-web-extension-runtime/install-web-extension.md) | `open fun installWebExtension(id: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, url: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, allowContentMessaging: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = true, supportActions: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = false, onSuccess: (`[`WebExtension`](../../mozilla.components.concept.engine.webextension/-web-extension/index.md)`) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` = { }, onError: (`[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `[`Throwable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` = { _, _ -> }): `[`CancellableOperation`](../-cancellable-operation/index.md)<br>Installs the provided extension in this engine. |
MickeyMoz's avatar
MickeyMoz committed
46
47
| [listInstalledWebExtensions](../../mozilla.components.concept.engine.webextension/-web-extension-runtime/list-installed-web-extensions.md) | `open fun listInstalledWebExtensions(onSuccess: (`[`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<`[`WebExtension`](../../mozilla.components.concept.engine.webextension/-web-extension/index.md)`>) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`, onError: (`[`Throwable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` = { }): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Lists the currently installed web extensions in this engine. |
| [registerWebExtensionDelegate](../../mozilla.components.concept.engine.webextension/-web-extension-runtime/register-web-extension-delegate.md) | `open fun registerWebExtensionDelegate(webExtensionDelegate: `[`WebExtensionDelegate`](../../mozilla.components.concept.engine.webextension/-web-extension-delegate/index.md)`): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Registers a [WebExtensionDelegate](../../mozilla.components.concept.engine.webextension/-web-extension-delegate/index.md) to be notified of engine events related to web extensions |
MickeyMoz's avatar
MickeyMoz committed
48
| [setAllowedInPrivateBrowsing](../../mozilla.components.concept.engine.webextension/-web-extension-runtime/set-allowed-in-private-browsing.md) | `open fun setAllowedInPrivateBrowsing(extension: `[`WebExtension`](../../mozilla.components.concept.engine.webextension/-web-extension/index.md)`, allowed: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`, onSuccess: (`[`WebExtension`](../../mozilla.components.concept.engine.webextension/-web-extension/index.md)`) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` = { }, onError: (`[`Throwable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` = { }): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Sets whether the provided [WebExtension](../../mozilla.components.concept.engine.webextension/-web-extension/index.md) should be allowed to run in private browsing or not. |
MickeyMoz's avatar
MickeyMoz committed
49
50
51
| [uninstallWebExtension](../../mozilla.components.concept.engine.webextension/-web-extension-runtime/uninstall-web-extension.md) | `open fun uninstallWebExtension(ext: `[`WebExtension`](../../mozilla.components.concept.engine.webextension/-web-extension/index.md)`, onSuccess: () -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` = { }, onError: (`[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `[`Throwable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` = { _, _ -> }): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Uninstalls the provided extension from this engine. |
| [updateWebExtension](../../mozilla.components.concept.engine.webextension/-web-extension-runtime/update-web-extension.md) | `open fun updateWebExtension(extension: `[`WebExtension`](../../mozilla.components.concept.engine.webextension/-web-extension/index.md)`, onSuccess: (`[`WebExtension`](../../mozilla.components.concept.engine.webextension/-web-extension/index.md)`?) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` = { }, onError: (`[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `[`Throwable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` = { _, _ -> }): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Updates the provided [extension](../../mozilla.components.concept.engine.webextension/-web-extension-runtime/update-web-extension.md#mozilla.components.concept.engine.webextension.WebExtensionRuntime$updateWebExtension(mozilla.components.concept.engine.webextension.WebExtension, kotlin.Function1((mozilla.components.concept.engine.webextension.WebExtension, kotlin.Unit)), kotlin.Function2((kotlin.String, kotlin.Throwable, kotlin.Unit)))/extension) if a new version is available. |

MickeyMoz's avatar
MickeyMoz committed
52
53
54
55
56
57
### Extension Functions

| Name | Summary |
|---|---|
| [loadResourceAsString](../../mozilla.components.support.test.file/kotlin.-any/load-resource-as-string.md) | `fun `[`Any`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)`.loadResourceAsString(path: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)<br>Loads a file from the resources folder and returns its content as a string object. |

58
59
60
61
### Inheritors

| Name | Summary |
|---|---|
MickeyMoz's avatar
MickeyMoz committed
62
| [GeckoEngine](../../mozilla.components.browser.engine.gecko/-gecko-engine/index.md) | `class GeckoEngine : `[`Engine`](./index.md)`, `[`WebExtensionRuntime`](../../mozilla.components.concept.engine.webextension/-web-extension-runtime/index.md)<br>Gecko-based implementation of Engine interface. |
63
| [SystemEngine](../../mozilla.components.browser.engine.system/-system-engine/index.md) | `class SystemEngine : `[`Engine`](./index.md)<br>WebView-based implementation of the Engine interface. |