diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-11-24 18:03:17 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2014-12-12 12:29:12 +0100 |
commit | 6ec3268a30a63d5c15258ea6f4f792e21930b093 (patch) | |
tree | b2a122f94eed67546a7ee1d0f118a7e72ec18c8f /src/core/web_contents_adapter.cpp | |
parent | b93a478d60e90073870aad22febd519adc4a4a3b (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/web_contents_adapter.cpp')
-rw-r--r-- | src/core/web_contents_adapter.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 678b558c1..0b1aba1cf 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -347,10 +347,13 @@ void WebContentsAdapter::initialize(WebContentsAdapterClient *adapterClient) { Q_D(WebContentsAdapter); d->adapterClient = adapterClient; + // We keep a reference to browserContextAdapter to keep it alive as long as we use it. + // This is needed in case the QML WebEngineProfile is garbage collected before the WebEnginePage. + d->browserContextAdapter = adapterClient->browserContextAdapter(); // Create our own if a WebContents wasn't provided at construction. if (!d->webContents) - d->webContents.reset(createBlankWebContents(adapterClient, adapterClient->browserContextAdapter()->browserContext())); + d->webContents.reset(createBlankWebContents(adapterClient, d->browserContextAdapter->browserContext())); // This might replace any adapter that has been initialized with this WebEngineSettings. adapterClient->webEngineSettings()->setWebContentsAdapter(this); @@ -631,7 +634,7 @@ void WebContentsAdapter::enableInspector(bool enable) BrowserContextQt* WebContentsAdapter::browserContext() { Q_D(WebContentsAdapter); - return static_cast<BrowserContextQt*>(d->webContents->GetBrowserContext()); + return d->browserContextAdapter->browserContext(); } QAccessibleInterface *WebContentsAdapter::browserAccessible() |