AgentMuxHandler

Struct AgentMuxHandler 

Source
pub struct AgentMuxHandler {
    browser_list: Vec<Browser>,
    is_closing: bool,
    state: Arc<AppState>,
    ipc_port: u16,
    is_browser_pane: bool,
}
Expand description

Core handler state shared across all CEF callback interfaces.

Fields§

§browser_list: Vec<Browser>§is_closing: bool§state: Arc<AppState>§ipc_port: u16§is_browser_pane: bool

Implementations§

Source§

impl AgentMuxHandler

Source

pub fn new(state: Arc<AppState>, ipc_port: u16) -> Arc<Mutex<Self>>

Source

pub fn new_with_browser_pane( state: Arc<AppState>, ipc_port: u16, is_browser_pane: bool, ) -> Arc<Mutex<Self>>

Source

fn on_title_change( &mut self, browser: Option<&mut Browser>, title: Option<&CefString>, )

Source

fn on_favicon_urlchange( &mut self, browser: Option<&mut Browser>, icon_urls: Option<&mut CefStringList>, )

Source

fn on_after_created(&mut self, browser: Option<&mut Browser>)

Source

fn do_close(&mut self, _browser: Option<&mut Browser>) -> bool

Source

fn on_before_popup( &mut self, browser: Option<&mut Browser>, _frame: Option<&mut Frame>, target_url: Option<&CefString>, _target_disposition: WindowOpenDisposition, ) -> bool

Intercept target="_blank" / window.open() from embedded pages so they don’t spawn rogue top-level CEF windows. Instead navigate the current frame to the target URL — matches the UX expectation that AgentMux owns window management, not the page.

Returning non-zero cancels popup creation. Applies to both main and pane clients: main’s frontend never relies on window.open (link clicks go through openExternal IPC), and panes explicitly don’t want popups. See specs/SPEC_BROWSER_PANE_DEFAULT_URL_AND_POPUP_2026_04_21.md.

The load_url call is deferred via post_task, not run inline. Inline load_url caused a UI-thread deadlock on link click: on_before_popup runs while AgentMuxLifeSpanHandler holds self.inner.lock() (via the wrap macro). Inline load_url starts a new navigation on the same UI thread, which triggers on_loading_state_change on AgentMuxLoadHandler, which also tries to take self.inner.lock() → deadlock. The host hung with backend heartbeats still running but the whole UI frozen. Posting the load_url as a separate UI task lets the popup handler return, release the lock, then pick up the load on the next loop iteration.

Source

fn on_before_close(&mut self, browser: Option<&mut Browser>)

Source

fn on_loading_state_change( &mut self, browser: Option<&mut Browser>, _is_loading: i32, can_go_back: i32, can_go_forward: i32, )

CEF fires this whenever the browser’s loading/history state changes (navigation started, navigation committed, back/forward enabled). can_go_back / can_go_forward come directly from the navigation controller — no need to query browser.can_go_back() (which races with history commit when called from on_load_end).

For panes: emit browser-pane-nav-state so the frontend address bar + back/forward buttons reflect CEF’s real history state.

Source

fn on_load_end( &mut self, browser: Option<&mut Browser>, frame: Option<&mut Frame>, _http_status_code: i32, )

Source

fn on_load_error( &mut self, _browser: Option<&mut Browser>, frame: Option<&mut Frame>, error_code: Errorcode, error_text: Option<&CefString>, failed_url: Option<&CefString>, )

Source

fn on_render_process_terminated( &mut self, browser: Option<&mut Browser>, status: TerminationStatus, error_code: i32, error_string: Option<&CefString>, )

Render-process terminated — typically OOM, a renderer-side panic, or some native bug inside CEF/Chromium. Without this hook the window just turns white. We log the cause and replace the white page with a recovery HTML page that offers Reload / Quit buttons.

See specs/SPEC_GRACEFUL_CRASH_HANDLING_2026_04_13.md (PR 1).

Source

fn on_auth_credentials( &mut self, browser: Option<&mut Browser>, origin_url: Option<&CefString>, is_proxy: c_int, host: Option<&CefString>, port: c_int, realm: Option<&CefString>, _scheme: Option<&CefString>, callback: Option<&mut AuthCallback>, ) -> c_int

CEF asks the embedder for HTTP Basic / Digest credentials on a 401/407. Browser-pane requests get surfaced to the renderer via browser-pane-auth-required so the user can type credentials; non-browser-pane requests (the main host window’s frontend load) are declined — those shouldn’t hit auth-challenged resources, and silently failing matches the prior behavior.

Returns 1 (async — we’ll resolve the callback via browser_pane_auth_submit / browser_pane_auth_cancel) or 0 (sync no — CEF aborts the request).

Phase α of SPEC_BROWSER_PANE_HTTP_BASIC_AUTH_2026_05_18.md.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T, U> ConvertParam<U> for T
where T: Into<U>,

§

fn into_raw(self) -> U

§

impl<T, U> ConvertReturnValue<U> for T
where T: Into<U>,

§

fn wrap_result(self) -> U

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,