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

Session

class Session : Observable<Observer> (source)

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

Types

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.

Constructors

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

Properties

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.
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 var icon: <ERROR CLASS>?
An icon for the currently visible page.
id val id: String
loadRequestMetadata var loadRequestMetadata: Consumable<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.
media var media: List<Media>
List of Media on the currently visited page.
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).

Functions

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.