# Class TCefRequestContextRef

Description
Hierarchy
Fields
Methods
Properties

## Unit

uCEFRequestContext

## Declaration

`type TCefRequestContextRef = class(TCefPreferenceManagerRef, ICefRequestContext)`

## 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.

## Hierarchy

- TInterfacedObject
- TCefBaseRefCountedRef
- TCefPreferenceManagerRef
- TCefRequestContextRef

## Overview

### Methods

| `function IsSame(const other: ICefRequestContext): Boolean;`
| `function IsSharingWith(const other: ICefRequestContext): Boolean;`
| `function IsGlobal: Boolean;`
| `function GetHandler: ICefRequestContextHandler;`
| `function GetCachePath: ustring;`
| `function GetCookieManager(const callback: ICefCompletionCallback): ICefCookieManager;`
| `function GetCookieManagerProc(const callback: TCefCompletionCallbackProc): ICefCookieManager;`
| `function RegisterSchemeHandlerFactory(const schemeName, domainName: ustring; const factory: ICefSchemeHandlerFactory): Boolean;`
| `function ClearSchemeHandlerFactories: Boolean;`
| `procedure ClearCertificateExceptions(const callback: ICefCompletionCallback);`
| `procedure ClearHttpAuthCredentials(const callback: ICefCompletionCallback);`
| `procedure CloseAllConnections(const callback: ICefCompletionCallback);`
| `procedure ResolveHost(const origin: ustring; const callback: ICefResolveCallback);`
| `function GetMediaRouter(const callback: ICefCompletionCallback): ICefMediaRouter;`
| `function GetWebsiteSetting(const requesting_url, top_level_url: ustring; content_type: TCefContentSettingTypes): ICefValue;`
| `procedure SetWebsiteSetting(const requesting_url, top_level_url: ustring; content_type: TCefContentSettingTypes; const value: ICefValue);`
| `function GetContentSetting(const requesting_url, top_level_url: ustring; content_type: TCefContentSettingTypes): TCefContentSettingValues;`
| `procedure SetContentSetting(const requesting_url, top_level_url: ustring; content_type: TCefContentSettingTypes; value: TCefContentSettingValues);`
| `procedure SetChromeColorScheme(variant: TCefColorVariant; user_color: TCefColor);`
| `function GetChromeColorSchemeMode: TCefColorVariant;`
| `function GetChromeColorSchemeColor: TCefColor;`
| `function GetChromeColorSchemeVariant: TCefColorVariant;`
| `function AddSettingObserver(const observer: ICefSettingObserver): ICefRegistration;`
| `class function UnWrap(data: Pointer): ICefRequestContext; reintroduce;`
| `class function Global: ICefRequestContext; reintroduce;`
| `class function New(const settings: PCefRequestContextSettings; const handler: ICefRequestContextHandler = nil): ICefRequestContext; overload;`
| `class function New(const aCache, aAcceptLanguageList, aCookieableSchemesList : ustring; aCookieableSchemesExcludeDefaults, aPersistSessionCookies : boolean; const handler: ICefRequestContextHandler = nil): ICefRequestContext; overload;`
| `class function Shared(const other: ICefRequestContext; const handler: ICefRequestContextHandler): ICefRequestContext;`

## Description

### Methods

| `function IsSame(const other: ICefRequestContext): Boolean;`
Returns true (1) if this object is pointing to the same context as |that| object.

| `function IsSharingWith(const other: ICefRequestContext): Boolean;`
Returns true (1) if this object is sharing the same storage as |that| object.

| `function IsGlobal: Boolean;`
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.

| `function GetHandler: ICefRequestContextHandler;`
Returns the handler for this context if any.

| `function GetCachePath: ustring;`
Returns the cache path for this object. If NULL an "incognito mode" in- memory cache is being used.

| `function GetCookieManager(const callback: ICefCompletionCallback): ICefCookieManager;`
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.

| `function GetCookieManagerProc(const callback: TCefCompletionCallbackProc): ICefCookieManager;`
This item has no description. Showing description inherited from ICefRequestContext.GetCookieManagerProc. 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.

| `function RegisterSchemeHandlerFactory(const schemeName, domainName: ustring; const factory: ICefSchemeHandlerFactory): Boolean;`
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.

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

