class SessionManager : Observable<Observer>
(source)
This class provides access to a centralized registry of all active sessions.
interface Observer
Interface to be implemented by classes that want to observe the session manager. |
|
data class Snapshot |
SessionManager(engine: Engine, defaultSession: () -> Session = null, delegate: Observable<Observer> = ObserverRegistry())
This class provides access to a centralized registry of all active sessions. |
val all: List<Session>
Returns a list of all active sessions (including CustomTab sessions). |
|
val defaultSession: () -> Session |
|
val engine: Engine |
|
val selectedSession: Session?
Gets the currently selected session if there is one. |
|
val selectedSessionOrThrow: Session
Gets the currently selected session or throws an IllegalStateException if no session is selected. |
|
val sessions: List<Session>
Returns a list of active sessions and filters out sessions used for CustomTabs. |
|
val size: Int
Returns the number of session including CustomTab sessions. |
fun add(session: Session, selected: Boolean = false, engineSession: EngineSession? = null, parent: Session? = null): Unit
Adds the provided session. |
|
fun createSnapshot(): Snapshot?
Produces a snapshot of this manager's state, suitable for restoring via SessionManager.restore. Only regular sessions are included in the snapshot. Private and Custom Tab sessions are omitted. |
|
fun findSessionById(id: String): Session?
Finds and returns the session with the given id. Returns null if no matching session could be found. |
|
fun getEngineSession(session: Session = selectedSessionOrThrow): EngineSession?
Gets the linked engine session for the provided session (if it exists). |
|
fun getOrCreateEngineSession(session: Session = selectedSessionOrThrow): EngineSession
Gets the linked engine session for the provided session and creates it if needed. |
|
fun onLowMemory(): Unit
Informs this SessionManager that the OS is in low memory condition so it can reduce its allocated objects. |
|
fun remove(session: Session = selectedSessionOrThrow, selectParentIfExists: Boolean = false): Unit
Removes the provided session. If no session is provided then the selected session is removed. |
|
fun removeAll(): Unit
Removes all sessions including CustomTab sessions. |
|
fun removeSessions(): Unit
Removes all sessions but CustomTab sessions. |
|
fun restore(snapshot: Snapshot): Unit
Restores sessions from the provided Snapshot. Notification behaviour is as follows: |
|
fun select(session: Session): Unit
Marks the given session as selected. |
const val NO_SELECTION: Int |