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

# EngineSession

`abstract class EngineSession : Observable<Observer>` (source)

Class representing a single engine session.

In browsers usually a session corresponds to a tab.

### Types

Observer | `interface Observer` Interface to be implemented by classes that want to observe this engine session.
TrackingProtectionPolicy | `class TrackingProtectionPolicy` Represents a tracking protection policy which is a combination of tracker categories that should be blocked.

### Constructors

<init> | `EngineSession(delegate: Observable<Observer> = ObserverRegistry())` Class representing a single engine session.

### Properties

settings | `abstract val settings: Settings` Provides access to the settings of this engine session.

### Functions

captureThumbnail | `abstract fun captureThumbnail(): Bitmap?` Takes a screenshot of the actual tab
clearData | `abstract fun clearData(): Unit` Clears all user data sources available.
clearFindMatches | `abstract fun clearFindMatches(): Unit` Clears the highlighted results of previous calls to findAll / findNext.
close | `fun close(): Unit` Close the session. This may free underlying objects. Call this when you are finished using this session.
disableTrackingProtection | `abstract fun disableTrackingProtection(): Unit` Disables tracking protection for this engine session.
enableTrackingProtection | `abstract fun enableTrackingProtection(policy: TrackingProtectionPolicy = TrackingProtectionPolicy.all()): Unit` Enables tracking protection for this engine session.
exitFullScreenMode | `abstract fun exitFullScreenMode(): Unit` Exits fullscreen mode if currently in it that state.
findAll | `abstract fun findAll(text: String): Unit` Finds and highlights all occurrences of the provided String and highlights them asynchronously.
findNext | `abstract fun findNext(forward: Boolean): Unit` Finds and highlights the next or previous match found by findAll.
goBack | `abstract fun goBack(): Unit` Navigates back in the history of this session.
goForward | `abstract fun goForward(): Unit` Navigates forward in the history of this session.
loadData | `abstract fun loadData(data: String, mimeType: String = "text/html", encoding: String = "UTF-8"): Unit` Loads the data with the given mimeType. Example:
loadUrl | `abstract fun loadUrl(url: String): Unit` Loads the given URL.
reload | `abstract fun reload(): Unit` Reloads the current URL.
restoreState | `abstract fun restoreState(state: Map<String, Any>): Unit` Restores the engine state as provided by saveState.
saveState | `abstract fun saveState(): Map<String, Any>` Saves and returns the engine state. Engine implementations are not required to persist the state anywhere else than in the returned map. Engines that already provide a serialized state can use a single entry in this map to provide this state. The only requirement is that the same map can be used to restore the original state. See restoreState and the specific engine implementation for details.
stopLoading | `abstract fun stopLoading(): Unit` Stops loading the current session.
toggleDesktopMode | `abstract fun toggleDesktopMode(enable: Boolean, reload: Boolean = false): Unit` Enables/disables Desktop Mode with an optional ability to reload the session right after.

### Inheritors

GeckoEngineSession | `class GeckoEngineSession : EngineSession` Gecko-based EngineSession implementation.
SystemEngineSession | `class SystemEngineSession : EngineSession` WebView-based EngineSession implementation.