Skip to main content

CefWebviewDispatcher

Struct CefWebviewDispatcher 

Source
pub struct CefWebviewDispatcher<T: UserEvent> { /* private fields */ }

Implementations§

Source§

impl<T: UserEvent> CefWebviewDispatcher<T>

Source

pub fn send_dev_tools_message(&self, message: &[u8]) -> Result<()>

Sends a UTF-8 encoded Chrome DevTools Protocol message to the DevTools agent.

The message’s id must come from allocate_devtools_message_id, the allocator every caller on this browser shares. A hardcoded or self-incremented id can consume another caller’s DevToolsProtocol::MethodResult. The runtime’s own requests use identifiers reserved above that allocator’s range, so they cannot be answered by a caller’s message.

Source

pub fn on_dev_tools_protocol<F: Fn(DevToolsProtocol) + Send + Sync + 'static>( &self, f: F, ) -> Result<()>

Observes the DevToolsProtocol traffic of this browser.

The observer receives every message on the browser, including the runtime’s own requests, so results must be matched against an identifier obtained from allocate_devtools_message_id.

Scoped to this webview’s own native browser. A CEF-owned popup is a separate browser whose protocol traffic — its page content, its network activity and its dialog messages — is never reported here, the way a FrameEvent of a popup is not. Observe popups through Webview::popups, whose FrameNavigationState follows a popup’s native lifecycle without exposing what it loaded.

Trait Implementations§

Source§

impl AsCefWebviewDispatcher for CefWebviewDispatcher<EventLoopMessage>

Source§

fn as_cef_webview_dispatcher( &self, ) -> Option<&CefWebviewDispatcher<EventLoopMessage>>

Returns the CEF webview dispatcher, if the runtime is CEF.
Source§

impl<T: Clone + UserEvent> Clone for CefWebviewDispatcher<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + UserEvent> Debug for CefWebviewDispatcher<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: UserEvent> WebviewDispatch<T> for CefWebviewDispatcher<T>

Source§

type Runtime = CefRuntime<T>

The runtime this WebviewDispatch runs under.
Source§

fn run_on_main_thread<F: FnOnce() + Send + 'static>(&self, f: F) -> Result<()>

Run a task on the main thread.
Source§

fn on_webview_event<F: Fn(&WebviewEvent) + Send + 'static>( &self, f: F, ) -> WebviewEventId

Registers a webview event handler.
Source§

fn with_webview<F: FnOnce(<Self::Runtime as Runtime<T>>::Webview) + Send + 'static>( &self, f: F, ) -> Result<()>

Runs a closure with the platform webview object as argument.
Source§

fn open_devtools(&self)

Open the web inspector which is usually called devtools. Read more
Source§

fn close_devtools(&self)

Close the web inspector which is usually called devtools. Read more
Source§

fn is_devtools_open(&self) -> Result<bool>

Gets the devtools window’s current open state. Read more
Source§

fn url(&self) -> Result<String>

Returns the webview’s current URL.
Source§

fn bounds(&self) -> Result<Rect>

Returns the webview’s bounds.
Source§

fn position(&self) -> Result<PhysicalPosition<i32>>

Returns the position of the top-left hand corner of the webviews’s client area relative to the top-left hand corner of the window.
Source§

fn size(&self) -> Result<PhysicalSize<u32>>

Returns the physical size of the webviews’s client area.
Source§

fn navigate(&self, url: Url) -> Result<()>

Navigate to the given URL.
Source§

fn reload(&self) -> Result<()>

Reloads the current page.
Source§

fn go_back(&self) -> Result<()>

Source§

fn can_go_back(&self) -> Result<bool>

Source§

fn go_forward(&self) -> Result<()>

Source§

fn can_go_forward(&self) -> Result<bool>

Source§

fn print(&self) -> Result<()>

Opens the dialog to prints the contents of the webview.
Source§

fn close(&self) -> Result<()>

Closes the webview.
Source§

fn set_bounds(&self, bounds: Rect) -> Result<()>

Sets the webview’s bounds.
Source§

fn set_size(&self, size: Size) -> Result<()>

Resizes the webview.
Source§

fn set_position(&self, position: Position) -> Result<()>

Updates the webview position.
Source§

fn set_focus(&self) -> Result<()>

Bring the window to front and focus the webview.
Source§

fn hide(&self) -> Result<()>

Hide the webview
Source§

fn show(&self) -> Result<()>

Show the webview
Source§

fn eval_script<S: Into<String>>(&self, script: S) -> Result<()>

Executes javascript on the window this WindowDispatch represents.
Source§

fn eval_script_with_callback<S: Into<String>>( &self, script: S, callback: impl Fn(String) + Send + 'static, ) -> Result<()>

Evaluate JavaScript with callback function on the webview this WebviewDispatch represents. The evaluation result will be serialized into a JSON string and passed to the callback function. Read more
Source§

fn reparent(&self, window_id: WindowId) -> Result<()>

Moves the webview to the given window.
Source§

fn cookies_for_url(&self, url: Url) -> Result<Vec<Cookie<'static>>>

Get cookies for a particular url. Read more
Source§

fn cookies(&self) -> Result<Vec<Cookie<'static>>>

Return all cookies in the cookie store. Read more
Set a cookie for the webview. Read more
Delete a cookie for the webview. Read more
Source§

fn set_auto_resize(&self, auto_resize: bool) -> Result<()>

Sets whether the webview should automatically grow and shrink its size and position when the parent window resizes.
Source§

fn set_zoom(&self, scale_factor: f64) -> Result<()>

Set the webview zoom level
Source§

fn set_background_color(&self, color: Option<Color>) -> Result<()>

Set the webview background.
Source§

fn clear_all_browsing_data(&self) -> Result<()>

Clear all browsing data for this webview.

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for CefWebviewDispatcher<T>

§

impl<T> !UnwindSafe for CefWebviewDispatcher<T>

§

impl<T> Freeze for CefWebviewDispatcher<T>
where RuntimeContext<T>: Freeze,

§

impl<T> Send for CefWebviewDispatcher<T>
where RuntimeContext<T>: Send,

§

impl<T> Sync for CefWebviewDispatcher<T>
where RuntimeContext<T>: Sync,

§

impl<T> Unpin for CefWebviewDispatcher<T>
where RuntimeContext<T>: Unpin,

§

impl<T> UnsafeUnpin for CefWebviewDispatcher<T>
where RuntimeContext<T>: UnsafeUnpin,

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
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

fn into_raw(self) -> U

Source§

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

Source§

fn wrap_result(self) -> U

Source§

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

Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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

Source§

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.

Source§

impl<T> Instrument for T

Source§

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

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

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.

Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> UserEvent for T
where T: Debug + Clone + Send + 'static,

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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