UCefView
Loading...
Searching...
No Matches
FSlateCefContext

Manages the Chromium Embedded Framework (CEF) context for Slate-based UI components. Provides global resource mapping, cookie management, and cross-origin whitelist control for all SCefView instances created in the application. More...

#include <SlateCefContext.h>

Public Member Functions

 ~FSlateCefContext ()
 Destructor. Cleans up and releases all resources held by the CEF context.
 
void AddLocalFolderResource (const FString &InPath, const FString &InUrl, int32 InPriority=0)
 Adds a URL mapping for a local web resource directory. All subsequently created SCefView instances will be able to access resources in this directory via the specified URL.
 
void AddArchiveFileResource (const FString &InPath, const FString &InUrl, const FString &InPassword, int32 InPriority=0)
 Adds a URL mapping for a local archive (.zip) file containing web resources. All subsequently created SCefView instances will be able to access resources in this archive via the specified URL.
 
bool AddCookie (const FString &InName, const FString &InValue, const FString &InDomain, const FString &InUrl)
 Adds a cookie to the CEF context. The cookie will be accessible from all browsers created with this context.
 
bool DeleteAllCookies ()
 Deletes all cookies from the CEF context.
 
bool AddCrossOriginWhitelistEntry (const FString &InSourceOrigin, const FString &InTargetSchema, const FString &InTargetDomain, bool InAllowTargetSubdomains)
 Adds an entry to the cross-origin access whitelist, allowing requests from a source origin to a target domain/schema. For more details, see: https://github.com/chromiumembedded/cef/blob/605c2bac86415dcec1e2902cdc46dc11c1ad026a/include/cef_origin_whitelist.h#L81C23-L81C23.
 
bool RemoveCrossOriginWhitelistEntry (const FString &InSourceOrigin, const FString &InTargetSchema, const FString &InTargetDomain, bool InAllowTargetSubdomains)
 Removes an entry from the cross-origin access whitelist. For more details, see: https://github.com/chromiumembedded/cef/blob/605c2bac86415dcec1e2902cdc46dc11c1ad026a/include/cef_origin_whitelist.h#L91C12-L91C12.
 
void ClearCrossOriginWhitelistEntry ()
 Removes all entries from the cross-origin access whitelist for the current context.
 

Static Public Member Functions

static void Create (const FSlateCefSettings &InSettings)
 Creates and initializes the global CEF context with the specified settings. If a context already exists, this call has no effect.
 
static void Shutdown ()
 Shuts down and destroys the global CEF context, releasing all associated resources. After shutdown, the context must be re-created before use.
 
static bool IsInitialized ()
 Checks if the CEF context has been initialized and is available for use.
 
static FSlateCefContextGet ()
 Gets a reference to the current global CEF context instance. Throws if the context is not initialized.
 

Detailed Description

Manages the Chromium Embedded Framework (CEF) context for Slate-based UI components. Provides global resource mapping, cookie management, and cross-origin whitelist control for all SCefView instances created in the application.

Constructor & Destructor Documentation

◆ ~FSlateCefContext()

FSlateCefContext::~FSlateCefContext ( )

Destructor. Cleans up and releases all resources held by the CEF context.

Member Function Documentation

◆ AddArchiveFileResource()

void FSlateCefContext::AddArchiveFileResource ( const FString & InPath,
const FString & InUrl,
const FString & InPassword,
int32 InPriority = 0 )

Adds a URL mapping for a local archive (.zip) file containing web resources. All subsequently created SCefView instances will be able to access resources in this archive via the specified URL.

Parameters
InPathThe absolute path to the local archive file.
InUrlThe virtual URL to map to the archive (e.g., "http://archive/").
InPasswordThe password required to access the archive, if any.
InPriorityThe priority of the mapping. Higher values take precedence. Default is 0.

◆ AddCookie()

bool FSlateCefContext::AddCookie ( const FString & InName,
const FString & InValue,
const FString & InDomain,
const FString & InUrl )

