cef_download_handler_t

Type Alias cef_download_handler_t 

Source
pub type cef_download_handler_t = _cef_download_handler_t;
Expand description

Structure used to handle file downloads. The functions of this structure will called on the browser process UI thread.

NOTE: This struct is allocated client-side.

Aliased Type§

#[repr(C)]
pub struct cef_download_handler_t { pub base: _cef_base_ref_counted_t, pub can_download: Option<unsafe extern "C" fn(*mut _cef_download_handler_t, *mut _cef_browser_t, *const _cef_string_utf16_t, *const _cef_string_utf16_t) -> i32>, pub on_before_download: Option<unsafe extern "C" fn(*mut _cef_download_handler_t, *mut _cef_browser_t, *mut _cef_download_item_t, *const _cef_string_utf16_t, *mut _cef_before_download_callback_t) -> i32>, pub on_download_updated: Option<unsafe extern "C" fn(*mut _cef_download_handler_t, *mut _cef_browser_t, *mut _cef_download_item_t, *mut _cef_download_item_callback_t)>, }

Fields§

§base: _cef_base_ref_counted_t

Base structure.

§can_download: Option<unsafe extern "C" fn(*mut _cef_download_handler_t, *mut _cef_browser_t, *const _cef_string_utf16_t, *const _cef_string_utf16_t) -> i32>

Called before a download begins in response to a user-initiated action (e.g. alt + link click or link click that returns a Content-Disposition: attachment response from the server). |url| is the target download URL and |request_function| is the target function (GET, POST, etc). Return true (1) to proceed with the download or false (0) to cancel the download.

§on_before_download: Option<unsafe extern "C" fn(*mut _cef_download_handler_t, *mut _cef_browser_t, *mut _cef_download_item_t, *const _cef_string_utf16_t, *mut _cef_before_download_callback_t) -> i32>

Called before a download begins. |suggested_name| is the suggested name for the download file. Return true (1) and execute |callback| either asynchronously or in this function to continue or cancel the download. Return false (0) to proceed with default handling (cancel with Alloy style, download shelf with Chrome style). Do not keep a reference to |download_item| outside of this function.

§on_download_updated: Option<unsafe extern "C" fn(*mut _cef_download_handler_t, *mut _cef_browser_t, *mut _cef_download_item_t, *mut _cef_download_item_callback_t)>

Called when a download’s status or progress information has been updated. This may be called multiple times before and after on_before_download(). Execute |callback| either asynchronously or in this function to cancel the download if desired. Do not keep a reference to |download_item| outside of this function.