ICoreWebView2Settings

Trait ICoreWebView2Settings 

Source
pub trait ICoreWebView2Settings: IUnknown {
Show 18 methods // Required methods unsafe fn get_is_script_enabled( &self, is_script_enabled: *mut BOOL, ) -> HRESULT; unsafe fn put_is_script_enabled(&self, is_script_enabled: BOOL) -> HRESULT; unsafe fn get_is_web_message_enabled( &self, is_web_message_enabled: *mut BOOL, ) -> HRESULT; unsafe fn put_is_web_message_enabled( &self, is_web_message_enabled: BOOL, ) -> HRESULT; unsafe fn get_are_default_script_dialogs_enabled( &self, are_default_script_dialogs_enabled: *mut BOOL, ) -> HRESULT; unsafe fn put_are_default_script_dialogs_enabled( &self, are_default_script_dialogs_enabled: BOOL, ) -> HRESULT; unsafe fn get_is_status_bar_enabled( &self, is_status_bar_enabled: *mut BOOL, ) -> HRESULT; unsafe fn put_is_status_bar_enabled( &self, is_status_bar_enabled: BOOL, ) -> HRESULT; unsafe fn get_are_dev_tools_enabled( &self, are_dev_tools_enabled: *mut BOOL, ) -> HRESULT; unsafe fn put_are_dev_tools_enabled( &self, are_dev_tools_enabled: BOOL, ) -> HRESULT; unsafe fn get_are_default_context_menus_enabled( &self, enabled: *mut BOOL, ) -> HRESULT; unsafe fn put_are_default_context_menus_enabled( &self, enabled: BOOL, ) -> HRESULT; unsafe fn get_are_host_objects_allowed(&self, allowed: *mut BOOL) -> HRESULT; unsafe fn put_are_host_objects_allowed(&self, allowed: BOOL) -> HRESULT; unsafe fn get_is_zoom_control_enabled(&self, enabled: *mut BOOL) -> HRESULT; unsafe fn put_is_zoom_control_enabled(&self, enabled: BOOL) -> HRESULT; unsafe fn get_is_built_in_error_page_enabled( &self, enabled: *mut BOOL, ) -> HRESULT; unsafe fn put_is_built_in_error_page_enabled( &self, enabled: BOOL, ) -> HRESULT;
}
Expand description

Defines properties that enable, disable, or modify WebView features. Setting changes made after NavigationStarting event does not apply until the next top-level navigation.

Required Methods§

Source

unsafe fn get_is_script_enabled(&self, is_script_enabled: *mut BOOL) -> HRESULT

Controls if running JavaScript is enabled in all future navigations in the WebView. This only affects scripts in the document. Scripts injected with ExecuteScript runs even if script is disabled. The default value is TRUE.

\snippet SettingsComponent.cpp IsScriptEnabled

Source

unsafe fn put_is_script_enabled(&self, is_script_enabled: BOOL) -> HRESULT

Sets the IsScriptEnabled property.

Source

unsafe fn get_is_web_message_enabled( &self, is_web_message_enabled: *mut BOOL, ) -> HRESULT

The IsWebMessageEnabled property is used when loading a new HTML document. If set to TRUE, communication from the host to the top-level HTML document of the WebView is allowed using PostWebMessageAsJson, PostWebMessageAsString, and message event of window.chrome.webview. For more information, navigate to [PostWebMessageAsJson]. Communication from the top-level HTML document of the WebView to the host is allowed using the postMessage function of window.chrome.webview and add_WebMessageReceived method. For more information, navigate to [add_WebMessageReceived]. If set to false, then communication is disallowed. PostWebMessageAsJson and PostWebMessageAsString fails with E_ACCESSDENIED and window.chrome.webview.postMessage fails by throwing an instance of an Error object. The default value is TRUE.

\snippet ScenarioWebMessage.cpp IsWebMessageEnabled

Source

unsafe fn put_is_web_message_enabled( &self, is_web_message_enabled: BOOL, ) -> HRESULT

Sets the IsWebMessageEnabled property.

Source

unsafe fn get_are_default_script_dialogs_enabled( &self, are_default_script_dialogs_enabled: *mut BOOL, ) -> HRESULT

AreDefaultScriptDialogsEnabled is used when loading a new HTML document. If set to FALSE, WebView2 does not render the default JavaScript dialog box (Specifically those displayed by the JavaScript alert, confirm, prompt functions and beforeunload event). Instead, if an event handler is set using add_ScriptDialogOpening, WebView sends an event that contains all of the information for the dialog and allow the host app to show a custom UI. The default value is TRUE.