Adds a cookie to the CEF context. The cookie will be accessible from all browsers created with this context.

Parameters
InNameThe name of the cookie.
InValueThe value of the cookie.
InDomainThe domain to which the cookie applies.
InUrlThe URL to which the cookie applies.
Returns
True if the cookie was successfully added; otherwise, false.

◆ AddCrossOriginWhitelistEntry()

bool FSlateCefContext::AddCrossOriginWhitelistEntry ( const FString & InSourceOrigin,
const FString & InTargetSchema,
const FString & InTargetDomain,
bool InAllowTargetSubdomains )

Adds an entry to the cross-origin access whitelist, allowing requests from a source origin to a target domain/schema. For more details, see: https://github.com/chromiumembedded/cef/blob/605c2bac86415dcec1e2902cdc46dc11c1ad026a/include/cef_origin_whitelist.h#L81C23-L81C23.

Parameters
InSourceOriginThe source origin (e.g., "http://example.com").
InTargetSchemaThe target schema (e.g., "http").
InTargetDomainThe target domain (e.g., "target.com").
InAllowTargetSubdomainsTrue to allow subdomains of the target domain; otherwise, false.
Returns
True if the whitelist entry was successfully added; otherwise, false.

◆ AddLocalFolderResource()

void FSlateCefContext::AddLocalFolderResource ( const FString & InPath,
const FString & InUrl,
int32 InPriority = 0 )

Adds a URL mapping for a local web resource directory. All subsequently created SCefView instances will be able to access resources in this directory via the specified URL.

Parameters
InPathThe absolute path to the local resource directory.
InUrlThe virtual URL to map to the directory (e.g., "http://local/").
InPriorityThe priority of the mapping. Higher values take precedence. Default is 0.

◆ ClearCrossOriginWhitelistEntry()

void FSlateCefContext::ClearCrossOriginWhitelistEntry ( )

Removes all entries from the cross-origin access whitelist for the current context.

◆ Create()

static void FSlateCefContext::Create ( const FSlateCefSettings & InSettings)
static

Creates and initializes the global CEF context with the specified settings. If a context already exists, this call has no effect.

Parameters
InSettingsCEF context settings to use for initialization.

◆ DeleteAllCookies()

bool FSlateCefContext::DeleteAllCookies ( )

Deletes all cookies from the CEF context.

Returns
True if all cookies were successfully deleted; otherwise, false.

◆ Get()

static FSlateCefContext & FSlateCefContext::Get ( )
static

Gets a reference to the current global CEF context instance. Throws if the context is not initialized.

Returns
Reference to the current FSlateCefContext.

◆ IsInitialized()

static bool FSlateCefContext::IsInitialized ( )
static

Checks if the CEF context has been initialized and is available for use.

Returns
True if the context is initialized; otherwise, false.

◆ RemoveCrossOriginWhitelistEntry()

bool FSlateCefContext::RemoveCrossOriginWhitelistEntry ( const FString & InSourceOrigin,
const FString & InTargetSchema,
const FString & InTargetDomain,
bool InAllowTargetSubdomains )

Removes an entry from the cross-origin access whitelist. For more details, see: https://github.com/chromiumembedded/cef/blob/605c2bac86415dcec1e2902cdc46dc11c1ad026a/include/cef_origin_whitelist.h#L91C12-L91C12.

Parameters
InSourceOriginThe source origin (e.g., "http://example.com").
InTargetSchemaThe target schema (e.g., "http").
InTargetDomainThe target domain (e.g., "target.com").
InAllowTargetSubdomainsTrue to allow subdomains of the target domain; otherwise, false.
Returns
True if the whitelist entry was successfully removed; otherwise, false.

◆ Shutdown()

static void FSlateCefContext::Shutdown ( )
static

Shuts down and destroys the global CEF context, releasing all associated resources. After shutdown, the context must be re-created before use.