| `procedure ClearCertificateExceptions(const callback: ICefCompletionCallback);`
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.

| `procedure ClearHttpAuthCredentials(const callback: ICefCompletionCallback);`
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.

| `procedure CloseAllConnections(const callback: ICefCompletionCallback);`
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.

| `procedure ResolveHost(const origin: ustring; const callback: ICefResolveCallback);`
Attempts to resolve |origin| to a list of associated IP addresses. |callback| will be executed on the UI thread after completion.

| `function GetMediaRouter(const callback: ICefCompletionCallback): ICefMediaRouter;`
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.

| `function GetWebsiteSetting(const requesting_url, top_level_url: ustring; content_type: TCefContentSettingTypes): ICefValue;`
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.

| `procedure SetWebsiteSetting(const requesting_url, top_level_url: ustring; content_type: TCefContentSettingTypes; const value: ICefValue);`
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

| `function GetContentSetting(const requesting_url, top_level_url: ustring; content_type: TCefContentSettingTypes): TCefContentSettingValues;`
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.

| `procedure SetContentSetting(const requesting_url, top_level_url: ustring; content_type: TCefContentSettingTypes; value: TCefContentSettingValues);`
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

| `procedure SetChromeColorScheme(variant: TCefColorVariant; user_color: TCefColor);`
Sets the Chrome color scheme for all browsers that share this request context. |variant| values of SYSTEM, LIGHT and DARK change the underlying color mode (e.g. light vs dark). Other |variant| values determine how |user_color| will be applied in the current color mode. If |user_color| is transparent (0) the default color will be used.

| `function GetChromeColorSchemeMode: TCefColorVariant;`
Returns the current Chrome color scheme mode (SYSTEM, LIGHT or DARK). Must be called on the browser process UI thread.

| `function GetChromeColorSchemeColor: TCefColor;`
Returns the current Chrome color scheme color, or transparent (0) for the default color. Must be called on the browser process UI thread.

| `function GetChromeColorSchemeVariant: TCefColorVariant;`
Returns the current Chrome color scheme variant. Must be called on the browser process UI thread.

| `function AddSettingObserver(const observer: ICefSettingObserver): ICefRegistration;`
Add an observer for content and website setting changes. The observer will remain registered until the returned Registration object is destroyed. This function must be called on the browser process UI thread.

| `class function UnWrap(data: Pointer): ICefRequestContext; reintroduce;`
This item has no description.

| `class function Global: ICefRequestContext; reintroduce;`
Returns the global context object.

| `class function New(const settings: PCefRequestContextSettings; const handler: ICefRequestContextHandler = nil): ICefRequestContext; overload;`
Creates a new context object with the specified |settings| and optional |handler|. ###### Parameters settings Pointer to TCefRequestContextSettings. handler Optional handler for the request context.

| `class function New(const aCache, aAcceptLanguageList, aCookieableSchemesList : ustring; aCookieableSchemesExcludeDefaults, aPersistSessionCookies : boolean; const handler: ICefRequestContextHandler = nil): ICefRequestContext; overload;`
Creates a new context object with the specified settings and optional |handler|. ###### Parameters aCache The directory where cache data for this request context will be stored on disk. See TCefRequestContextSettings.cache_path for more information. aAcceptLanguageList Comma delimited ordered list of language codes without any whitespace that will be used in the "Accept-Language" HTTP header. See TCefRequestContextSettings.accept_language_list for more information. aCookieableSchemesList Comma delimited list of schemes supported by the associated ICefCookieManager. See TCefRequestContextSettings.cookieable_schemes_list for more information. aCookieableSchemesExcludeDefaults Setting this parameter to true will disable all loading and saving of cookies. See TCefRequestContextSettings.cookieable_schemes_list for more information. aPersistSessionCookies To persist session cookies (cookies without an expiry date or validity interval) by default when using the global cookie manager set this value to true. See TCefRequestContextSettings.persist_session_cookies for more information. handler Optional handler for the request context.

| `class function Shared(const other: ICefRequestContext; const handler: ICefRequestContextHandler): ICefRequestContext;`
Creates a new context object that shares storage with |other| and uses an optional |handler|. ###### Parameters other Another ICefRequestContext instance that will share storage with the new ICefRequestContext instance. handler Optional handler for the request context.

Generated by PasDoc 0.16.0-snapshot.