QCefView
Loading...
Searching...
No Matches
QCefContext

Represents the CEF context. More...

#include <QCefContext.h>

Public Member Functions

 QCefContext (QCoreApplication *app, int argc, char **argv, const QCefConfig *config)
 Constructs the CEF context.
 
 ~QCefContext ()
 Destructs the CEF context.
 
void addLocalFolderResource (const QString &path, const QString &url, int priority=0)
 Adds a url mapping item with local web resource directory. This works for all QCefView instances created subsequently.
 
void addArchiveResource (const QString &path, const QString &url, const QString &password="", int priority=0)
 Adds a url mapping item with local archive (.zip) file which contains the web resource. This works for all QCefView instances created subsequently.
 
bool addCookie (const QString &name, const QString &value, const QString &domain, const QString &url)
 Adds a cookie to the CEF context, this cookie is accessible from all browsers created with this context.
 
bool deleteAllCookies ()
 Deletes all cookies from the CEF context.
 
bool addCrossOriginWhitelistEntry (const QString &sourceOrigin, const QString &targetSchema, const QString &targetDomain, bool allowTargetSubdomains)
 Adds an entry to the cross-origin access whitelist. For details please refer to: https://github.com/chromiumembedded/cef/blob/605c2bac86415dcec1e2902cdc46dc11c1ad026a/include/cef_origin_whitelist.h#L81C23-L81C23.
 
bool removeCrossOriginWhitelistEntry (const QString &sourceOrigin, const QString &targetSchema, const QString &targetDomain, bool allowTargetSubdomains)
 Removes an entry from the cross-origin access whitelist. For details please refer to: https://github.com/chromiumembedded/cef/blob/605c2bac86415dcec1e2902cdc46dc11c1ad026a/include/cef_origin_whitelist.h#L91C12-L91C12.
 
bool clearCrossOriginWhitelistEntry ()
 Removes all entries from the cross-origin access whitelist.
 
const QCefConfigcefConfig () const
 Gets the QCefConfig.
 

Static Public Member Functions

static QCefContextinstance ()
 Gets the unique default instance.
 

Protected Member Functions

bool init (const QCefConfig *config)
 Initialize the CEF context.
 
void uninit ()
 Uninitialize the CEF context.
 

Detailed Description

Represents the CEF context.

Constructor & Destructor Documentation

◆ QCefContext()

QCefContext::QCefContext ( QCoreApplication * app,
int argc,
char ** argv,
const QCefConfig * config )

Constructs the CEF context.

Parameters
appThe application
argcThe argument count
argvThe argument list pointer
configThe QCefConfig instance

◆ ~QCefContext()

QCefContext::~QCefContext ( )

Destructs the CEF context.

Member Function Documentation

◆ instance()

static QCefContext * QCefContext::instance ( )
static

Gets the unique default instance.

Returns
The default instance

◆ addLocalFolderResource()

void QCefContext::addLocalFolderResource ( const QString & path,
const QString & url,
int priority = 0 )

Adds a url mapping item with local web resource directory. This works for all QCefView instances created subsequently.

Parameters
pathThe path to the local resource directory
urlThe url to be mapped to
priorityThe priority

◆ addArchiveResource()

void QCefContext::addArchiveResource ( const QString & path,
const QString & url,
const QString & password = "",
int priority = 0 )

Adds a url mapping item with local archive (.zip) file which contains the web resource. This works for all QCefView instances created subsequently.

Parameters
pathThe path to the local archive file
urlThe url to be mapped to
passwordThe password of the archive
priorityThe priority

◆ addCookie()

bool QCefContext::addCookie ( const QString & name,
const QString & value,
const QString & domain,
const QString & url )

Adds a cookie to the CEF context, this cookie is accessible from all browsers created with this context.

Parameters
nameThe cookie item name
valueThe cookie item value
domainThe applicable domain name
urlThe applicable url
Returns
True on success; otherwise false

◆ deleteAllCookies()

bool QCefContext::deleteAllCookies ( )

Deletes all cookies from the CEF context.

Returns
True on success; otherwise false

◆ addCrossOriginWhitelistEntry()

bool QCefContext::addCrossOriginWhitelistEntry ( const QString & sourceOrigin,
const QString & targetSchema,
const QString & targetDomain,
bool allowTargetSubdomains )

Adds an entry to the cross-origin access whitelist. For details please refer to: https://github.com/chromiumembedded/cef/blob/605c2bac86415dcec1e2902cdc46dc11c1ad026a/include/cef_origin_whitelist.h#L81C23-L81C23.

Parameters
sourceOriginThe source origin
targetSchemaThe target schema
targetDomainThe target domain
allowTargetSubdomainsWhether to allow subdomain or not
Returns
True on success; otherwise false

◆ removeCrossOriginWhitelistEntry()

bool QCefContext::removeCrossOriginWhitelistEntry ( const QString & sourceOrigin,
const QString & targetSchema,
const QString & targetDomain,
bool allowTargetSubdomains )

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

Parameters
sourceOriginThe source origin
targetSchemaThe target schema
targetDomainThe target domain
allowTargetSubdomainsWhether to allow subdomain or not
Returns
True on success; otherwise false

◆ clearCrossOriginWhitelistEntry()

bool QCefContext::clearCrossOriginWhitelistEntry ( )

Removes all entries from the cross-origin access whitelist.

◆ cefConfig()

const QCefConfig * QCefContext::cefConfig ( ) const

Gets the QCefConfig.

Returns
The QCefConfig instance

◆ init()

bool QCefContext::init ( const QCefConfig * config)
protected

Initialize the CEF context.

Parameters
configThe QCefConfig instance
Returns
True on success; otherwise false

◆ uninit()

void QCefContext::uninit ( )
protected

Uninitialize the CEF context.