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

# SelectionAwareSessionObserver

`abstract class SelectionAwareSessionObserver : Observer, Observer` (source)

This class is a combination of Session.Observer and SessionManager.Observer. It provides functionality to observe changes to a specified or selected session, and can automatically take care of switching over the observer in case a different session gets selected (see observeFixed and observeSelected).

### Constructors

<init> | `SelectionAwareSessionObserver(sessionManager: SessionManager)` This class is a combination of Session.Observer and SessionManager.Observer. It provides functionality to observe changes to a specified or selected session, and can automatically take care of switching over the observer in case a different session gets selected (see observeFixed and observeSelected).

### Properties

activeSession | `open var activeSession: Session?` the currently observed session

### Functions

observeFixed | `fun observeFixed(session: Session): Unit` Starts observing changes to the specified session.
observeSelected | `fun observeSelected(): Unit` Starts observing changes to the selected session (see SessionManager.selectedSession). If a different session is selected the observer will automatically be switched over and only notified of changes to the newly selected session.
onSessionSelected | `open fun onSessionSelected(session: Session): Unit` The selection has changed and the given session is now the selected session.
stop | `open fun stop(): Unit` Stops the observer.

### Inherited Functions

onAllSessionsRemoved | `open fun onAllSessionsRemoved(): Unit` All sessions have been removed. Note that this will callback will be invoked whenever removeAll() or removeSessions have been called on the SessionManager. This callback will NOT be invoked when just the last session has been removed by calling remove() on the SessionManager.
onAppPermissionRequested | `open fun onAppPermissionRequested(session: Session, permissionRequest: PermissionRequest): Boolean`
onContentPermissionRequested | `open fun onContentPermissionRequested(session: Session, permissionRequest: PermissionRequest): Boolean`
onCustomTabConfigChanged | `open fun onCustomTabConfigChanged(session: Session, customTabConfig: CustomTabConfig?): Unit`
onDesktopModeChanged | `open fun onDesktopModeChanged(session: Session, enabled: Boolean): Unit`
onDownload | `open fun onDownload(session: Session, download: Download): Boolean`
onFindResult | `open fun onFindResult(session: Session, result: FindResult): Unit`
onFullScreenChanged | `open fun onFullScreenChanged(session: Session, enabled: Boolean): Unit`
onLoadingStateChanged | `open fun onLoadingStateChanged(session: Session, loading: Boolean): Unit`
onLongPress | `open fun onLongPress(session: Session, hitResult: HitResult): Boolean`
onNavigationStateChanged | `open fun onNavigationStateChanged(session: Session, canGoBack: Boolean, canGoForward: Boolean): Unit`
onProgress | `open fun onProgress(session: Session, progress: Int): Unit`
onSearch | `open fun onSearch(session: Session, searchTerms: String): Unit`
onSecurityChanged | `open fun onSecurityChanged(session: Session, securityInfo: SecurityInfo): Unit`
onSessionAdded | `open fun onSessionAdded(session: Session): Unit` The given session has been added.
onSessionRemoved | `open fun onSessionRemoved(session: Session): Unit` The given session has been removed.
onSessionsRestored | `open fun onSessionsRestored(): Unit` Sessions have been restored via a snapshot. This callback is invoked at the end of the call to read, after every session in the snapshot was added, and appropriate session was selected.
onThumbnailChanged | `open fun onThumbnailChanged(session: Session, bitmap: Bitmap?): Unit`
onTitleChanged | `open fun onTitleChanged(session: Session, title: String): Unit`
onTrackerBlocked | `open fun onTrackerBlocked(session: Session, blocked: String, all: List<String>): Unit`
onTrackerBlockingEnabledChanged | `open fun onTrackerBlockingEnabledChanged(session: Session, blockingEnabled: Boolean): Unit`
onUrlChanged | `open fun onUrlChanged(session: Session, url: String): Unit`

### Inheritors

DownloadsFeature | `class DownloadsFeature : SelectionAwareSessionObserver` Feature implementation for proving download functionality for the selected session. It will subscribe to the selected session and will listening for downloads.
ToolbarPresenter | `class ToolbarPresenter : SelectionAwareSessionObserver` Presenter implementation for a toolbar implementation in order to update the toolbar whenever the state of the selected session changes.