Source

unsafe fn put_are_default_script_dialogs_enabled( &self, are_default_script_dialogs_enabled: BOOL, ) -> HRESULT

Sets the AreDefaultScriptDialogsEnabled property.

Source

unsafe fn get_is_status_bar_enabled( &self, is_status_bar_enabled: *mut BOOL, ) -> HRESULT

IsStatusBarEnabled controls whether the status bar is displayed. The status bar is usually displayed in the lower left of the WebView and shows things such as the URI of a link when the user hovers over it and other information. The default value is TRUE. The status bar UI can be altered by web content and should not be considered secure.

Source

unsafe fn put_is_status_bar_enabled( &self, is_status_bar_enabled: BOOL, ) -> HRESULT

Sets the IsStatusBarEnabled property.

Source

unsafe fn get_are_dev_tools_enabled( &self, are_dev_tools_enabled: *mut BOOL, ) -> HRESULT

AreDevToolsEnabled controls whether the user is able to use the context menu or keyboard shortcuts to open the DevTools window. The default value is TRUE.

Source

unsafe fn put_are_dev_tools_enabled( &self, are_dev_tools_enabled: BOOL, ) -> HRESULT

Sets the AreDevToolsEnabled property.

Source

unsafe fn get_are_default_context_menus_enabled( &self, enabled: *mut BOOL, ) -> HRESULT

The AreDefaultContextMenusEnabled property is used to prevent default context menus from being shown to user in WebView. The default value is TRUE.

\snippet SettingsComponent.cpp DisableContextMenu

Source

unsafe fn put_are_default_context_menus_enabled(&self, enabled: BOOL) -> HRESULT

Sets the AreDefaultContextMenusEnabled property.

Source

unsafe fn get_are_host_objects_allowed(&self, allowed: *mut BOOL) -> HRESULT

The AreHostObjectsAllowed property is used to control whether host objects are accessible from the page in WebView. The default value is TRUE.

\snippet SettingsComponent.cpp HostObjectsAccess

Source

unsafe fn put_are_host_objects_allowed(&self, allowed: BOOL) -> HRESULT

Sets the AreHostObjectsAllowed property.

Source

unsafe fn get_is_zoom_control_enabled(&self, enabled: *mut BOOL) -> HRESULT

The IsZoomControlEnabled property is used to prevent the user from impacting the zoom of the WebView. When disabled, the user is not able to zoom using Ctrl++, Ctrl+-, or Ctrl+mouse wheel, but the zoom is set using ZoomFactor API. The default value is TRUE.

\snippet SettingsComponent.cpp DisableZoomControl

Source

unsafe fn put_is_zoom_control_enabled(&self, enabled: BOOL) -> HRESULT

Sets the IsZoomControlEnabled property.

Source

unsafe fn get_is_built_in_error_page_enabled( &self, enabled: *mut BOOL, ) -> HRESULT

The IsBuiltInErrorPageEnabled property is used to disable built in error page for navigation failure and render process failure. When disabled, a blank page is displayed when the related error happens. The default value is TRUE.

\snippet SettingsComponent.cpp BuiltInErrorPageEnabled

Source

unsafe fn put_is_built_in_error_page_enabled(&self, enabled: BOOL) -> HRESULT

Sets the IsBuiltInErrorPageEnabled property.

Trait Implementations§

Source§

impl ComInterface for dyn ICoreWebView2Settings

Source§

const IID: IID = IID_ICORE_WEB_VIEW2_SETTINGS

The associated id for this interface
Source§

type VTable = ICoreWebView2SettingsVTable

A COM compatible V-Table
Source§

type Super = dyn IUnknown

The interface that this interface inherits from
Source§

fn is_iid_in_inheritance_chain(riid: &GUID) -> bool

Check whether a given IID is in the inheritance hierarchy of this interface
Source§

impl<C: ICoreWebView2Settings> ProductionComInterface<C> for dyn ICoreWebView2Settings

Source§

fn vtable<O: Offset>() -> Self::VTable

Get the vtable for a particular COM interface

Implementations on Foreign Types§

Source§

impl<T: ICoreWebView2Settings + ComInterface + ?Sized> ICoreWebView2Settings for ComPtr<T>

Source§

unsafe fn get_is_script_enabled(&self, is_script_enabled: *mut BOOL) -> HRESULT

Source§

unsafe fn put_is_script_enabled(&self, is_script_enabled: BOOL) -> HRESULT

