summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-10-23 14:20:07 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-10-23 14:20:07 +0200
commitdffe673c3044a6351aa72b69a5bf60429259c08c (patch)
treee0feba0056896b981a287704b2ef7383f9b95266 /src/core
parent9be23eb946580519b2b0600cc854ec8050b90659 (diff)
parent8f32ce028a48ddc6a7333b7af635424c78437ed7 (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Diffstat (limited to 'src/core')
-rw-r--r--src/core/api/core_api.pro3
-rw-r--r--src/core/api/qwebenginecallback_p.h6
-rw-r--r--src/core/api/qwebenginecookiestoreclient.cpp59
-rw-r--r--src/core/api/qwebenginecookiestoreclient.h16
-rw-r--r--src/core/api/qwebenginecookiestoreclient_p.h1
-rw-r--r--src/core/api/qwebengineurlschemehandler.cpp19
-rw-r--r--src/core/api/qwebengineurlschemehandler.h5
-rw-r--r--src/core/api/qwebengineurlschemehandler_p.h67
-rw-r--r--src/core/browser_context_adapter.cpp39
-rw-r--r--src/core/browser_context_adapter.h7
-rw-r--r--src/core/resource_dispatcher_host_delegate_qt.cpp5
-rw-r--r--src/core/url_request_context_getter_qt.cpp19
-rw-r--r--src/core/web_contents_adapter.cpp6
-rw-r--r--src/core/web_contents_adapter.h1
-rw-r--r--src/core/web_contents_adapter_client.h4
-rw-r--r--src/core/web_contents_delegate_qt.cpp17
16 files changed, 133 insertions, 141 deletions
diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro
index 6a37b2ac3..e4cdf43cb 100644
--- a/src/core/api/core_api.pro
+++ b/src/core/api/core_api.pro
@@ -39,8 +39,7 @@ HEADERS = \
qwebengineurlrequestinfo.h \
qwebengineurlrequestinfo_p.h \
qwebengineurlrequestjob.h \
- qwebengineurlschemehandler.h \
- qwebengineurlschemehandler_p.h
+ qwebengineurlschemehandler.h
SOURCES = \
qwebenginecookiestoreclient.cpp \
diff --git a/src/core/api/qwebenginecallback_p.h b/src/core/api/qwebenginecallback_p.h
index 44d9ceb14..f0c25fe9e 100644
--- a/src/core/api/qwebenginecallback_p.h
+++ b/src/core/api/qwebenginecallback_p.h
@@ -98,6 +98,12 @@ public:
FOR_EACH_TYPE(DEFINE_INVOKE_FOR_TYPE)
#undef DEFINE_INVOKE_FOR_TYPE
+ template <typename A>
+ void invokeDirectly(const QWebEngineCallback<A> &callback, const A &argument)
+ {
+ return callback.d.data()->operator()(std::forward<const A&>(argument));
+ }
+
private:
struct CallbackSharedDataPointerBase {
virtual ~CallbackSharedDataPointerBase() { }
diff --git a/src/core/api/qwebenginecookiestoreclient.cpp b/src/core/api/qwebenginecookiestoreclient.cpp
index 3a003ff3e..167b3f68c 100644
--- a/src/core/api/qwebenginecookiestoreclient.cpp
+++ b/src/core/api/qwebenginecookiestoreclient.cpp
@@ -175,8 +175,16 @@ void QWebEngineCookieStoreClientPrivate::onCookieChanged(const QNetworkCookie &c
bool QWebEngineCookieStoreClientPrivate::canSetCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &url)
{
- Q_Q(QWebEngineCookieStoreClient);
- return q->acceptCookie(firstPartyUrl, cookieLine, url);
+ if (filterCallback) {
+ QWebEngineCookieStoreClient::FilterRequest request;
+ request.accepted = true;
+ request.firstPartyUrl = firstPartyUrl;
+ request.cookieLine = cookieLine;
+ request.cookieSource = url;
+ callbackDirectory.invokeDirectly<const QWebEngineCookieStoreClient::FilterRequest&>(filterCallback, request);
+ return request.accepted;
+ }
+ return true;
}
/*!
@@ -185,8 +193,7 @@ bool QWebEngineCookieStoreClientPrivate::canSetCookie(const QUrl &firstPartyUrl,
\since 5.6
\brief The QWebEngineCookieStoreClient class provides access to Chromium's cookies.
- By subclassing the QWebEngineCookieStoreClient and installing it on the profile, the user can
- access HTTP cookies of Chromium.
+ The class allows to access HTTP cookies of Chromium for a specific profile.
It can be used to synchronize cookies of Chromium and the QNetworkAccessManager, as well as
to set, delete, and intercept cookies during navigation.
Because cookie operations are asynchronous, the user can choose to provide a callback function
@@ -196,6 +203,27 @@ bool QWebEngineCookieStoreClientPrivate::canSetCookie(const QUrl &firstPartyUrl,
*/
/*!
+ \class QWebEngineCookieStoreClient::FilterRequest
+ \inmodule QtWebEngineCore
+ \since 5.6
+
+ The structure specifies properties of a cookie, and whether it should accepted or not. It is
+ used as an argument to a filter installed via setCookieFilter().
+*/
+
+/*!
+ \variable QWebEngineCookieStoreClient::FilterRequest::accepted
+ Whether the cookie shall be accepted. The default is \c true.
+ \variable QWebEngineCookieStoreClient::FilterRequest::firstPartyUrl
+ URL of page that triggered the setting of the cookie.
+ \variable QWebEngineCookieStoreClient::FilterRequest::cookieLine
+ Content of the cookie.
+ \variable QWebEngineCookieStoreClient::FilterRequest::cookieSource
+ URL of site that sets the cookie.
+*/
+
+
+/*!
\fn void QWebEngineCookieStoreClient::cookieAdded(const QNetworkCookie &cookie)
This signal is emitted whenever a new \a cookie is added to the cookie store.
@@ -355,20 +383,21 @@ void QWebEngineCookieStoreClient::deleteAllCookies()
}
/*!
- This virtual function is called before a new cookie is added to the cookie store.
- By overriding this function and returning \c false the user can decide to deny
- from \a firstPartyUrl the cookie \a cookieLine with the source \a cookieSource.
- The request's \a firstPartyUrl can be used to identify a third-party cookie.
- This function should not be used to execute heavy tasks since it is running on the
+ \fn void QWebEngineCookieStoreClient::setCookieFilter(FunctorOrLambda filterCallback)
+
+ Installs a cookie filter that can reject cookies before they are added to the cookie store.
+ The \a filterCallback must be a lambda or functor taking FilterRequest structure. If the
+ cookie is to be rejected, the filter can set FilterRequest::accepted to \c false.
+
+ The callback should not be used to execute heavy tasks since it is running on the
IO thread and therefore blocks the Chromium networking.
-*/
-bool QWebEngineCookieStoreClient::acceptCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &cookieSource)
+ \sa deleteAllCookiesWithCallback(), getAllCookies()
+*/
+void QWebEngineCookieStoreClient::setCookieFilter(const QWebEngineCallback<const QWebEngineCookieStoreClient::FilterRequest&> &filter)
{
- Q_UNUSED(firstPartyUrl);
- Q_UNUSED(cookieLine);
- Q_UNUSED(cookieSource);
- return true;
+ Q_D(QWebEngineCookieStoreClient);
+ d->filterCallback = filter;
}
QT_END_NAMESPACE
diff --git a/src/core/api/qwebenginecookiestoreclient.h b/src/core/api/qwebenginecookiestoreclient.h
index 3a6f54ea7..8bdb988e2 100644
--- a/src/core/api/qwebenginecookiestoreclient.h
+++ b/src/core/api/qwebenginecookiestoreclient.h
@@ -46,6 +46,7 @@
#include <QtNetwork/qnetworkcookie.h>
namespace QtWebEngineCore {
+class BrowserContextAdapter;
class CookieMonsterDelegateQt;
}
@@ -54,8 +55,15 @@ QT_BEGIN_NAMESPACE
class QWebEngineCookieStoreClientPrivate;
class QWEBENGINE_EXPORT QWebEngineCookieStoreClient : public QObject {
Q_OBJECT
+
public:
- explicit QWebEngineCookieStoreClient(QObject *parent = 0);
+ struct FilterRequest {
+ bool accepted;
+
+ QUrl firstPartyUrl;
+ QByteArray cookieLine;
+ QUrl cookieSource;
+ };
virtual ~QWebEngineCookieStoreClient();
#ifdef Q_QDOC
@@ -63,24 +71,26 @@ public:
void deleteSessionCookiesWithCallback(FunctorOrLambda resultCallback);
void deleteAllCookiesWithCallback(FunctorOrLambda resultCallback);
void getAllCookies(FunctorOrLambda resultCallback);
+ void setCookieFilter(FunctorOrLambda filterCallback);
#else
void setCookieWithCallback(const QNetworkCookie &cookie, const QWebEngineCallback<bool> &resultCallback, const QUrl &origin = QUrl());
void deleteSessionCookiesWithCallback(const QWebEngineCallback<int> &resultCallback);
void deleteAllCookiesWithCallback(const QWebEngineCallback<int> &resultCallback);
void getAllCookies(const QWebEngineCallback<const QByteArray&> &resultCallback);
+ void setCookieFilter(const QWebEngineCallback<const FilterRequest&> &filterCallback);
#endif
void setCookie(const QNetworkCookie &cookie, const QUrl &origin = QUrl());
void deleteCookie(const QNetworkCookie &cookie, const QUrl &origin = QUrl());
void deleteSessionCookies();
void deleteAllCookies();
- virtual bool acceptCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &cookieSource);
-
Q_SIGNALS:
void cookieAdded(const QNetworkCookie &cookie);
void cookieRemoved(const QNetworkCookie &cookie);
private:
+ explicit QWebEngineCookieStoreClient(QObject *parent = 0);
+ friend class QtWebEngineCore::BrowserContextAdapter;
friend class QtWebEngineCore::CookieMonsterDelegateQt;
Q_DISABLE_COPY(QWebEngineCookieStoreClient)
Q_DECLARE_PRIVATE(QWebEngineCookieStoreClient)
diff --git a/src/core/api/qwebenginecookiestoreclient_p.h b/src/core/api/qwebenginecookiestoreclient_p.h
index a5b0a7068..43652fba6 100644
--- a/src/core/api/qwebenginecookiestoreclient_p.h
+++ b/src/core/api/qwebenginecookiestoreclient_p.h
@@ -74,6 +74,7 @@ class QWEBENGINE_PRIVATE_EXPORT QWebEngineCookieStoreClientPrivate {
public:
Q_DECLARE_PUBLIC(QWebEngineCookieStoreClient)
QtWebEngineCore::CallbackDirectory callbackDirectory;
+ QWebEngineCallback<const QWebEngineCookieStoreClient::FilterRequest&> filterCallback;
QList<CookieData> m_pendingUserCookies;
quint64 m_nextCallbackId;
bool m_deleteSessionCookiesPending;
diff --git a/src/core/api/qwebengineurlschemehandler.cpp b/src/core/api/qwebengineurlschemehandler.cpp
index e6c20dbca..f887e4e98 100644
--- a/src/core/api/qwebengineurlschemehandler.cpp
+++ b/src/core/api/qwebengineurlschemehandler.cpp
@@ -35,7 +35,6 @@
****************************************************************************/
#include "qwebengineurlschemehandler.h"
-#include "qwebengineurlschemehandler_p.h"
#include "qwebengineurlrequestjob.h"
@@ -59,20 +58,14 @@ QT_BEGIN_NAMESPACE
This signal is emitted when the custom URL scheme handler \a handler is deleted.
*/
-QWebEngineUrlSchemeHandlerPrivate::QWebEngineUrlSchemeHandlerPrivate(const QByteArray &scheme)
- : m_scheme(scheme)
-{
-}
-
/*!
Constructs a new URL scheme handler.
- The handler is created for \a scheme with the parent \a parent.
+ The handler is created with the parent \a parent.
*/
-QWebEngineUrlSchemeHandler::QWebEngineUrlSchemeHandler(const QByteArray &scheme, QObject *parent)
+QWebEngineUrlSchemeHandler::QWebEngineUrlSchemeHandler(QObject *parent)
: QObject(parent)
- , d_ptr(new QWebEngineUrlSchemeHandlerPrivate(scheme))
{
}
@@ -86,14 +79,6 @@ QWebEngineUrlSchemeHandler::~QWebEngineUrlSchemeHandler()
}
/*!
- Returns the custom URL scheme handled.
-*/
-QByteArray QWebEngineUrlSchemeHandler::scheme() const
-{
- return d_ptr->scheme();
-}
-
-/*!
\fn void QWebEngineUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *request)
This method is called whenever a request \a request for the registered scheme is started.
diff --git a/src/core/api/qwebengineurlschemehandler.h b/src/core/api/qwebengineurlschemehandler.h
index 1b6a66706..8c1e52646 100644
--- a/src/core/api/qwebengineurlschemehandler.h
+++ b/src/core/api/qwebengineurlschemehandler.h
@@ -39,7 +39,6 @@
#include "qtwebenginecoreglobal.h"
-#include <QtCore/qbytearray.h>
#include <QtCore/qobject.h>
namespace QtWebEngineCore {
@@ -54,11 +53,9 @@ class QWebEngineUrlSchemeHandlerPrivate;
class QWEBENGINE_EXPORT QWebEngineUrlSchemeHandler : public QObject {
Q_OBJECT
public:
- QWebEngineUrlSchemeHandler(const QByteArray &scheme, QObject *parent = 0);
+ QWebEngineUrlSchemeHandler(QObject *parent = 0);
~QWebEngineUrlSchemeHandler();
- QByteArray scheme() const;
-
virtual void requestStarted(QWebEngineUrlRequestJob*) = 0;
Q_SIGNALS:
diff --git a/src/core/api/qwebengineurlschemehandler_p.h b/src/core/api/qwebengineurlschemehandler_p.h
deleted file mode 100644
index d63666326..000000000
--- a/src/core/api/qwebengineurlschemehandler_p.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWEBENGINEURLSCHEMEHANDLER_P_H
-#define QWEBENGINEURLSCHEMEHANDLER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qbytearray.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWEBENGINE_EXPORT QWebEngineUrlSchemeHandlerPrivate {
-public:
- QWebEngineUrlSchemeHandlerPrivate(const QByteArray &);
-
- const QByteArray &scheme() const { return m_scheme; }
-
-private:
- QByteArray m_scheme;
-};
-
-QT_END_NAMESPACE
-
-#endif // QWEBENGINEURLSCHEMEHANDLER_P_H
diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp
index 345741847..b5fdf2ce0 100644
--- a/src/core/browser_context_adapter.cpp
+++ b/src/core/browser_context_adapter.cpp
@@ -138,16 +138,11 @@ DownloadManagerDelegateQt *BrowserContextAdapter::downloadManagerDelegate()
QWebEngineCookieStoreClient *BrowserContextAdapter::cookieStoreClient()
{
+ if (!m_cookieStoreClient)
+ m_cookieStoreClient.reset(new QWebEngineCookieStoreClient);
return m_cookieStoreClient.data();
}
-void BrowserContextAdapter::setCookieStoreClient(QWebEngineCookieStoreClient *client)
-{
- m_cookieStoreClient = client;
- if (m_browserContext->url_request_getter_.get())
- m_browserContext->url_request_getter_->updateStorageSettings();
-}
-
QWebEngineUrlRequestInterceptor *BrowserContextAdapter::requestInterceptor()
{
return m_requestInterceptor.data();
@@ -365,9 +360,35 @@ void BrowserContextAdapter::updateCustomUrlSchemeHandlers()
m_browserContext->url_request_getter_->updateStorageSettings();
}
-void BrowserContextAdapter::removeCustomUrlSchemeHandler(QWebEngineUrlSchemeHandler *handler)
+bool BrowserContextAdapter::removeCustomUrlSchemeHandler(QWebEngineUrlSchemeHandler *handler)
+{
+ bool removedOneOrMore = false;
+ auto it = m_customUrlSchemeHandlers.begin();
+ auto end = m_customUrlSchemeHandlers.end();
+ for (; it != end; ++it) {
+ if (it.value() == handler) {
+ it = m_customUrlSchemeHandlers.erase(it);
+ removedOneOrMore = true;
+ continue;
+ }
+ }
+ if (removedOneOrMore)
+ updateCustomUrlSchemeHandlers();
+ return removedOneOrMore;
+}
+
+QWebEngineUrlSchemeHandler *BrowserContextAdapter::takeCustomUrlSchemeHandler(const QByteArray &scheme)
+{
+ QWebEngineUrlSchemeHandler *handler = m_customUrlSchemeHandlers.take(scheme);
+ if (handler)
+ updateCustomUrlSchemeHandlers();
+ return handler;
+}
+
+void BrowserContextAdapter::addCustomUrlSchemeHandler(const QByteArray &scheme, QWebEngineUrlSchemeHandler *handler)
{
- m_customUrlSchemeHandlers.remove(handler->scheme());
+ m_customUrlSchemeHandlers.insert(scheme, handler);
+ updateCustomUrlSchemeHandlers();
}
UserScriptControllerHost *BrowserContextAdapter::userScriptController()
diff --git a/src/core/browser_context_adapter.h b/src/core/browser_context_adapter.h
index 5272268f7..818dfda3d 100644
--- a/src/core/browser_context_adapter.h
+++ b/src/core/browser_context_adapter.h
@@ -74,7 +74,6 @@ public:
DownloadManagerDelegateQt *downloadManagerDelegate();
QWebEngineCookieStoreClient *cookieStoreClient();
- void setCookieStoreClient(QWebEngineCookieStoreClient *client);
QWebEngineUrlRequestInterceptor* requestInterceptor();
void setRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor);
@@ -147,7 +146,9 @@ public:
QHash<QByteArray, QWebEngineUrlSchemeHandler *> &customUrlSchemeHandlers();
void updateCustomUrlSchemeHandlers();
- void removeCustomUrlSchemeHandler(QWebEngineUrlSchemeHandler *);
+ void addCustomUrlSchemeHandler(const QByteArray &, QWebEngineUrlSchemeHandler *);
+ bool removeCustomUrlSchemeHandler(QWebEngineUrlSchemeHandler *);
+ QWebEngineUrlSchemeHandler *takeCustomUrlSchemeHandler(const QByteArray &);
UserScriptControllerHost *userScriptController();
void permissionRequestReply(const QUrl &origin, PermissionType type, bool reply);
@@ -163,7 +164,7 @@ private:
QScopedPointer<WebEngineVisitedLinksManager> m_visitedLinksManager;
QScopedPointer<DownloadManagerDelegateQt> m_downloadManagerDelegate;
QScopedPointer<UserScriptControllerHost> m_userScriptController;
- QPointer<QWebEngineCookieStoreClient> m_cookieStoreClient;
+ QScopedPointer<QWebEngineCookieStoreClient> m_cookieStoreClient;
QPointer<QWebEngineUrlRequestInterceptor> m_requestInterceptor;
QString m_dataPath;
diff --git a/src/core/resource_dispatcher_host_delegate_qt.cpp b/src/core/resource_dispatcher_host_delegate_qt.cpp
index e6c513bf6..0213daa3a 100644
--- a/src/core/resource_dispatcher_host_delegate_qt.cpp
+++ b/src/core/resource_dispatcher_host_delegate_qt.cpp
@@ -100,7 +100,10 @@ bool ResourceDispatcherHostLoginDelegateQt::isProxy() const
void ResourceDispatcherHostLoginDelegateQt::triggerDialog()
{
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- content::RenderViewHost* renderViewHost = content::RenderFrameHost::FromID(m_renderProcessId, m_renderFrameId)->GetRenderViewHost();
+ content::RenderFrameHost *renderFrameHost = content::RenderFrameHost::FromID(m_renderProcessId, m_renderFrameId);
+ if (!renderFrameHost)
+ return;
+ content::RenderViewHost *renderViewHost = renderFrameHost->GetRenderViewHost();
content::WebContentsImpl *webContents = static_cast<content::WebContentsImpl *>(content::WebContents::FromRenderViewHost(renderViewHost));
WebContentsAdapterClient *client = WebContentsViewQt::from(webContents->GetView())->client();
diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp
index 771a662b9..26e1dbea8 100644
--- a/src/core/url_request_context_getter_qt.cpp
+++ b/src/core/url_request_context_getter_qt.cpp
@@ -336,11 +336,13 @@ void URLRequestContextGetterQt::generateJobFactory()
Q_ASSERT(!m_jobFactory);
m_jobFactory.reset(new net::URLRequestJobFactoryImpl());
- // Chromium has a few protocol handlers ready for us, only pick blob: and throw away the rest.
- content::ProtocolHandlerMap::iterator it = m_protocolHandlers.find(url::kBlobScheme);
- Q_ASSERT(it != m_protocolHandlers.end());
- m_jobFactory->SetProtocolHandler(it->first, it->second.release());
- m_protocolHandlers.clear();
+ {
+ // Chromium has a few protocol handlers ready for us, only pick blob: and throw away the rest.
+ content::ProtocolHandlerMap::iterator it = m_protocolHandlers.find(url::kBlobScheme);
+ Q_ASSERT(it != m_protocolHandlers.end());
+ m_jobFactory->SetProtocolHandler(it->first, it->second.release());
+ m_protocolHandlers.clear();
+ }
m_jobFactory->SetProtocolHandler(url::kDataScheme, new net::DataProtocolHandler());
m_jobFactory->SetProtocolHandler(url::kFileScheme, new net::FileProtocolHandler(
@@ -350,9 +352,10 @@ void URLRequestContextGetterQt::generateJobFactory()
m_jobFactory->SetProtocolHandler(url::kFtpScheme,
new net::FtpProtocolHandler(new net::FtpNetworkLayer(m_urlRequestContext->host_resolver())));
- Q_FOREACH (QWebEngineUrlSchemeHandler *handler, m_browserContext->customUrlSchemeHandlers()) {
- m_jobFactory->SetProtocolHandler(handler->scheme().toStdString(), new CustomProtocolHandler(handler));
- }
+ QHash<QByteArray, QWebEngineUrlSchemeHandler*>::const_iterator it = m_browserContext->customUrlSchemeHandlers().constBegin();
+ const QHash<QByteArray, QWebEngineUrlSchemeHandler*>::const_iterator end = m_browserContext->customUrlSchemeHandlers().constEnd();
+ for (; it != end; ++it)
+ m_jobFactory->SetProtocolHandler(it.key().toStdString(), new CustomProtocolHandler(it.value()));
m_urlRequestContext->set_job_factory(m_jobFactory.get());
}
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 2ab2e9471..c38b8ee02 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -829,6 +829,12 @@ void WebContentsAdapter::exitFullScreen()
d->webContents->ExitFullscreen();
}
+void WebContentsAdapter::changedFullScreen()
+{
+ Q_D(WebContentsAdapter);
+ d->webContents->NotifyFullscreenChanged();
+}
+
void WebContentsAdapter::wasShown()
{
Q_D(WebContentsAdapter);
diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h
index 6e356befd..b6a90d3f1 100644
--- a/src/core/web_contents_adapter.h
+++ b/src/core/web_contents_adapter.h
@@ -130,6 +130,7 @@ public:
bool hasInspector() const;
void exitFullScreen();
void requestClose();
+ void changedFullScreen();
void wasShown();
void wasHidden();
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h
index 4a857b320..d9a2876f9 100644
--- a/src/core/web_contents_adapter_client.h
+++ b/src/core/web_contents_adapter_client.h
@@ -211,8 +211,8 @@ public:
virtual void windowCloseRejected() = 0;
virtual bool contextMenuRequested(const WebEngineContextMenuData&) = 0;
virtual void navigationRequested(int navigationType, const QUrl &url, int &navigationRequestAction, bool isMainFrame) = 0;
- virtual void requestFullScreen(bool) = 0;
- virtual bool isFullScreen() const = 0;
+ virtual void requestFullScreenMode(const QUrl &origin, bool fullscreen) = 0;
+ virtual bool isFullScreenMode() const = 0;
virtual void javascriptDialog(QSharedPointer<JavaScriptDialogController>) = 0;
virtual void runFileChooser(FilePickerController *controller) = 0;
virtual void didRunJavaScript(quint64 requestId, const QVariant& result) = 0;
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index 497910a9c..1f789161a 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -245,24 +245,21 @@ content::JavaScriptDialogManager *WebContentsDelegateQt::GetJavaScriptDialogMana
void WebContentsDelegateQt::EnterFullscreenModeForTab(content::WebContents *web_contents, const GURL& origin)
{
- Q_UNUSED(origin); // FIXME
- if (!m_viewClient->isFullScreen()) {
- m_viewClient->requestFullScreen(true);
- web_contents->GetRenderViewHost()->WasResized();
- }
+ Q_UNUSED(web_contents);
+ if (!m_viewClient->isFullScreenMode())
+ m_viewClient->requestFullScreenMode(toQt(origin), true);
}
void WebContentsDelegateQt::ExitFullscreenModeForTab(content::WebContents *web_contents)
{
- if (m_viewClient->isFullScreen()) {
- m_viewClient->requestFullScreen(false);
- web_contents->GetRenderViewHost()->WasResized();
- }
+ if (m_viewClient->isFullScreenMode())
+ m_viewClient->requestFullScreenMode(toQt(web_contents->GetLastCommittedURL().GetOrigin()), false);
}
bool WebContentsDelegateQt::IsFullscreenForTabOrPending(const content::WebContents* web_contents) const
{
- return m_viewClient->isFullScreen();
+ Q_UNUSED(web_contents);
+ return m_viewClient->isFullScreenMode();
}
ASSERT_ENUMS_MATCH(FilePickerController::Open, content::FileChooserParams::Open)