Cefrium Navigator
External navigation control for a CefriumView, created with rememberCefriumNavigator and passed to the composable. It operates on the CefriumBrowser owned by the bound CefriumViewState.
Covers load / loadHtml / postUrl / back / forward / reload / stopLoading / evaluateJavaScript (fire-and-forget), plus cookies, HTTP cache, print-to-PDF, dynamic web settings, a request interceptor and web permissions. Only a result-returning JS bridge is deferred to a later release.
Properties
Whether the browser can navigate forward.
Whether page audio is muted via setAudioMuted.
Functions
Captures the current page to a Bitmap, delivered on the main thread (onBitmap receives null on failure). Off-screen mode returns the next painted frame; Surface mode copies the visible surface.
Clears the browser's HTTP cache.
Convenience: disable proxying (direct connection).
Invokes a context-menu command id (from CefriumViewState.contextMenu's serialized items) after the user picks one.
Executes script in the main frame (fire-and-forget). The return value is not delivered back; a result-returning bridge is planned for a later release.
Starts/continues a find-in-page for text. Results arrive on CefriumViewState.findActiveMatch / CefriumViewState.findMatchCount. Set findNext true to step to the next match of the same query.
Persists the cookie store to disk.
Loads a data string with an explicit base URL (full control over mime type, encoding and history URL). See loadHtmlWithBaseUrl for the common case.
Loads an HTML string with an explicit base-URL origin, mirroring Android WebView's loadDataWithBaseURL. Unlike WebView, Cefrium serves the content as a GENUINE network response at baseUrl (not a data: document), so the document has a real network origin and inline embedded players that require a network-served parent -- e.g. the YouTube IFrame player -- PLAY (a data: document is rejected with Error 152, which is why WebView's loadDataWithBaseURL fails here).
Navigates back if canGoBack.
Navigates forward if canGoForward.
"Host is backgrounding": hide the page, suspend media and mute audio so inline audio/video actually stops. Resumable via onHostResume. Usually automatic via CefriumView's backgroundMediaPolicy; call manually only for a custom lifecycle setup.
"Host is foregrounding": unmute, show the page and resume suspended media.
Renders the current page to a PDF at filePath (async).
Resumes media suspended by suspendMedia / onHostPause.
Serializes this tab's back/forward navigation stack for session restore (see CefriumBrowser.serializeNavigationState); null if nothing to save. Restore by constructing a CefriumViewState with the bytes as navigationState.
Mutes/unmutes all page audio (media keeps playing, just silenced).
Pre-grants (or blocks) a per-origin web permission without a prompt — e.g. allow Web Notifications for your own origin so service-worker showNotification() works without asking. permission is one of CefriumBrowser.PERMISSION_*; value one of CefriumBrowser.SETTING_*.
Forces dark mode for page rendering (prefers-color-scheme).
Sets the device chooser handler for the frontier device APIs (Web Bluetooth, WebUSB, Web Serial). When a page calls requestDevice() / requestPort() the handler presents a picker and resolves it via the com.cefrium.CefriumBrowser.DeviceChooserSession. Null = cancel all device requests (the page promise rejects).
Sets the HTTP auth handler (supply credentials/cancel; null = cancel all).
Enables/disables JavaScript at runtime.
Enables the lock-screen / shade media-session controls for this browser.
Sets page visibility (compositor + document.hidden); does not stop audio.
Sets the web permission handler (geolocation, camera, mic; null = deny all).
Convenience: route through a fixed proxy "host:port".
Enable pull-to-refresh (an overscroll-down at the page top reloads). Call before the page loads; the handler binds once when the WebContents connects.
Sets a programmatic request interceptor (block decisions; null clears).
Sets the SSL/certificate error handler (proceed/cancel; null = cancel all).
Overrides the User-Agent at runtime.
Sets the zoom level (0 = 100%; factor = 1.2^level).
Hard-stops all media (not resumable) and mutes; for "release audio on background".
Ends the active find session (clearSelection clears the highlight).
Stops the current load.
Stops the page's media session and dismisses its media notification (also stops media in cross-origin iframes, e.g. a YouTube embed). Use on navigate-away when stopAllMedia (pause + mute) isn't enough because you want the tray notification gone.
Suspends active media (pause; position preserved). See resumeMedia.