Trait webview2_sys::ICoreWebView2Frame[][src]

pub trait ICoreWebView2Frame: IUnknown {
    unsafe fn get_name(&self, name: *mut LPWSTR) -> HRESULT;
unsafe fn add_name_changed(
        &self,
        event_handler: *mut *mut ICoreWebView2FrameNameChangedEventHandlerVTable,
        token: *mut EventRegistrationToken
    ) -> HRESULT;
unsafe fn remove_name_changed(
        &self,
        token: EventRegistrationToken
    ) -> HRESULT;
unsafe fn add_host_object_to_script_with_origins(
        &self,
        name: LPCWSTR,
        object: *mut VARIANT,
        origins_count: u32,
        origins: *mut LPCWSTR
    ) -> HRESULT;
unsafe fn remove_host_object_from_script(&self, name: LPCWSTR) -> HRESULT;
unsafe fn add_destroyed(
        &self,
        event_handler: *mut *mut ICoreWebView2FrameDestroyedEventHandlerVTable,
        token: *mut EventRegistrationToken
    ) -> HRESULT;
unsafe fn remove_destroyed(&self, token: EventRegistrationToken) -> HRESULT;
unsafe fn is_destroyed(&self, destroyed: *mut BOOL) -> HRESULT; }
Expand description

WebView2Frame provides direct access to the iframes information.

Required methods

The name of the iframe from the iframe html tag declaring it. Calling this method fails if it is called after the iframe is destroyed.

Raised when the iframe changes its window.name property.

Remove an event handler previously added with add_NameChanged.

Add the provided host object to script running in the iframe with the specified name for the list of the specified origins. The host object will be accessible for this iframe only if the iframe’s origin during access matches one of the origins which are passed. The provided origins will be normalized before comparing to the origin of the document. So the scheme name is made lower case, the host will be punycode decoded as appropriate, default port values will be removed, and so on. This means the origin’s host may be punycode encoded or not and will match regardless. If list contains malformed origin the call will fail. The method can be called multiple times in a row without calling RemoveHostObjectFromScript for the same object name. It will replace the previous object with the new object and new list of origins. List of origins will be treated as following:

  1. empty list - call will succeed and object will be added for the iframe but it will not be exposed to any origin;
  2. list with origins - during access to host object from iframe the origin will be checked that it belongs to this list;
  3. list with “*” element - host object will be available for iframe for all origins. We suggest not to use this feature without understanding security implications of giving access to host object from from iframes with unknown origins. Calling this method fails if it is called after the iframe is destroyed. \snippet ScenarioAddHostObject.cpp AddHostObjectToScriptWithOrigins For more information about host objects navigate to ICoreWebView2::AddHostObjectToScript.

Remove the host object specified by the name so that it is no longer accessible from JavaScript code in the iframe. While new access attempts are denied, if the object is already obtained by JavaScript code in the iframe, the JavaScript code continues to have access to that object. Calling this method for a name that is already removed or was never added fails. If the iframe is destroyed this method will return fail also.

The Destroyed event is raised when the iframe corresponding to this CoreWebView2Frame object is removed or the document containing that iframe is destroyed.

Remove an event handler previously added with add_Destroyed.

Check whether a frame is destroyed. Returns true during the Destroyed event.

Trait Implementations

A COM compatible V-Table

The interface that this interface inherits from

The associated id for this interface

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

Get the vtable for a particular COM interface

Implementations on Foreign Types

Implementors