summaryrefslogtreecommitdiffstats
path: root/src/core/browser_context_adapter.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-11-24 18:03:17 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2014-12-12 12:29:12 +0100
commit6ec3268a30a63d5c15258ea6f4f792e21930b093 (patch)
treeb2a122f94eed67546a7ee1d0f118a7e72ec18c8f /src/core/browser_context_adapter.h
parentb93a478d60e90073870aad22febd519adc4a4a3b (diff)
Introduce QWebEngineProfile API
Introduces initial widgets API for the Chromium BrowserContext. Adds API for controlling cookie jar policy, user-agent string and cache and persistent data paths. Similar QML API will follow in another patch. [ChangeLog][QtWebEngineWidgets][QWebEngineProfile] New API for profiles applying to groups of QWebEnginePages. Change-Id: I3c4ef4053fde7564af29178c91a0aca8a2b61a5f Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'src/core/browser_context_adapter.h')
-rw-r--r--src/core/browser_context_adapter.h51
1 files changed, 45 insertions, 6 deletions
diff --git a/src/core/browser_context_adapter.h b/src/core/browser_context_adapter.h
index e4e046c8e..dabd8a11e 100644
--- a/src/core/browser_context_adapter.h
+++ b/src/core/browser_context_adapter.h
@@ -46,10 +46,11 @@
class BrowserContextQt;
class WebEngineVisitedLinksManager;
-// Make a QSharedData if we need to open arbitrary BrowserContextAdapter beyond the defaults.
-class QWEBENGINE_EXPORT BrowserContextAdapter // : public QSharedData
+class QWEBENGINE_EXPORT BrowserContextAdapter : public QSharedData
{
public:
+ explicit BrowserContextAdapter(bool offTheRecord = false);
+ explicit BrowserContextAdapter(const QString &storagePrefix);
virtual ~BrowserContextAdapter();
static BrowserContextAdapter* defaultContext();
@@ -58,19 +59,57 @@ public:
WebEngineVisitedLinksManager *visitedLinksManager();
BrowserContextQt *browserContext();
+
+ QString storageName() const { return m_name; }
+ void setStorageName(const QString &storageName);
+
bool isOffTheRecord() const { return m_offTheRecord; }
+ void setOffTheRecord(bool offTheRecord);
+
QString dataPath() const;
+ void setDataPath(const QString &path);
+
QString cachePath() const;
+ void setCachePath(const QString &path);
+
+ QString httpCachePath() const;
+ QString cookiesPath() const;
+
+ QString httpUserAgent() const;
+ void setHttpUserAgent(const QString &userAgent);
+
+ // KEEP IN SYNC with API or add mapping layer
+ enum HttpCacheType {
+ MemoryHttpCache = 0,
+ DiskHttpCache
+ };
+
+ enum PersistentCookiesPolicy {
+ NoPersistentCookies = 0,
+ AllowPersistentCookies,
+ ForcePersistentCookies
+ };
+
+ HttpCacheType httpCacheType() const;
+ void setHttpCacheType(BrowserContextAdapter::HttpCacheType);
+
+ PersistentCookiesPolicy persistentCookiesPolicy() const;
+ void setPersistentCookiesPolicy(BrowserContextAdapter::PersistentCookiesPolicy);
-protected:
- BrowserContextAdapter(const QString &name, bool offTheRecord = false);
+ int httpCacheMaxSize() const;
+ void setHttpCacheMaxSize(int maxSize);
private:
- const QString m_name;
+ QString m_name;
bool m_offTheRecord;
QScopedPointer<BrowserContextQt> m_browserContext;
QScopedPointer<WebEngineVisitedLinksManager> m_visitedLinksManager;
- friend class WebEngineContext;
+ QString m_dataPath;
+ QString m_cachePath;
+ QString m_httpUserAgent;
+ HttpCacheType m_httpCacheType;
+ PersistentCookiesPolicy m_persistentCookiesPolicy;
+ int m_httpCacheMaxSize;
Q_DISABLE_COPY(BrowserContextAdapter)
};