#[repr(C)]pub struct _cef_resource_handler_t {
pub base: cef_base_ref_counted_t,
pub open: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t, request: *mut _cef_request_t, handle_request: *mut c_int, callback: *mut _cef_callback_t) -> c_int>,
pub process_request: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t, request: *mut _cef_request_t, callback: *mut _cef_callback_t) -> c_int>,
pub get_response_headers: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t, response: *mut _cef_response_t, response_length: *mut i64, redirectUrl: *mut cef_string_t)>,
pub skip: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t, bytes_to_skip: i64, bytes_skipped: *mut i64, callback: *mut _cef_resource_skip_callback_t) -> c_int>,
pub read: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t, data_out: *mut c_void, bytes_to_read: c_int, bytes_read: *mut c_int, callback: *mut _cef_resource_read_callback_t) -> c_int>,
pub read_response: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t, data_out: *mut c_void, bytes_to_read: c_int, bytes_read: *mut c_int, callback: *mut _cef_callback_t) -> c_int>,
pub cancel: Option<unsafe extern "C" fn(self_: *mut _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.
Fields§
§base: cef_base_ref_counted_tBase structure.
open: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t, request: *mut _cef_request_t, handle_request: *mut c_int, callback: *mut _cef_callback_t) -> c_int>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(self_: *mut _cef_resource_handler_t, request: *mut _cef_request_t, callback: *mut _cef_callback_t) -> c_int>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(self_: *mut _cef_resource_handler_t, response: *mut _cef_response_t, response_length: *mut i64, redirectUrl: *mut cef_string_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(self_: *mut _cef_resource_handler_t, bytes_to_skip: i64, bytes_skipped: *mut i64, callback: *mut _cef_resource_skip_callback_t) -> c_int>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(self_: *mut _cef_resource_handler_t, data_out: *mut c_void, bytes_to_read: c_int, bytes_read: *mut c_int, callback: *mut _cef_resource_read_callback_t) -> c_int>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(self_: *mut _cef_resource_handler_t, data_out: *mut c_void, bytes_to_read: c_int, bytes_read: *mut c_int, callback: *mut _cef_callback_t) -> c_int>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(self_: *mut _cef_resource_handler_t)>Request processing has been canceled.
Trait Implementations§
Source§impl Clone for _cef_resource_handler_t
impl Clone for _cef_resource_handler_t
Source§fn clone(&self) -> _cef_resource_handler_t
fn clone(&self) -> _cef_resource_handler_t
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more