CefriumViewState

class CefriumViewState(val initialUrl: String, val navigationState: ByteArray? = null, val incognito: Boolean = false)

Hoisted state for CefriumView, created with rememberCefriumViewState.

The underlying CefriumBrowser is owned by this state, NOT by the CefriumView composable. That lets the browser survive the composable being detached — e.g. when switching browser tabs the inactive tab keeps its page alive instead of reloading. The browser is released by close:

  • automatically when a state created via rememberCefriumViewState leaves composition (via RememberObserver);

  • explicitly by the caller for states constructed directly (e.g. one per tab, closed when the tab closes).

Constructors

Link copied to clipboard
constructor(initialUrl: String, navigationState: ByteArray? = null, incognito: Boolean = false)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

A pending context-menu request from the page, or null. When non-null, show your menu UI, call CefriumNavigator.contextMenuCommand with the chosen command id, then set this back to null to dismiss.

Link copied to clipboard
val downloads: <Error class: unknown class><DownloadEntry>

All downloads seen for this page, newest first, one DownloadEntry per download (updated in place as it progresses). Backed by Compose state, so a download list UI recomposes automatically. Cleared with clearDownloads.

Link copied to clipboard

Find-in-page: 1-based ordinal of the active match (0 = none).

Link copied to clipboard

Find-in-page: total matches for the current query (0 = none).

Link copied to clipboard
val incognito: Boolean = false
Link copied to clipboard
Link copied to clipboard

True while a page element is in HTML5 fullscreen.

Link copied to clipboard
Link copied to clipboard

The most recent download update (null until the first download).

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var onBeforeDownload: (DownloadEntry, allow: (String?) -> Unit, cancel: () -> Unit) -> Unit?

Optional hook to decide asynchronously whether and where to save a download (e.g. an Android SAF "save as" picker). When set, it is called BEFORE the download starts; you MUST eventually call allow(path) (path null = the suggested location) or cancel() -- the download waits for one of them. When null (default), downloads auto-start to the suggested path, like a normal browser.

Link copied to clipboard

Optional per-download-event hook. Fired on the UI thread each time a download starts or updates (before downloads is a stable snapshot), so a host can post/refresh a system notification. The same DownloadEntry is also reflected in downloads. Set to null to stop receiving events.

Link copied to clipboard
Link copied to clipboard

Set when a renderer process for this page dies (an OEM low-memory kill or a crash). When non-null the page is now blank/dead -- show a reload affordance and reload (e.g. via CefriumNavigator.reload). Cleared automatically when the next load starts, so the affordance dismisses itself on recovery.

Functions

Link copied to clipboard

Cancel an in-progress download by its DownloadEntry.id.

Link copied to clipboard

Remove finished (complete or canceled) downloads from downloads.

Link copied to clipboard
fun close()

Releases the browser. Idempotent.

Link copied to clipboard
open fun onAbandoned()
Link copied to clipboard
fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Boolean

Forward the hosting Activity's onActivityResult to this browser so the file picker (<input type=file>, File System Access), camera capture and other intent-for-result flows can deliver their result. Call this from your Activity's onActivityResult for every visible state. Returns true if the result was consumed.

Link copied to clipboard
open fun onForgotten()
Link copied to clipboard
open fun onRemembered()
Link copied to clipboard

Pause an in-progress download by its DownloadEntry.id.

Link copied to clipboard

Resume a paused download by its DownloadEntry.id.