Source§

unsafe fn get_is_web_message_enabled( &self, is_web_message_enabled: *mut BOOL, ) -> HRESULT

Source§

unsafe fn put_is_web_message_enabled( &self, is_web_message_enabled: BOOL, ) -> HRESULT

Source§

unsafe fn get_are_default_script_dialogs_enabled( &self, are_default_script_dialogs_enabled: *mut BOOL, ) -> HRESULT

Source§

unsafe fn put_are_default_script_dialogs_enabled( &self, are_default_script_dialogs_enabled: BOOL, ) -> HRESULT

Source§

unsafe fn get_is_status_bar_enabled( &self, is_status_bar_enabled: *mut BOOL, ) -> HRESULT

Source§

unsafe fn put_is_status_bar_enabled( &self, is_status_bar_enabled: BOOL, ) -> HRESULT

Source§

unsafe fn get_are_dev_tools_enabled( &self, are_dev_tools_enabled: *mut BOOL, ) -> HRESULT

Source§

unsafe fn put_are_dev_tools_enabled( &self, are_dev_tools_enabled: BOOL, ) -> HRESULT

Source§

unsafe fn get_are_default_context_menus_enabled( &self, enabled: *mut BOOL, ) -> HRESULT

Source§

unsafe fn put_are_default_context_menus_enabled(&self, enabled: BOOL) -> HRESULT

Source§

unsafe fn get_are_host_objects_allowed(&self, allowed: *mut BOOL) -> HRESULT

Source§

unsafe fn put_are_host_objects_allowed(&self, allowed: BOOL) -> HRESULT

Source§

unsafe fn get_is_zoom_control_enabled(&self, enabled: *mut BOOL) -> HRESULT

Source§

unsafe fn put_is_zoom_control_enabled(&self, enabled: BOOL) -> HRESULT

Source§

unsafe fn get_is_built_in_error_page_enabled( &self, enabled: *mut BOOL, ) -> HRESULT

Source§

unsafe fn put_is_built_in_error_page_enabled(&self, enabled: BOOL) -> HRESULT

Source§

impl<T: ICoreWebView2Settings + ComInterface + ?Sized> ICoreWebView2Settings for ComRc<T>

Source§

unsafe fn get_is_script_enabled(&self, is_script_enabled: *mut BOOL) -> HRESULT

Source§

unsafe fn put_is_script_enabled(&self, is_script_enabled: BOOL) -> HRESULT

Source§

unsafe fn get_is_web_message_enabled( &self, is_web_message_enabled: *mut BOOL, ) -> HRESULT

Source§

unsafe fn put_is_web_message_enabled( &self, is_web_message_enabled: BOOL, ) -> HRESULT

Source§

unsafe fn get_are_default_script_dialogs_enabled( &self, are_default_script_dialogs_enabled: *mut BOOL, ) -> HRESULT

Source§

unsafe fn put_are_default_script_dialogs_enabled( &self, are_default_script_dialogs_enabled: BOOL, ) -> HRESULT

Source§

unsafe fn get_is_status_bar_enabled( &self, is_status_bar_enabled: *mut BOOL, ) -> HRESULT

Source§

unsafe fn put_is_status_bar_enabled( &self, is_status_bar_enabled: BOOL, ) -> HRESULT

Source§

unsafe fn get_are_dev_tools_enabled( &self, are_dev_tools_enabled: *mut BOOL, ) -> HRESULT

Source§

unsafe fn put_are_dev_tools_enabled( &self, are_dev_tools_enabled: BOOL, ) -> HRESULT

Source§

unsafe fn get_are_default_context_menus_enabled( &self, enabled: *mut BOOL, ) -> HRESULT

Source§

unsafe fn put_are_default_context_menus_enabled(&self, enabled: BOOL) -> HRESULT

Source§

unsafe fn get_are_host_objects_allowed(&self, allowed: *mut BOOL) -> HRESULT

Source§

unsafe fn put_are_host_objects_allowed(&self, allowed: BOOL) -> HRESULT

Source§

unsafe fn get_is_zoom_control_enabled(&self, enabled: *mut BOOL) -> HRESULT

Source§

unsafe fn put_is_zoom_control_enabled(&self, enabled: BOOL) -> HRESULT

Source§

unsafe fn get_is_built_in_error_page_enabled( &self, enabled: *mut BOOL, ) -> HRESULT

Source§

unsafe fn put_is_built_in_error_page_enabled(&self, enabled: BOOL) -> HRESULT

Implementors§