android-components / mozilla.components.browser.session / Session


class Session : Observable<Observer> (source)

Value type that represents the state of a browser session. Changes can be observed.


Name Summary
FindResult data class FindResult
A value type representing a result of a “find in page” operation.
Observer interface Observer
Interface to be implemented by classes that want to observe a session.
SecurityInfo data class SecurityInfo
A value type holding security information for a Session.
Source enum class Source
Represents the origin of a session to describe how and why it was created.


Name Summary
<init> Session(initialUrl: String, private: Boolean = false, source: Source = Source.NONE, id: String = UUID.randomUUID().toString(), contextId: String? = null, delegate: Observable<Observer> = ObserverRegistry())
Value type that represents the state of a browser session. Changes can be observed.


Name Summary
appPermissionRequest var appPermissionRequest: Consumable<PermissionRequest>
Consumable permission request for the app. A PermissionRequest must be consumed i.e. either PermissionRequest.grant or PermissionRequest.reject must be called.
canGoBack var canGoBack: Boolean
Navigation state, true if there’s an history item to go back to, otherwise false.
canGoForward var canGoForward: Boolean
Navigation state, true if there’s an history item to go forward to, otherwise false.
contentPermissionRequest var contentPermissionRequest: Consumable<PermissionRequest>
Consumable permission request from web content. A PermissionRequest must be consumed i.e. either PermissionRequest.grant or PermissionRequest.reject must be called. A content permission request can also be cancelled, which will result in a new empty Consumable.
contextId val contextId: String?
crashed var crashed: Boolean
Whether this Session has crashed.
customTabConfig var customTabConfig: CustomTabConfig?
Configuration data in case this session is used for a Custom Tab.
desktopMode var desktopMode: Boolean
Desktop Mode state, true if the desktop mode is requested, otherwise false.
findResults var findResults: List<FindResult>
List of results of that latest “find in page” operation.
fullScreenMode var fullScreenMode: Boolean
Exits fullscreen mode if it’s in that state.
hasParentSession val hasParentSession: Boolean
Returns true if this Session has a parent Session.
hitResult var hitResult: Consumable<HitResult>
The target of the latest long click operation.
icon val icon: <ERROR CLASS>?
An icon for the currently visible page.
id val id: String
launchIntentMetadata var launchIntentMetadata: LaunchIntentMetadata
Set when a launch intent is received.
loadRequestMetadata var loadRequestMetadata: LoadRequestMetadata
Set when a load request is received, indicating if the request came from web content, or via a redirect.
loading var loading: Boolean
Loading state, true if this session’s url is currently loading, otherwise false.
private val private: Boolean
progress var progress: Int
The progress loading the current URL.
readerMode var readerMode: Boolean
Reader mode state, whether or not reader view is enabled, otherwise false.
readerable var readerable: Boolean
Readerable state, whether or not the current page can be shown in a reader view.
recordingDevices var recordingDevices: List<RecordingDevice>
List of recording devices (e.g. camera or microphone) currently in use by web content.
searchTerms var searchTerms: String
The currently / last used search terms (or an empty string).
securityInfo var securityInfo: SecurityInfo
Security information indicating whether or not the current session is for a secure URL, as well as the host and SSL certificate authority, if applicable.
source val source: Source
thumbnail var thumbnail: <ERROR CLASS>?
The target of the latest thumbnail.
title var title: String
The title of the currently displayed website changed.
trackerBlockingEnabled var trackerBlockingEnabled: Boolean
Tracker blocking state, true if blocking trackers is enabled, otherwise false.
trackersBlocked var trackersBlocked: List<Tracker>
List of Trackers that have been blocked in this session.
trackersLoaded var trackersLoaded: List<Tracker>
List of Trackers that could be blocked but have been loaded in this session.
url var url: String
The currently loading or loaded URL.
webAppManifest var webAppManifest: WebAppManifest?
The Web App Manifest for the currently visited page (or null).


Name Summary
equals fun equals(other: Any?): Boolean
hashCode fun hashCode(): Int
isCustomTabSession fun isCustomTabSession(): Boolean
Returns whether or not this session is used for a Custom Tab.
toString fun toString(): String

Extension Functions

Name Summary
installableManifest fun Session.installableManifest(): WebAppManifest?
Checks if the current session represents an installable web app. If so, return the web app manifest. Otherwise, return null.
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.
toCustomTabSessionState fun Session.toCustomTabSessionState(): CustomTabSessionState
Creates a matching CustomTabSessionState from a custom tab Session.
toReaderState fun Session.toReaderState(): ReaderState
Creates a matching ReaderState from a Session
toTabSessionState fun Session.toTabSessionState(): TabSessionState
Create a matching TabSessionState from a Session.