pub trait ICoreWebView2DownloadOperation: IUnknown {
Show 19 methods
// Required methods
unsafe fn add_bytes_received_changed(
&self,
event_handler: *mut *mut ICoreWebView2BytesReceivedChangedEventHandlerVTable,
token: *mut EventRegistrationToken,
) -> HRESULT;
unsafe fn remove_bytes_received_changed(
&self,
token: EventRegistrationToken,
) -> HRESULT;
unsafe fn add_estimated_end_time_changed(
&self,
event_handler: *mut *mut ICoreWebView2EstimatedEndTimeChangedEventHandlerVTable,
token: *mut EventRegistrationToken,
) -> HRESULT;
unsafe fn remove_estimated_end_time_changed(
&self,
token: EventRegistrationToken,
) -> HRESULT;
unsafe fn add_state_changed(
&self,
event_handler: *mut *mut ICoreWebView2StateChangedEventHandlerVTable,
token: *mut EventRegistrationToken,
) -> HRESULT;
unsafe fn remove_state_changed(
&self,
token: EventRegistrationToken,
) -> HRESULT;
unsafe fn get_uri(&self, uri: *mut LPWSTR) -> HRESULT;
unsafe fn get_content_disposition(
&self,
content_disposition: *mut LPWSTR,
) -> HRESULT;
unsafe fn get_mime_type(&self, mime_type: *mut LPWSTR) -> HRESULT;
unsafe fn get_total_bytes_to_receive(
&self,
total_bytes_to_receive: *mut i64,
) -> HRESULT;
unsafe fn get_bytes_received(&self, bytes_received: *mut i64) -> HRESULT;
unsafe fn get_estimated_end_time(
&self,
estimated_end_time: *mut LPWSTR,
) -> HRESULT;
unsafe fn get_result_file_path(
&self,
result_file_path: *mut LPWSTR,
) -> HRESULT;
unsafe fn get_state(&self, download_state: *mut DownloadState) -> HRESULT;
unsafe fn get_interrupt_reason(
&self,
interrupt_reason: *mut DownloadInterruptReason,
) -> HRESULT;
unsafe fn cancel(&self) -> HRESULT;
unsafe fn pause(&self) -> HRESULT;
unsafe fn resume(&self) -> HRESULT;
unsafe fn get_can_resume(&self, can_resume: *mut BOOL) -> HRESULT;
}Expand description
Represents a download operation. Gives access to the download’s metadata and supports a user canceling, pausing, or resuming the download.
Required Methods§
Sourceunsafe fn add_bytes_received_changed(
&self,
event_handler: *mut *mut ICoreWebView2BytesReceivedChangedEventHandlerVTable,
token: *mut EventRegistrationToken,
) -> HRESULT
unsafe fn add_bytes_received_changed( &self, event_handler: *mut *mut ICoreWebView2BytesReceivedChangedEventHandlerVTable, token: *mut EventRegistrationToken, ) -> HRESULT
Add an event handler for the BytesReceivedChanged event.
\snippet ScenarioCustomDownloadExperience.cpp BytesReceivedChanged
Sourceunsafe fn remove_bytes_received_changed(
&self,
token: EventRegistrationToken,
) -> HRESULT
unsafe fn remove_bytes_received_changed( &self, token: EventRegistrationToken, ) -> HRESULT
Remove an event handler previously added with add_BytesReceivedChanged.
Sourceunsafe fn add_estimated_end_time_changed(
&self,
event_handler: *mut *mut ICoreWebView2EstimatedEndTimeChangedEventHandlerVTable,
token: *mut EventRegistrationToken,
) -> HRESULT
unsafe fn add_estimated_end_time_changed( &self, event_handler: *mut *mut ICoreWebView2EstimatedEndTimeChangedEventHandlerVTable, token: *mut EventRegistrationToken, ) -> HRESULT
Add an event handler for the EstimatedEndTimeChanged event.
Sourceunsafe fn remove_estimated_end_time_changed(
&self,
token: EventRegistrationToken,
) -> HRESULT
unsafe fn remove_estimated_end_time_changed( &self, token: EventRegistrationToken, ) -> HRESULT
Remove an event handler previously added with add_EstimatedEndTimeChanged.
Sourceunsafe fn add_state_changed(
&self,
event_handler: *mut *mut ICoreWebView2StateChangedEventHandlerVTable,
token: *mut EventRegistrationToken,
) -> HRESULT
unsafe fn add_state_changed( &self, event_handler: *mut *mut ICoreWebView2StateChangedEventHandlerVTable, token: *mut EventRegistrationToken, ) -> HRESULT
Add an event handler for the StateChanged event.
\snippet ScenarioCustomDownloadExperience.cpp StateChanged
Sourceunsafe fn remove_state_changed(&self, token: EventRegistrationToken) -> HRESULT
unsafe fn remove_state_changed(&self, token: EventRegistrationToken) -> HRESULT
Remove an event handler previously added with add_StateChanged.
Sourceunsafe fn get_content_disposition(
&self,
content_disposition: *mut LPWSTR,
) -> HRESULT
unsafe fn get_content_disposition( &self, content_disposition: *mut LPWSTR, ) -> HRESULT
The Content-Disposition header value from the download’s HTTP response.
Sourceunsafe fn get_mime_type(&self, mime_type: *mut LPWSTR) -> HRESULT
unsafe fn get_mime_type(&self, mime_type: *mut LPWSTR) -> HRESULT
MIME type of the downloaded content.
Sourceunsafe fn get_total_bytes_to_receive(
&self,
total_bytes_to_receive: *mut i64,
) -> HRESULT
unsafe fn get_total_bytes_to_receive( &self, total_bytes_to_receive: *mut i64, ) -> HRESULT
The expected size of the download in total number of bytes based on the HTTP Content-Length header. Returns -1 if the size is unknown.
Sourceunsafe fn get_bytes_received(&self, bytes_received: *mut i64) -> HRESULT
unsafe fn get_bytes_received(&self, bytes_received: *mut i64) -> HRESULT
The number of bytes that have been written to the download file.
Sourceunsafe fn get_estimated_end_time(
&self,
estimated_end_time: *mut LPWSTR,
) -> HRESULT
unsafe fn get_estimated_end_time( &self, estimated_end_time: *mut LPWSTR, ) -> HRESULT
The estimated end time in ISO 8601 Date and Time Format.
Sourceunsafe fn get_result_file_path(&self, result_file_path: *mut LPWSTR) -> HRESULT
unsafe fn get_result_file_path(&self, result_file_path: *mut LPWSTR) -> HRESULT
The absolute path to the download file, including file name. Host can change
this from ICoreWebView2DownloadStartingEventArgs.
Sourceunsafe fn get_state(&self, download_state: *mut DownloadState) -> HRESULT
unsafe fn get_state(&self, download_state: *mut DownloadState) -> HRESULT
The state of the download. A download can be in progress, interrupted, or
completed. See COREWEBVIEW2_DOWNLOAD_STATE for descriptions of states.
Sourceunsafe fn get_interrupt_reason(
&self,
interrupt_reason: *mut DownloadInterruptReason,
) -> HRESULT
unsafe fn get_interrupt_reason( &self, interrupt_reason: *mut DownloadInterruptReason, ) -> HRESULT
The reason why connection with file host was broken.
Sourceunsafe fn cancel(&self) -> HRESULT
unsafe fn cancel(&self) -> HRESULT
Cancels the download. If canceled, the default download dialog shows
that the download was canceled. Host should set the Cancel property from
ICoreWebView2SDownloadStartingEventArgs if the download should be
canceled without displaying the default download dialog.
Sourceunsafe fn pause(&self) -> HRESULT
unsafe fn pause(&self) -> HRESULT
Pauses the download. If paused, the default download dialog shows that the
download is paused. No effect if download is already paused. Pausing a
download changes the state to COREWEBVIEW2_DOWNLOAD_STATE_INTERRUPTED
with InterruptReason set to COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_USER_PAUSED.
Sourceunsafe fn resume(&self) -> HRESULT
unsafe fn resume(&self) -> HRESULT
Resumes a paused download. May also resume a download that was interrupted
for another reason, if CanResume returns true. Resuming a download changes
the state from COREWEBVIEW2_DOWNLOAD_STATE_INTERRUPTED to
COREWEBVIEW2_DOWNLOAD_STATE_IN_PROGRESS.
Sourceunsafe fn get_can_resume(&self, can_resume: *mut BOOL) -> HRESULT
unsafe fn get_can_resume(&self, can_resume: *mut BOOL) -> HRESULT
Returns true if an interrupted download can be resumed. Downloads with
the following interrupt reasons may automatically resume without you
calling any methods:
COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE,
COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_FILE_HASH_MISMATCH,
COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_FILE_TOO_SHORT.
In these cases download progress may be restarted with BytesReceived
reset to 0.