fune/mobile/android/android-components/components/browser/engine-system
Geoff Brown 6356370a37 Bug 1881094 - 4. remove and revise prettier exclusions for firefox-android r=android-reviewers,frontend-codestyle-reviewers,gl,webcompat-reviewers,twisniewski
- remove the firefox-android exclusions from .prettierignore
 - add a few specific exclusions to .prettierignore for files with existing errors
 - add a few specific entries to Generated.txt and ThirdPartyPaths.txt
 - add `initial_experiments.json` to the list of generated files: these are updated from Nimbus
 - run `mach lint --fix --linter=eslint -- mobile/android` to generate all the formatting changes

Differential Revision: https://phabricator.services.mozilla.com/D206915
2024-05-07 20:24:38 +00:00
..
src Bug 1881094 - 4. remove and revise prettier exclusions for firefox-android r=android-reviewers,frontend-codestyle-reviewers,gl,webcompat-reviewers,twisniewski 2024-05-07 20:24:38 +00:00
build.gradle Bug 1849833 - Replace deprecated compileSdkVersion. 2023-09-11 06:36:20 +00:00
proguard-rules.pro
README.md

Android Components > Browser > Engine-System

Engine implementation based on the system's WebView.

Usage

See concept-engine for a documentation of the abstract engine API this component implements.

Setting up the dependency

Use Gradle to download the library from maven.mozilla.org (Setup repository):

implementation "org.mozilla.components:browser-engine-system:{latest-version}"

Initializing

It is recommended t create only one SystemEngine instance per app.

// Create default settings (optional) and enable tracking protection for all future sessions.
val defaultSettings = DefaultSettings().apply {
    trackingProtectionPolicy = EngineSession.TrackingProtectionPolicy.all()
}

// Create an engine instance to be used by other components.
val engine = SystemEngine(context, defaultSettings)

Integration

Usually it is not needed to interact with the Engine component directly. The browser-session component will take care of making the state accessible and link a Session to an EngineSession internally. The feature-session component will provide "use cases" to perform actions like loading URLs and takes care of rendering the selected Session on an EngineView.

View

SystemEngineView is the Gecko-based implementation of EngineView in order to render web content.

<mozilla.components.browser.engine.system.SystemEngineView
    android:id="@+id/engineView"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

SystemEngineView can render any SystemEngineSession using the render() method.

val engineSession = engine.createSession()
val engineView = view.findViewById<SystemEngineView>(R.id.engineView)
engineView.render(engineSession)

License

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/