pub type cef_resource_handler_t = _cef_resource_handler_t;Expand description
Structure used to implement a custom request handler structure. The functions of this structure will be called on the IO thread unless otherwise indicated.
NOTE: This struct is allocated client-side.
Aliased Type§
#[repr(C)]pub struct cef_resource_handler_t {
pub base: _cef_base_ref_counted_t,
pub open: Option<unsafe extern "C" fn(*mut _cef_resource_handler_t, *mut _cef_request_t, *mut i32, *mut _cef_callback_t) -> i32>,
pub process_request: Option<unsafe extern "C" fn(*mut _cef_resource_handler_t, *mut _cef_request_t, *mut _cef_callback_t) -> i32>,
pub get_response_headers: Option<unsafe extern "C" fn(*mut _cef_resource_handler_t, *mut _cef_response_t, *mut i64, *mut _cef_string_utf16_t)>,
pub skip: Option<unsafe extern "C" fn(*mut _cef_resource_handler_t, i64, *mut i64, *mut _cef_resource_skip_callback_t) -> i32>,
pub read: Option<unsafe extern "C" fn(*mut _cef_resource_handler_t, *mut c_void, i32, *mut i32, *mut _cef_resource_read_callback_t) -> i32>,
pub read_response: Option<unsafe extern "C" fn(*mut _cef_resource_handler_t, *mut c_void, i32, *mut i32, *mut _cef_callback_t) -> i32>,
pub cancel: Option<unsafe extern "C" fn(*mut _cef_resource_handler_t)>,
}Fields§
§base: _cef_base_ref_counted_tBase structure.
open: Option<unsafe extern "C" fn(*mut _cef_resource_handler_t, *mut _cef_request_t, *mut i32, *mut _cef_callback_t) -> i32>Open the response stream. To handle the request immediately set |handle_request| to true (1) and return true (1). To decide at a later time set |handle_request| to false (0), return true (1), and execute |callback| to continue or cancel the request. To cancel the request immediately set |handle_request| to true (1) and return false (0). This function will be called in sequence but not from a dedicated thread. For backwards compatibility set |handle_request| to false (0) and return false (0) and the ProcessRequest function will be called.
process_request: Option<unsafe extern "C" fn(*mut _cef_resource_handler_t, *mut _cef_request_t, *mut _cef_callback_t) -> i32>Begin processing the request. To handle the request return true (1) and call cef_callback_t::cont() once the response header information is available (cef_callback_t::cont() can also be called from inside this function if header information is available immediately). To cancel the request return false (0).
WARNING: This function is deprecated. Use Open instead.
get_response_headers: Option<unsafe extern "C" fn(*mut _cef_resource_handler_t, *mut _cef_response_t, *mut i64, *mut _cef_string_utf16_t)>Retrieve response header information. If the response length is not known set |response_length| to -1 and read_response() will be called until it returns false (0). If the response length is known set |response_length| to a positive value and read_response() will be called until it returns false (0) or the specified number of bytes have been read. Use the |response| object to set the mime type, http status code and other optional header values. To redirect the request to a new URL set |redirectUrl| to the new URL. |redirectUrl| can be either a relative or fully qualified URL. It is also possible to set |response| to a redirect http status code and pass the new URL via a Location header. Likewise with |redirectUrl| it is valid to set a relative or fully qualified URL as the Location header value. If an error occured while setting up the request you can call set_error() on |response| to indicate the error condition.
skip: Option<unsafe extern "C" fn(*mut _cef_resource_handler_t, i64, *mut i64, *mut _cef_resource_skip_callback_t) -> i32>Skip response data when requested by a Range header. Skip over and discard |bytes_to_skip| bytes of response data. If data is available immediately set |bytes_skipped| to the number of bytes skipped and return true (1). To read the data at a later time set |bytes_skipped| to 0, return true (1) and execute |callback| when the data is available. To indicate failure set |bytes_skipped| to < 0 (e.g. -2 for ERR_FAILED) and return false (0). This function will be called in sequence but not from a dedicated thread.
read: Option<unsafe extern "C" fn(*mut _cef_resource_handler_t, *mut c_void, i32, *mut i32, *mut _cef_resource_read_callback_t) -> i32>Read response data. If data is available immediately copy up to |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of bytes copied, and return true (1). To read the data at a later time keep a pointer to |data_out|, set |bytes_read| to 0, return true (1) and execute |callback| when the data is available (|data_out| will remain valid until the callback is executed). To indicate response completion set |bytes_read| to 0 and return false (0). To indicate failure set |bytes_read| to < 0 (e.g. -2 for ERR_FAILED) and return false (0). This function will be called in sequence but not from a dedicated thread. For backwards compatibility set |bytes_read| to -1 and return false (0) and the ReadResponse function will be called.
read_response: Option<unsafe extern "C" fn(*mut _cef_resource_handler_t, *mut c_void, i32, *mut i32, *mut _cef_callback_t) -> i32>Read response data. If data is available immediately copy up to |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of bytes copied, and return true (1). To read the data at a later time set |bytes_read| to 0, return true (1) and call cef_callback_t::cont() when the data is available. To indicate response completion return false (0).
WARNING: This function is deprecated. Use Skip and Read instead.
cancel: Option<unsafe extern "C" fn(*mut _cef_resource_handler_t)>Request processing has been canceled.