_cef_request_context_t

Struct _cef_request_context_t 

Source
#[repr(C)]
pub struct _cef_request_context_t {
Show 23 fields pub base: cef_preference_manager_t, pub is_same: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, other: *mut _cef_request_context_t) -> c_int>, pub is_sharing_with: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, other: *mut _cef_request_context_t) -> c_int>, pub is_global: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t) -> c_int>, pub get_handler: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t) -> *mut _cef_request_context_handler_t>, pub get_cache_path: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t) -> cef_string_userfree_t>, pub get_cookie_manager: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, callback: *mut _cef_completion_callback_t) -> *mut _cef_cookie_manager_t>, pub register_scheme_handler_factory: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, scheme_name: *const cef_string_t, domain_name: *const cef_string_t, factory: *mut _cef_scheme_handler_factory_t) -> c_int>, pub clear_scheme_handler_factories: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t) -> c_int>, pub clear_certificate_exceptions: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, callback: *mut _cef_completion_callback_t)>, pub clear_http_auth_credentials: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, callback: *mut _cef_completion_callback_t)>, pub close_all_connections: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, callback: *mut _cef_completion_callback_t)>, pub resolve_host: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, origin: *const cef_string_t, callback: *mut _cef_resolve_callback_t)>, pub load_extension: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, root_directory: *const cef_string_t, manifest: *mut _cef_dictionary_value_t, handler: *mut _cef_extension_handler_t)>, pub did_load_extension: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, extension_id: *const cef_string_t) -> c_int>, pub has_extension: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, extension_id: *const cef_string_t) -> c_int>, pub get_extensions: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, extension_ids: cef_string_list_t) -> c_int>, pub get_extension: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, extension_id: *const cef_string_t) -> *mut _cef_extension_t>, pub get_media_router: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, callback: *mut _cef_completion_callback_t) -> *mut _cef_media_router_t>, pub get_website_setting: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, requesting_url: *const cef_string_t, top_level_url: *const cef_string_t, content_type: cef_content_setting_types_t) -> *mut _cef_value_t>, pub set_website_setting: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, requesting_url: *const cef_string_t, top_level_url: *const cef_string_t, content_type: cef_content_setting_types_t, value: *mut _cef_value_t)>, pub get_content_setting: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, requesting_url: *const cef_string_t, top_level_url: *const cef_string_t, content_type: cef_content_setting_types_t) -> cef_content_setting_values_t>, pub set_content_setting: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, requesting_url: *const cef_string_t, top_level_url: *const cef_string_t, content_type: cef_content_setting_types_t, value: cef_content_setting_values_t)>,
}
Expand description

A request context provides request handling for a set of related browser or URL request objects. A request context can be specified when creating a new browser via the cef_browser_host_t static factory functions or when creating a new URL request via the cef_urlrequest_t static factory functions. Browser objects with different request contexts will never be hosted in the same render process. Browser objects with the same request context may or may not be hosted in the same render process depending on the process model. Browser objects created indirectly via the JavaScript window.open function or targeted links will share the same render process and the same request context as the source browser. When running in single-process mode there is only a single render process (the main process) and so all browsers created in single-process mode will share the same request context. This will be the first request context passed into a cef_browser_host_t static factory function and all other request context objects will be ignored.

Fields§

§base: cef_preference_manager_t

Base structure.

§is_same: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, other: *mut _cef_request_context_t) -> c_int>

Returns true (1) if this object is pointing to the same context as |that| object.

§is_sharing_with: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, other: *mut _cef_request_context_t) -> c_int>

Returns true (1) if this object is sharing the same storage as |that| object.

§is_global: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t) -> c_int>

Returns true (1) if this object is the global context. The global context is used by default when creating a browser or URL request with a NULL context argument.

§get_handler: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t) -> *mut _cef_request_context_handler_t>

Returns the handler for this context if any.

§get_cache_path: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t) -> cef_string_userfree_t>

Returns the cache path for this object. If NULL an “incognito mode” in- memory cache is being used.

§get_cookie_manager: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, callback: *mut _cef_completion_callback_t) -> *mut _cef_cookie_manager_t>

