pub trait ICoreWebView2_4: ICoreWebView2_3 {
// Required methods
unsafe fn add_frame_created(
&self,
event_handler: *mut *mut ICoreWebView2FrameCreatedEventHandlerVTable,
token: *mut EventRegistrationToken,
) -> HRESULT;
unsafe fn remove_frame_created(
&self,
token: EventRegistrationToken,
) -> HRESULT;
unsafe fn add_download_starting(
&self,
event_handler: *mut *mut ICoreWebView2DownloadStartingEventHandlerVTable,
token: *mut EventRegistrationToken,
) -> HRESULT;
unsafe fn remove_download_starting(
&self,
token: EventRegistrationToken,
) -> HRESULT;
}Expand description
A continuation of the ICoreWebView2_3 interface to support FrameCreated and DownloadStarting events.
Required Methods§
Sourceunsafe fn add_frame_created(
&self,
event_handler: *mut *mut ICoreWebView2FrameCreatedEventHandlerVTable,
token: *mut EventRegistrationToken,
) -> HRESULT
unsafe fn add_frame_created( &self, event_handler: *mut *mut ICoreWebView2FrameCreatedEventHandlerVTable, token: *mut EventRegistrationToken, ) -> HRESULT
Raised when a new iframe is created. Use the CoreWebView2Frame.add_Destroyed to listen for when this iframe goes away.
Sourceunsafe fn remove_frame_created(&self, token: EventRegistrationToken) -> HRESULT
unsafe fn remove_frame_created(&self, token: EventRegistrationToken) -> HRESULT
Remove an event handler previously added with add_FrameCreated.
Sourceunsafe fn add_download_starting(
&self,
event_handler: *mut *mut ICoreWebView2DownloadStartingEventHandlerVTable,
token: *mut EventRegistrationToken,
) -> HRESULT
unsafe fn add_download_starting( &self, event_handler: *mut *mut ICoreWebView2DownloadStartingEventHandlerVTable, token: *mut EventRegistrationToken, ) -> HRESULT
Add an event handler for the DownloadStarting event. This event is
raised when a download has begun, blocking the default download dialog,
but not blocking the progress of the download.
The host can choose to cancel a download, change the result file path,
and hide the default download dialog.
If the host chooses to cancel the download, the download is not saved, no
dialog is shown, and the state is changed to
COREWEBVIEW2_DOWNLOAD_STATE_INTERRUPTED with interrupt reason
COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_USER_CANCELED. Otherwise, the
download is saved to the default path after the event completes,
and default download dialog is shown if the host did not choose to hide it.
The host can change the visibility of the download dialog using the
Handled property. If the event is not handled, downloads complete
normally with the default dialog shown.
\snippet ScenarioCustomDownloadExperience.cpp DownloadStarting
Sourceunsafe fn remove_download_starting(
&self,
token: EventRegistrationToken,
) -> HRESULT
unsafe fn remove_download_starting( &self, token: EventRegistrationToken, ) -> HRESULT
Remove an event handler previously added with add_DownloadStarting.