summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/browser_context_qt.h1
-rw-r--r--src/core/web_contents_adapter.cpp8
-rw-r--r--src/core/web_contents_adapter.h1
-rw-r--r--src/webengine/api/qquickwebengineview.cpp5
4 files changed, 14 insertions, 1 deletions
diff --git a/src/core/browser_context_qt.h b/src/core/browser_context_qt.h
index baa60aaef..ad46751a0 100644
--- a/src/core/browser_context_qt.h
+++ b/src/core/browser_context_qt.h
@@ -71,6 +71,7 @@ public:
virtual content::SSLHostStateDelegate* GetSSLHostStateDelegate() Q_DECL_OVERRIDE;
net::URLRequestContextGetter *CreateRequestContext(content::ProtocolHandlerMap *protocol_handlers);
+ BrowserContextAdapter* adapter() { return m_adapter; }
private:
scoped_ptr<content::ResourceContext> resourceContext;
scoped_refptr<URLRequestContextGetterQt> url_request_getter_;
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 38573d833..ed8422b6e 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -667,7 +667,13 @@ qreal WebContentsAdapter::currentZoomFactor() const
BrowserContextQt* WebContentsAdapter::browserContext()
{
Q_D(WebContentsAdapter);
- return d->browserContextAdapter->browserContext();
+ return d->browserContextAdapter ? d->browserContextAdapter->browserContext() : d->webContents ? static_cast<BrowserContextQt*>(d->webContents->GetBrowserContext()) : 0;
+}
+
+BrowserContextAdapter* WebContentsAdapter::browserContextAdapter()
+{
+ Q_D(WebContentsAdapter);
+ return d->browserContextAdapter ? d->browserContextAdapter.data() : d->webContents ? static_cast<BrowserContextQt*>(d->webContents->GetBrowserContext())->adapter() : 0;
}
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h
index 5b887c614..33d7e3cd9 100644
--- a/src/core/web_contents_adapter.h
+++ b/src/core/web_contents_adapter.h
@@ -114,6 +114,7 @@ public:
void dpiScaleChanged();
QAccessibleInterface *browserAccessible();
BrowserContextQt* browserContext();
+ BrowserContextAdapter* browserContextAdapter();
private:
Q_DISABLE_COPY(WebContentsAdapter);
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 460caa4d7..f6dbc18ff 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -512,6 +512,11 @@ void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContent
return;
}
+ if (browserContextAdapter() != webContents->browserContextAdapter()) {
+ qWarning("Can not adopt content from a different WebEngineProfile.");
+ return;
+ }
+
Q_Q(QQuickWebEngineView);
// This throws away the WebContentsAdapter that has been used until now.
// All its states, particularly the loading URL, are replaced by the adopted WebContentsAdapter.