Returns the cookie manager for this object. If |callback| is non-NULL it will be executed asnychronously on the UI thread after the manager’s storage has been initialized.

§register_scheme_handler_factory: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, scheme_name: *const cef_string_t, domain_name: *const cef_string_t, factory: *mut _cef_scheme_handler_factory_t) -> c_int>

Register a scheme handler factory for the specified |scheme_name| and optional |domain_name|. An NULL |domain_name| value for a standard scheme will cause the factory to match all domain names. The |domain_name| value will be ignored for non-standard schemes. If |scheme_name| is a built-in scheme and no handler is returned by |factory| then the built-in scheme handler factory will be called. If |scheme_name| is a custom scheme then you must also implement the cef_app_t::on_register_custom_schemes() function in all processes. This function may be called multiple times to change or remove the factory that matches the specified |scheme_name| and optional |domain_name|. Returns false (0) if an error occurs. This function may be called on any thread in the browser process.

§clear_scheme_handler_factories: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t) -> c_int>

Clear all registered scheme handler factories. Returns false (0) on error. This function may be called on any thread in the browser process.

§clear_certificate_exceptions: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, callback: *mut _cef_completion_callback_t)>

Clears all certificate exceptions that were added as part of handling cef_request_handler_t::on_certificate_error(). If you call this it is recommended that you also call close_all_connections() or you risk not being prompted again for server certificates if you reconnect quickly. If |callback| is non-NULL it will be executed on the UI thread after completion.

§clear_http_auth_credentials: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, callback: *mut _cef_completion_callback_t)>

Clears all HTTP authentication credentials that were added as part of handling GetAuthCredentials. If |callback| is non-NULL it will be executed on the UI thread after completion.

§close_all_connections: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, callback: *mut _cef_completion_callback_t)>

Clears all active and idle connections that Chromium currently has. This is only recommended if you have released all other CEF objects but don’t yet want to call cef_shutdown(). If |callback| is non-NULL it will be executed on the UI thread after completion.

§resolve_host: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, origin: *const cef_string_t, callback: *mut _cef_resolve_callback_t)>

Attempts to resolve |origin| to a list of associated IP addresses. |callback| will be executed on the UI thread after completion.

§load_extension: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, root_directory: *const cef_string_t, manifest: *mut _cef_dictionary_value_t, handler: *mut _cef_extension_handler_t)>

Load an extension.

If extension resources will be read from disk using the default load implementation then |root_directory| should be the absolute path to the extension resources directory and |manifest| should be NULL. If extension resources will be provided by the client (e.g. via cef_request_handler_t and/or cef_extension_handler_t) then |root_directory| should be a path component unique to the extension (if not absolute this will be internally prefixed with the PK_DIR_RESOURCES path) and |manifest| should contain the contents that would otherwise be read from the “manifest.json” file on disk.

The loaded extension will be accessible in all contexts sharing the same storage (HasExtension returns true (1)). However, only the context on which this function was called is considered the loader (DidLoadExtension returns true (1)) and only the loader will receive cef_request_context_handler_t callbacks for the extension.

cef_extension_handler_t::OnExtensionLoaded will be called on load success or cef_extension_handler_t::OnExtensionLoadFailed will be called on load failure.

If the extension specifies a background script via the “background” manifest key then cef_extension_handler_t::OnBeforeBackgroundBrowser will be called to create the background browser. See that function for additional information about background scripts.

For visible extension views the client application should evaluate the manifest to determine the correct extension URL to load and then pass that URL to the cef_browser_host_t::CreateBrowser* function after the extension has loaded. For example, the client can look for the “browser_action” manifest key as documented at https://developer.chrome.com/extensions/browserAction. Extension URLs take the form “chrome-extension://<extension_id>/”.

Browsers that host extensions differ from normal browsers as follows:

  • Can access chrome.* JavaScript APIs if allowed by the manifest. Visit chrome://extensions-support for the list of extension APIs currently supported by CEF.
  • Main frame navigation to non-extension content is blocked.
  • Pinch-zooming is disabled.
  • CefBrowserHost::GetExtension returns the hosted extension.
  • CefBrowserHost::IsBackgroundHost returns true for background hosts.

