This includes UI in private tabs. Squashed commits: [180e515e8] Connect to Session Observer and thence to AppLinksFeature. [77922dcc0] browser-engine-system tests passing [045717868] lint etc [6f7b44cad] Thread another Boolean through EngineObserver -> Session onLoadRequest [18693cad0] Start testing the feature. [5e0a93556] Fixup tests to use shadow package manager, and catch some new bugs. [3a5976dde] Split use cases up for menu and intercepting cases. [f7eae96dd] Address reviewer comments re: dead code and docs [b15ffb88c] Rename triggeredByUserInteraction to loadRequestTriggeredByUserInteraction [edc49b573] Move session observer into member of feature [91ed1f5ac] Add changelog entry [098dc5067] Add boolean flag to prevent interception of links [f92731a44] Add load request/trigger by user interaction to session.observer [46385577d] Move opening to another use case, with test [56da7e7c1] Change into using feature [643c9f453] Remove duplicate copyright [6b3f80bbc] Add testing of get and a fragment for open use cases [669c84567] Add AppLinksRedirectConfig and supporting use cases. There is a url redirect creation use case, a load URL use case and an interceptor. [72896a567] AppLinksUseCases detects if a URL can be opened with another non-browser app [939eb62fa] Initial commit of empty feature-app-links |
||
|---|---|---|
| .. | ||
| src | ||
| build.gradle | ||
| proguard-rules.pro | ||
| README.md | ||
Android Components > Browser > Engine-Gecko
Engine implementation based on GeckoView (Beta channel).
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-gecko-beta:{latest-version}"
Initializing
It is recommended to create only one GeckoEngine instance per app. To create a GeckoEngine a GeckoRuntime and optionally DefaultSettings are needed.
// Create default settings (optional) and enable tracking protection for all future sessions.
val defaultSettings = DefaultSettings().apply {
trackingProtectionPolicy = EngineSession.TrackingProtectionPolicy.all()
}
// Create and initialize a Gecko runtime with the default settings.
val runtime = GeckoRuntime.getDefault(applicationContext)
// Create an engine instance to be used by other components.
val engine = GeckoEngine(runtime, 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
GeckoEngineView is the Gecko-based implementation of EngineView in order to render web content.
<mozilla.components.browser.engine.gecko.GeckoEngineView
android:id="@+id/engineView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
GeckoEngineView can render any GeckoEngineSession using the render() method.
val engineSession = engine.createSession()
val engineView = view.findViewById<GeckoEngineView>(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/