| QCefView 1.0.7 A QWidget-based WebView Component Integrated with CEF

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
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 QCefConfig * | cefConfig () const
| Gets the QCefConfig.

## Static Public Member Functions
static QCefContext * | instance ()
| 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

  app | The application
  argc | The argument count
  argv | The argument list pointer
  config | The 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

  path | The path to the local resource directory
  url | The url to be mapped to
  priority | The 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

  path | The path to the local archive file
  url | The url to be mapped to
  password | The password of the archive
  priority | The 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

  name | The cookie item name
  value | The cookie item value
  domain | The applicable domain name
  url | The 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

  sourceOrigin | The source origin
  targetSchema | The target schema
  targetDomain | The target domain
  allowTargetSubdomains | Whether 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

  sourceOrigin | The source origin
  targetSchema | The target schema
  targetDomain | The target domain
  allowTargetSubdomains | Whether 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

  config | The QCefConfig instance

Returns
  True on success; otherwise false

## ◆ uninit()

void QCefContext::uninit | ( |  | ) |
| protected

Uninitialize the CEF context.