See https://developer.chrome.com/extensions for extension implementation and usage documentation.

§did_load_extension: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, extension_id: *const cef_string_t) -> c_int>

Returns true (1) if this context was used to load the extension identified by |extension_id|. Other contexts sharing the same storage will also have access to the extension (see HasExtension). This function must be called on the browser process UI thread.

§has_extension: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, extension_id: *const cef_string_t) -> c_int>

Returns true (1) if this context has access to the extension identified by |extension_id|. This may not be the context that was used to load the extension (see DidLoadExtension). This function must be called on the browser process UI thread.

§get_extensions: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, extension_ids: cef_string_list_t) -> c_int>

Retrieve the list of all extensions that this context has access to (see HasExtension). |extension_ids| will be populated with the list of extension ID values. Returns true (1) on success. This function must be called on the browser process UI thread.

§get_extension: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, extension_id: *const cef_string_t) -> *mut _cef_extension_t>

Returns the extension matching |extension_id| or NULL if no matching extension is accessible in this context (see HasExtension). This function must be called on the browser process UI thread.

§get_media_router: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, callback: *mut _cef_completion_callback_t) -> *mut _cef_media_router_t>

Returns the MediaRouter object associated with this context. If |callback| is non-NULL it will be executed asnychronously on the UI thread after the manager’s context has been initialized.

§get_website_setting: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, requesting_url: *const cef_string_t, top_level_url: *const cef_string_t, content_type: cef_content_setting_types_t) -> *mut _cef_value_t>

Returns the current value for |content_type| that applies for the specified URLs. If both URLs are NULL the default value will be returned. Returns nullptr if no value is configured. Must be called on the browser process UI thread.

§set_website_setting: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, requesting_url: *const cef_string_t, top_level_url: *const cef_string_t, content_type: cef_content_setting_types_t, value: *mut _cef_value_t)>

Sets the current value for |content_type| for the specified URLs in the default scope. If both URLs are NULL, and the context is not incognito, the default value will be set. Pass nullptr for |value| to remove the default value for this content type.

WARNING: Incorrect usage of this function may cause instability or security issues in Chromium. Make sure that you first understand the potential impact of any changes to |content_type| by reviewing the related source code in Chromium. For example, if you plan to modify CEF_CONTENT_SETTING_TYPE_POPUPS, first review and understand the usage of ContentSettingsType::POPUPS in Chromium: https://source.chromium.org/search?q=ContentSettingsType::POPUPS

§get_content_setting: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, requesting_url: *const cef_string_t, top_level_url: *const cef_string_t, content_type: cef_content_setting_types_t) -> cef_content_setting_values_t>

Returns the current value for |content_type| that applies for the specified URLs. If both URLs are NULL the default value will be returned. Returns CEF_CONTENT_SETTING_VALUE_DEFAULT if no value is configured. Must be called on the browser process UI thread.

§set_content_setting: Option<unsafe extern "C" fn(self_: *mut _cef_request_context_t, requesting_url: *const cef_string_t, top_level_url: *const cef_string_t, content_type: cef_content_setting_types_t, value: cef_content_setting_values_t)>

Sets the current value for |content_type| for the specified URLs in the default scope. If both URLs are NULL, and the context is not incognito, the default value will be set. Pass CEF_CONTENT_SETTING_VALUE_DEFAULT for |value| to use the default value for this content type.

WARNING: Incorrect usage of this function may cause instability or security issues in Chromium. Make sure that you first understand the potential impact of any changes to |content_type| by reviewing the related source code in Chromium. For example, if you plan to modify CEF_CONTENT_SETTING_TYPE_POPUPS, first review and understand the usage of ContentSettingsType::POPUPS in Chromium: https://source.chromium.org/search?q=ContentSettingsType::POPUPS

Trait Implementations§

Source§

impl Clone for _cef_request_context_t

Source§

fn clone(&self) -> _cef_request_context_t

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for _cef_request_context_t

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for _cef_request_context_t

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.