Struct WebView

Source
pub struct WebView { /* private fields */ }
Expand description

Wrapper for ICoreWebView2.

Implementations§

Source§

impl WebView

Source

pub fn into_inner(self) -> ComRc<dyn ICoreWebView2>

Source

pub fn as_inner(&self) -> &ComRc<dyn ICoreWebView2>

Source§

impl WebView

Source

pub fn get_settings(&self) -> Result<Settings>

Source

pub fn get_source(&self) -> Result<String>

Source

pub fn navigate(&self, message_string: &str) -> Result<()>

Source

pub fn navigate_to_string(&self, message_string: &str) -> Result<()>

Source

pub fn add_navigation_starting( &self, handler: impl Fn(WebView, NavigationStartingEventArgs) -> Result<()> + 'static, ) -> Result<EventRegistrationToken>

Source

pub fn remove_navigation_starting( &self, token: EventRegistrationToken, ) -> Result<()>

Source

pub fn add_content_loading( &self, handler: impl Fn(WebView, ContentLoadingEventArgs) -> Result<()> + 'static, ) -> Result<EventRegistrationToken>

Source

pub fn remove_content_loading( &self, token: EventRegistrationToken, ) -> Result<()>

Source

pub fn add_source_changed( &self, handler: impl Fn(WebView, SourceChangedEventArgs) -> Result<()> + 'static, ) -> Result<EventRegistrationToken>

Source

pub fn remove_source_changed(&self, token: EventRegistrationToken) -> Result<()>

Source

pub fn add_history_changed( &self, event_handler: impl Fn(WebView) -> Result<()> + 'static, ) -> Result<EventRegistrationToken>

Source

pub fn remove_history_changed( &self, token: EventRegistrationToken, ) -> Result<()>

Source

pub fn add_navigation_completed( &self, handler: impl Fn(WebView, NavigationCompletedEventArgs) -> Result<()> + 'static, ) -> Result<EventRegistrationToken>

Source

pub fn remove_navigation_completed( &self, token: EventRegistrationToken, ) -> Result<()>

Source

pub fn add_frame_navigation_starting( &self, handler: impl Fn(WebView, NavigationStartingEventArgs) -> Result<()> + 'static, ) -> Result<EventRegistrationToken>

Source

pub fn remove_frame_navigation_starting( &self, token: EventRegistrationToken, ) -> Result<()>

Source

pub fn add_script_dialog_opening( &self, handler: impl Fn(WebView, ScriptDialogOpeningEventArgs) -> Result<()> + 'static, ) -> Result<EventRegistrationToken>

Source

pub fn remove_script_dialog_opening( &self, token: EventRegistrationToken, ) -> Result<()>

Source

pub fn add_permission_requested( &self, handler: impl Fn(WebView, PermissionRequestedEventArgs) -> Result<()> + 'static, ) -> Result<EventRegistrationToken>

Source

pub fn remove_permission_requested( &self, token: EventRegistrationToken, ) -> Result<()>

Source

pub fn add_process_failed( &self, handler: impl Fn(WebView, ProcessFailedEventArgs) -> Result<()> + 'static, ) -> Result<EventRegistrationToken>

Source

pub fn remove_process_failed(&self, token: EventRegistrationToken) -> Result<()>

Source

pub fn add_script_to_execute_on_document_created( &self, script: &str, callback: impl FnOnce(String) -> Result<()> + 'static, ) -> Result<()>

Source

pub fn remove_script_to_execute_on_document_created( &self, id: &str, ) -> Result<()>

Source

pub fn execute_script( &self, script: &str, callback: impl FnOnce(String) -> Result<()> + 'static, ) -> Result<()>

Source

pub fn add_document_title_changed( &self, event_handler: impl Fn(WebView) -> Result<()> + 'static, ) -> Result<EventRegistrationToken>

Source

pub fn remove_document_title_changed( &self, token: EventRegistrationToken, ) -> Result<()>

Source

pub fn capture_preview( &self, image_format: CapturePreviewImageFormat, image_stream: Stream, handler: impl FnOnce(Result<()>) -> Result<()> + 'static, ) -> Result<()>

Source

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

Source

pub fn post_web_message_as_json(&self, message_string: &str) -> Result<()>

Source

pub fn post_web_message_as_string(&self, message_string: &str) -> Result<()>

Source

pub fn add_web_message_received( &self, handler: impl Fn(WebView, WebMessageReceivedEventArgs) -> Result<()> + 'static, ) -> Result<EventRegistrationToken>

Source

pub fn remove_web_message_received( &self, token: EventRegistrationToken, ) -> Result<()>

Source

pub fn get_browser_process_id(&self) -> Result<u32>

Source

pub fn get_can_go_back(&self) -> Result<bool>

Source

pub fn get_can_go_forward(&self) -> Result<bool>

Source

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

Source

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

Source

pub fn stop(&self) -> Result<()>

Source

pub fn add_new_window_requested( &self, handler: impl Fn(WebView, NewWindowRequestedEventArgs) -> Result<()> + 'static, ) -> Result<EventRegistrationToken>

Source

pub fn remove_new_window_requested( &self, token: EventRegistrationToken, ) -> Result<()>

Source

pub fn get_document_title(&self) -> Result<String>

Source

pub fn open_dev_tools_window(&self) -> Result<()>

Source

pub fn add_contains_full_screen_element_changed( &self, event_handler: impl Fn(WebView) -> Result<()> + 'static, ) -> Result<EventRegistrationToken>

Source

pub fn remove_contains_full_screen_element_changed( &self, token: EventRegistrationToken, ) -> Result<()>

Source

pub fn get_contains_full_screen_element(&self) -> Result<bool>

Source

pub fn add_web_resource_requested( &self, handler: impl Fn(WebView, WebResourceRequestedEventArgs) -> Result<()> + 'static, ) -> Result<EventRegistrationToken>

Source

pub fn remove_web_resource_requested( &self, token: EventRegistrationToken, ) -> Result<()>

Source

pub fn add_web_resource_requested_filter( &self, uri: &str, resource_context: WebResourceContext, ) -> Result<()>

Source

pub fn remove_web_resource_requested_filter( &self, uri: &str, resource_context: WebResourceContext, ) -> Result<()>

Source

pub fn add_window_close_requested( &self, event_handler: impl Fn(WebView) -> Result<()> + 'static, ) -> Result<EventRegistrationToken>

Source

pub fn remove_window_close_requested( &self, token: EventRegistrationToken, ) -> Result<()>

Trait Implementations§

Source§

impl Clone for WebView

Source§

fn clone(&self) -> WebView

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for WebView

Source§

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

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

impl From<ComRc<dyn ICoreWebView2>> for WebView

Source§

fn from(inner: ComRc<dyn ICoreWebView2>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for WebView

§

impl !RefUnwindSafe for WebView

§

impl !Send for WebView

§

impl !Sync for WebView

§

impl !Unpin for WebView

§

impl !UnwindSafe for WebView

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = 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.