Skip to main content

Module tabs

Module tabs 

Source
Expand description

Multi-tab page registry — the tab data model behind crate::chromium::ChromiumBackend.

TabRegistry is generic over the page handle type (ChromiumBackend uses chromiumoxide::Page) so the open/close/switch/list state machine — including the neighbor-activation and empty-state rules a tab strip depends on — is unit testable with a cheap synthetic handle (see tests below), no live Chrome required. The CDP-specific glue (creating a real page, closing it, refreshing its live nav state) lives in chromium.rs, which owns a TabRegistry<Page> and drives it.

Every mutation publishes a TabsSnapshot on a tokio::sync::watch channel — the change-notification seam a later task’s browser.view.* RPC surface needs to keep a tab strip live, and the one a screencast pump owner needs to notice the active tab changed and move capture to the new page (see crate::screencast): subscribe, changed().await, react. No wire protocol here — that’s the later task’s job.

Structs§

TabId
Opaque identifier for one open tab. Assigned by TabRegistry::open from an internal monotonic counter — ids are never reused, so a stale id from a closed tab can never later alias a different tab.
TabInfo
One tab’s navigation state, as shown in a tab strip.
TabRegistry
Ordered collection of open tabs plus which one is active. Generic over the page handle type P so the state machine is unit testable without a live CDP connection — the tests module below drives it with a plain &str standing in for chromiumoxide::Page.
TabsSnapshot
The full tab list plus which one is active, published to subscribers on every mutation. tabs/active are always the resulting state, not a diff; event names what just happened.

Enums§

TabError
Error from an operation that names a tab id.
TabEvent
One tab lifecycle or navigation event, carried alongside each TabsSnapshot published to subscribers.