diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-12-03 19:36:29 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-12-03 19:36:29 +0100 |
commit | 90d3044e3a6ad58819be6787b5edcbc9daa948dc (patch) | |
tree | 27d54322988fe60a420bbb058608b9b9d637329b /src/core | |
parent | 03301c0fbdf034fb987e1c1ed1bec7c206dcd27e (diff) | |
parent | d0ae9b50cc01e4c0f65f17467276d4af40284ae1 (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: I052fdc4245e25e58457d51f6e49703bc7dd8ff00
Diffstat (limited to 'src/core')
23 files changed, 197 insertions, 136 deletions
diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro index e4cdf43cb..d11994e98 100644 --- a/src/core/api/core_api.pro +++ b/src/core/api/core_api.pro @@ -4,7 +4,7 @@ DESTDIR = $$OUT_PWD/$$getConfigDir() TEMPLATE = lib CONFIG += staticlib c++11 -QT += network +QT += network core-private # Don't create .prl file for this intermediate library because # their contents get used when linking against them, breaking @@ -33,8 +33,8 @@ HEADERS = \ qwebenginecallback_p.h \ qtwebenginecoreglobal.h \ qtwebenginecoreglobal_p.h \ - qwebenginecookiestoreclient.h \ - qwebenginecookiestoreclient_p.h \ + qwebenginecookiestore.h \ + qwebenginecookiestore_p.h \ qwebengineurlrequestinterceptor.h \ qwebengineurlrequestinfo.h \ qwebengineurlrequestinfo_p.h \ @@ -42,7 +42,7 @@ HEADERS = \ qwebengineurlschemehandler.h SOURCES = \ - qwebenginecookiestoreclient.cpp \ + qwebenginecookiestore.cpp \ qwebengineurlrequestinfo.cpp \ qwebengineurlrequestjob.cpp \ qwebengineurlschemehandler.cpp diff --git a/src/core/api/qwebenginecookiestoreclient.cpp b/src/core/api/qwebenginecookiestore.cpp index bd43b871d..51753e87b 100644 --- a/src/core/api/qwebenginecookiestoreclient.cpp +++ b/src/core/api/qwebenginecookiestore.cpp @@ -34,8 +34,8 @@ ** ****************************************************************************/ -#include "qwebenginecookiestoreclient.h" -#include "qwebenginecookiestoreclient_p.h" +#include "qwebenginecookiestore.h" +#include "qwebenginecookiestore_p.h" #include <cookie_monster_delegate_qt.h> @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE using namespace QtWebEngineCore; -QWebEngineCookieStoreClientPrivate::QWebEngineCookieStoreClientPrivate(QWebEngineCookieStoreClient* q) +QWebEngineCookieStorePrivate::QWebEngineCookieStorePrivate(QWebEngineCookieStore* q) : m_nextCallbackId(CallbackDirectory::ReservedCallbackIdsEnd) , m_deleteSessionCookiesPending(false) , m_deleteAllCookiesPending(false) @@ -56,12 +56,7 @@ QWebEngineCookieStoreClientPrivate::QWebEngineCookieStoreClientPrivate(QWebEngin { } -QWebEngineCookieStoreClientPrivate::~QWebEngineCookieStoreClientPrivate() -{ - -} - -void QWebEngineCookieStoreClientPrivate::processPendingUserCookies() +void QWebEngineCookieStorePrivate::processPendingUserCookies() { Q_ASSERT(delegate); Q_ASSERT(delegate->hasCookieMonster()); @@ -94,7 +89,7 @@ void QWebEngineCookieStoreClientPrivate::processPendingUserCookies() m_pendingUserCookies.clear(); } -void QWebEngineCookieStoreClientPrivate::setCookie(const QWebEngineCallback<bool> &callback, const QNetworkCookie &cookie, const QUrl &origin) +void QWebEngineCookieStorePrivate::setCookie(const QWebEngineCallback<bool> &callback, const QNetworkCookie &cookie, const QUrl &origin) { const quint64 currentCallbackId = callback ? m_nextCallbackId++ : static_cast<quint64>(CallbackDirectory::NoCallbackId); @@ -109,7 +104,7 @@ void QWebEngineCookieStoreClientPrivate::setCookie(const QWebEngineCallback<bool delegate->setCookie(currentCallbackId, cookie, origin); } -void QWebEngineCookieStoreClientPrivate::deleteCookie(const QNetworkCookie &cookie, const QUrl &url) +void QWebEngineCookieStorePrivate::deleteCookie(const QNetworkCookie &cookie, const QUrl &url) { if (!delegate || !delegate->hasCookieMonster()) { m_pendingUserCookies.append(CookieData{ CallbackDirectory::DeleteCookieCallbackId, cookie, url }); @@ -119,7 +114,7 @@ void QWebEngineCookieStoreClientPrivate::deleteCookie(const QNetworkCookie &cook delegate->deleteCookie(cookie, url); } -void QWebEngineCookieStoreClientPrivate::deleteSessionCookies() +void QWebEngineCookieStorePrivate::deleteSessionCookies() { if (!delegate || !delegate->hasCookieMonster()) { m_deleteSessionCookiesPending = true; @@ -129,7 +124,7 @@ void QWebEngineCookieStoreClientPrivate::deleteSessionCookies() delegate->deleteSessionCookies(CallbackDirectory::DeleteSessionCookiesCallbackId); } -void QWebEngineCookieStoreClientPrivate::deleteAllCookies() +void QWebEngineCookieStorePrivate::deleteAllCookies() { if (!delegate || !delegate->hasCookieMonster()) { m_deleteAllCookiesPending = true; @@ -140,7 +135,7 @@ void QWebEngineCookieStoreClientPrivate::deleteAllCookies() delegate->deleteAllCookies(CallbackDirectory::DeleteAllCookiesCallbackId); } -void QWebEngineCookieStoreClientPrivate::getAllCookies() +void QWebEngineCookieStorePrivate::getAllCookies() { if (!delegate || !delegate->hasCookieMonster()) { m_getAllCookiesPending = true; @@ -150,48 +145,48 @@ void QWebEngineCookieStoreClientPrivate::getAllCookies() delegate->getAllCookies(CallbackDirectory::GetAllCookiesCallbackId); } -void QWebEngineCookieStoreClientPrivate::onGetAllCallbackResult(qint64 callbackId, const QByteArray &cookieList) +void QWebEngineCookieStorePrivate::onGetAllCallbackResult(qint64 callbackId, const QByteArray &cookieList) { callbackDirectory.invoke(callbackId, cookieList); } -void QWebEngineCookieStoreClientPrivate::onSetCallbackResult(qint64 callbackId, bool success) +void QWebEngineCookieStorePrivate::onSetCallbackResult(qint64 callbackId, bool success) { callbackDirectory.invoke(callbackId, success); } -void QWebEngineCookieStoreClientPrivate::onDeleteCallbackResult(qint64 callbackId, int numCookies) +void QWebEngineCookieStorePrivate::onDeleteCallbackResult(qint64 callbackId, int numCookies) { callbackDirectory.invoke(callbackId, numCookies); } -void QWebEngineCookieStoreClientPrivate::onCookieChanged(const QNetworkCookie &cookie, bool removed) +void QWebEngineCookieStorePrivate::onCookieChanged(const QNetworkCookie &cookie, bool removed) { - Q_Q(QWebEngineCookieStoreClient); + Q_Q(QWebEngineCookieStore); if (removed) Q_EMIT q->cookieRemoved(cookie); else Q_EMIT q->cookieAdded(cookie); } -bool QWebEngineCookieStoreClientPrivate::canSetCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &url) +bool QWebEngineCookieStorePrivate::canSetCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &url) { if (filterCallback) { - QWebEngineCookieStoreClient::FilterRequest request; + QWebEngineCookieStore::FilterRequest request; request.accepted = true; request.firstPartyUrl = firstPartyUrl; request.cookieLine = cookieLine; request.cookieSource = url; - callbackDirectory.invokeDirectly<QWebEngineCookieStoreClient::FilterRequest&>(filterCallback, request); + callbackDirectory.invokeDirectly<QWebEngineCookieStore::FilterRequest&>(filterCallback, request); return request.accepted; } return true; } /*! - \class QWebEngineCookieStoreClient + \class QWebEngineCookieStore \inmodule QtWebEngineCore \since 5.6 - \brief The QWebEngineCookieStoreClient class provides access to Chromium's cookies. + \brief The QWebEngineCookieStore class provides access to Chromium's cookies. 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 @@ -203,54 +198,65 @@ bool QWebEngineCookieStoreClientPrivate::canSetCookie(const QUrl &firstPartyUrl, */ /*! - \class QWebEngineCookieStoreClient::FilterRequest + \class QWebEngineCookieStore::FilterRequest \inmodule QtWebEngineCore \since 5.6 + \brief The FilterRequest class specifies the properties of a cookie. - 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(). + The class specifies the properties of a cookie and determines whether the cookie should be + accepted. The class 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. + \variable QWebEngineCookieStore::FilterRequest::accepted + \brief Whether the cookie shall be accepted. + + The default is \c true. */ +/*! + \variable QWebEngineCookieStore::FilterRequest::firstPartyUrl + \brief The URL of the page that triggered the setting of the cookie. +*/ + +/*! + \variable QWebEngineCookieStore::FilterRequest::cookieLine + \brief The content of the cookie. +*/ + +/*! + \variable QWebEngineCookieStore::FilterRequest::cookieSource + \brief The URL of the site that sets the cookie. +*/ /*! - \fn void QWebEngineCookieStoreClient::cookieAdded(const QNetworkCookie &cookie) + \fn void QWebEngineCookieStore::cookieAdded(const QNetworkCookie &cookie) This signal is emitted whenever a new \a cookie is added to the cookie store. */ /*! - \fn void QWebEngineCookieStoreClient::cookieRemoved(const QNetworkCookie &cookie) + \fn void QWebEngineCookieStore::cookieRemoved(const QNetworkCookie &cookie) This signal is emitted whenever a \a cookie is deleted from the cookie store. */ /*! - Creates a new QWebEngineCookieStoreClient object with \a parent. + Creates a new QWebEngineCookieStore object with \a parent. */ -QWebEngineCookieStoreClient::QWebEngineCookieStoreClient(QObject *parent) +QWebEngineCookieStore::QWebEngineCookieStore(QObject *parent) : QObject(parent) - , d_ptr(new QWebEngineCookieStoreClientPrivate(this)) + , d_ptr(new QWebEngineCookieStorePrivate(this)) { } /*! - Destroys this QWebEngineCookieStoreClient object. + Destroys this QWebEngineCookieStore object. */ -QWebEngineCookieStoreClient::~QWebEngineCookieStoreClient() +QWebEngineCookieStore::~QWebEngineCookieStore() { } @@ -266,9 +272,9 @@ QWebEngineCookieStoreClient::~QWebEngineCookieStoreClient() \sa setCookie() */ -void QWebEngineCookieStoreClient::setCookieWithCallback(const QNetworkCookie &cookie, const QWebEngineCallback<bool> &resultCallback, const QUrl &origin) +void QWebEngineCookieStore::setCookieWithCallback(const QNetworkCookie &cookie, const QWebEngineCallback<bool> &resultCallback, const QUrl &origin) { - Q_D(QWebEngineCookieStoreClient); + Q_D(QWebEngineCookieStore); d->setCookie(resultCallback, cookie, origin); } @@ -281,7 +287,7 @@ void QWebEngineCookieStoreClient::setCookieWithCallback(const QNetworkCookie &co \sa setCookieWithCallback() */ -void QWebEngineCookieStoreClient::setCookie(const QNetworkCookie &cookie, const QUrl &origin) +void QWebEngineCookieStore::setCookie(const QNetworkCookie &cookie, const QUrl &origin) { setCookieWithCallback(cookie, QWebEngineCallback<bool>(), origin); } @@ -293,14 +299,14 @@ void QWebEngineCookieStoreClient::setCookie(const QNetworkCookie &cookie, const The provided URL should also include the scheme. */ -void QWebEngineCookieStoreClient::deleteCookie(const QNetworkCookie &cookie, const QUrl &origin) +void QWebEngineCookieStore::deleteCookie(const QNetworkCookie &cookie, const QUrl &origin) { - Q_D(QWebEngineCookieStoreClient); + Q_D(QWebEngineCookieStore); d->deleteCookie(cookie, origin); } /*! - \fn void QWebEngineCookieStoreClient::getAllCookies(FunctorOrLambda resultCallback) + \fn void QWebEngineCookieStore::getAllCookies(FunctorOrLambda resultCallback) Requests all the cookies in the cookie store. When the asynchronous operation finishes, \a resultCallback will be called with a QByteArray as the argument containing the cookies. @@ -309,9 +315,9 @@ void QWebEngineCookieStoreClient::deleteCookie(const QNetworkCookie &cookie, con \sa deleteCookie() */ -void QWebEngineCookieStoreClient::getAllCookies(const QWebEngineCallback<const QByteArray&> &resultCallback) +void QWebEngineCookieStore::getAllCookies(const QWebEngineCallback<const QByteArray&> &resultCallback) { - Q_D(QWebEngineCookieStoreClient); + Q_D(QWebEngineCookieStore); if (d->m_getAllCookiesPending) { d->callbackDirectory.invokeEmpty(resultCallback); return; @@ -321,7 +327,7 @@ void QWebEngineCookieStoreClient::getAllCookies(const QWebEngineCallback<const Q } /*! - \fn void QWebEngineCookieStoreClient::deleteSessionCookiesWithCallback(FunctorOrLambda resultCallback) + \fn void QWebEngineCookieStore::deleteSessionCookiesWithCallback(FunctorOrLambda resultCallback) Deletes all the session cookies in the cookie store. Session cookies do not have an expiration date assigned to them. @@ -329,9 +335,9 @@ void QWebEngineCookieStoreClient::getAllCookies(const QWebEngineCallback<const Q number of cookies deleted as the argument. */ -void QWebEngineCookieStoreClient::deleteSessionCookiesWithCallback(const QWebEngineCallback<int> &resultCallback) +void QWebEngineCookieStore::deleteSessionCookiesWithCallback(const QWebEngineCallback<int> &resultCallback) { - Q_D(QWebEngineCookieStoreClient); + Q_D(QWebEngineCookieStore); if (d->m_deleteAllCookiesPending || d->m_deleteSessionCookiesPending) { d->callbackDirectory.invokeEmpty(resultCallback); return; @@ -341,7 +347,7 @@ void QWebEngineCookieStoreClient::deleteSessionCookiesWithCallback(const QWebEng } /*! - \fn void QWebEngineCookieStoreClient::deleteAllCookiesWithCallback(FunctorOrLambda resultCallback) + \fn void QWebEngineCookieStore::deleteAllCookiesWithCallback(FunctorOrLambda resultCallback) Deletes all the cookies in the cookie store. When the asynchronous operation finishes, \a resultCallback will be called with the number of cookies deleted as the argument. @@ -349,9 +355,9 @@ void QWebEngineCookieStoreClient::deleteSessionCookiesWithCallback(const QWebEng \sa deleteSessionCookiesWithCallback(), getAllCookies() */ -void QWebEngineCookieStoreClient::deleteAllCookiesWithCallback(const QWebEngineCallback<int> &resultCallback) +void QWebEngineCookieStore::deleteAllCookiesWithCallback(const QWebEngineCallback<int> &resultCallback) { - Q_D(QWebEngineCookieStoreClient); + Q_D(QWebEngineCookieStore); if (d->m_deleteAllCookiesPending) { d->callbackDirectory.invokeEmpty(resultCallback); return; @@ -366,7 +372,7 @@ void QWebEngineCookieStoreClient::deleteAllCookiesWithCallback(const QWebEngineC \sa deleteSessionCookiesWithCallback() */ -void QWebEngineCookieStoreClient::deleteSessionCookies() +void QWebEngineCookieStore::deleteSessionCookies() { deleteSessionCookiesWithCallback(QWebEngineCallback<int>()); } @@ -377,13 +383,13 @@ void QWebEngineCookieStoreClient::deleteSessionCookies() \sa deleteAllCookiesWithCallback(), getAllCookies() */ -void QWebEngineCookieStoreClient::deleteAllCookies() +void QWebEngineCookieStore::deleteAllCookies() { deleteAllCookiesWithCallback(QWebEngineCallback<int>()); } /*! - \fn void QWebEngineCookieStoreClient::setCookieFilter(FunctorOrLambda filterCallback) + \fn void QWebEngineCookieStore::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 @@ -394,9 +400,9 @@ void QWebEngineCookieStoreClient::deleteAllCookies() \sa deleteAllCookiesWithCallback(), getAllCookies() */ -void QWebEngineCookieStoreClient::setCookieFilter(const QWebEngineCallback<QWebEngineCookieStoreClient::FilterRequest&> &filter) +void QWebEngineCookieStore::setCookieFilter(const QWebEngineCallback<QWebEngineCookieStore::FilterRequest&> &filter) { - Q_D(QWebEngineCookieStoreClient); + Q_D(QWebEngineCookieStore); d->filterCallback = filter; } diff --git a/src/core/api/qwebenginecookiestoreclient.h b/src/core/api/qwebenginecookiestore.h index 4664a8459..6cbe399f2 100644 --- a/src/core/api/qwebenginecookiestoreclient.h +++ b/src/core/api/qwebenginecookiestore.h @@ -34,8 +34,8 @@ ** ****************************************************************************/ -#ifndef QWEBENGINECOOKIESTORECLIENT_H -#define QWEBENGINECOOKIESTORECLIENT_H +#ifndef QWEBENGINECOOKIESTORE_H +#define QWEBENGINECOOKIESTORE_H #include "qtwebenginecoreglobal.h" #include "qwebenginecallback.h" @@ -52,8 +52,8 @@ class CookieMonsterDelegateQt; QT_BEGIN_NAMESPACE -class QWebEngineCookieStoreClientPrivate; -class QWEBENGINE_EXPORT QWebEngineCookieStoreClient : public QObject { +class QWebEngineCookieStorePrivate; +class QWEBENGINE_EXPORT QWebEngineCookieStore : public QObject { Q_OBJECT public: @@ -64,7 +64,7 @@ public: QByteArray cookieLine; QUrl cookieSource; }; - virtual ~QWebEngineCookieStoreClient(); + virtual ~QWebEngineCookieStore(); #ifdef Q_QDOC void setCookieWithCallback(const QNetworkCookie &cookie, FunctorOrLambda resultCallback, const QUrl &origin = QUrl()); @@ -89,16 +89,16 @@ Q_SIGNALS: void cookieRemoved(const QNetworkCookie &cookie); private: - explicit QWebEngineCookieStoreClient(QObject *parent = 0); + explicit QWebEngineCookieStore(QObject *parent = 0); friend class QtWebEngineCore::BrowserContextAdapter; friend class QtWebEngineCore::CookieMonsterDelegateQt; - Q_DISABLE_COPY(QWebEngineCookieStoreClient) - Q_DECLARE_PRIVATE(QWebEngineCookieStoreClient) - QScopedPointer<QWebEngineCookieStoreClientPrivate> d_ptr; + Q_DISABLE_COPY(QWebEngineCookieStore) + Q_DECLARE_PRIVATE(QWebEngineCookieStore) + QScopedPointer<QWebEngineCookieStorePrivate> d_ptr; }; QT_END_NAMESPACE -Q_DECLARE_METATYPE(QWebEngineCookieStoreClient*) +Q_DECLARE_METATYPE(QWebEngineCookieStore*) -#endif // QWEBENGINECOOKIESTORECLIENT_H +#endif // QWEBENGINECOOKIESTORE_H diff --git a/src/core/api/qwebenginecookiestoreclient_p.h b/src/core/api/qwebenginecookiestore_p.h index 54f3b9eb7..d773c0d3e 100644 --- a/src/core/api/qwebenginecookiestoreclient_p.h +++ b/src/core/api/qwebenginecookiestore_p.h @@ -34,8 +34,8 @@ ** ****************************************************************************/ -#ifndef QWEBENGINECOOKIESTORECLIENT_P_H -#define QWEBENGINECOOKIESTORECLIENT_P_H +#ifndef QWEBENGINECOOKIESTORE_P_H +#define QWEBENGINECOOKIESTORE_P_H // // W A R N I N G @@ -51,7 +51,7 @@ #include "qtwebenginecoreglobal_p.h" #include "qwebenginecallback_p.h" -#include "qwebenginecookiestoreclient.h" +#include "qwebenginecookiestore.h" #include <QVector> #include <QNetworkCookie> @@ -63,7 +63,7 @@ class CookieMonsterDelegateQt; QT_BEGIN_NAMESPACE -class QWEBENGINE_PRIVATE_EXPORT QWebEngineCookieStoreClientPrivate { +class QWEBENGINE_PRIVATE_EXPORT QWebEngineCookieStorePrivate { struct CookieData { quint64 callbackId; QNetworkCookie cookie; @@ -71,9 +71,9 @@ class QWEBENGINE_PRIVATE_EXPORT QWebEngineCookieStoreClientPrivate { }; friend class QTypeInfo<CookieData>; public: - Q_DECLARE_PUBLIC(QWebEngineCookieStoreClient) + Q_DECLARE_PUBLIC(QWebEngineCookieStore) QtWebEngineCore::CallbackDirectory callbackDirectory; - QWebEngineCallback<QWebEngineCookieStoreClient::FilterRequest&> filterCallback; + QWebEngineCallback<QWebEngineCookieStore::FilterRequest&> filterCallback; QVector<CookieData> m_pendingUserCookies; quint64 m_nextCallbackId; bool m_deleteSessionCookiesPending; @@ -81,10 +81,9 @@ public: bool m_getAllCookiesPending; QtWebEngineCore::CookieMonsterDelegateQt *delegate; - QWebEngineCookieStoreClient *q_ptr; + QWebEngineCookieStore *q_ptr; - QWebEngineCookieStoreClientPrivate(QWebEngineCookieStoreClient *q); - ~QWebEngineCookieStoreClientPrivate(); + QWebEngineCookieStorePrivate(QWebEngineCookieStore *q); void processPendingUserCookies(); void setCookie(const QWebEngineCallback<bool> &callback, const QNetworkCookie &cookie, const QUrl &origin); @@ -101,8 +100,8 @@ public: void onCookieChanged(const QNetworkCookie &cookie, bool removed); }; -Q_DECLARE_TYPEINFO(QWebEngineCookieStoreClientPrivate::CookieData, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(QWebEngineCookieStorePrivate::CookieData, Q_MOVABLE_TYPE); QT_END_NAMESPACE -#endif // QWEBENGINECOOKIESTORECLIENT_P_H +#endif // QWEBENGINECOOKIESTORE_P_H diff --git a/src/core/api/qwebengineurlrequestinfo.cpp b/src/core/api/qwebengineurlrequestinfo.cpp index e8ce65be3..79801d190 100644 --- a/src/core/api/qwebengineurlrequestinfo.cpp +++ b/src/core/api/qwebengineurlrequestinfo.cpp @@ -101,12 +101,6 @@ ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::OtherNavigation, Q */ /*! - \fn QWebEngineUrlRequestInterceptor::~QWebEngineUrlRequestInterceptor() - - Destroys this QWebEngineUrlRequestInterceptor object. -*/ - -/*! \fn bool QWebEngineUrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info) Reimplementing this virtual function and setting the interceptor on a profile makes @@ -126,6 +120,7 @@ QWebEngineUrlRequestInfoPrivate::QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRe , url(u) , firstPartyUrl(fpu) , method(m) + , changed(false) { } @@ -241,6 +236,12 @@ QByteArray QWebEngineUrlRequestInfo::requestMethod() const return d->method; } +bool QWebEngineUrlRequestInfo::changed() const +{ + Q_D(const QWebEngineUrlRequestInfo); + return d->changed; +} + /*! Redirects this request to \a url. It is only possible to redirect requests that do not have payload data, such as GET requests. @@ -249,6 +250,7 @@ QByteArray QWebEngineUrlRequestInfo::requestMethod() const void QWebEngineUrlRequestInfo::redirect(const QUrl &url) { Q_D(QWebEngineUrlRequestInfo); + d->changed = true; d->url = url; } @@ -261,16 +263,18 @@ void QWebEngineUrlRequestInfo::redirect(const QUrl &url) void QWebEngineUrlRequestInfo::block(bool shouldBlock) { Q_D(QWebEngineUrlRequestInfo); + d->changed = true; d->shouldBlockRequest = shouldBlock; } /*! - Sets an extra request header for this request with \a name and \a value. + Sets the request header \a name to \a value for this request. */ -void QWebEngineUrlRequestInfo::setExtraHeader(const QByteArray &name, const QByteArray &value) +void QWebEngineUrlRequestInfo::setHttpHeader(const QByteArray &name, const QByteArray &value) { Q_D(QWebEngineUrlRequestInfo); + d->changed = true; d->extraHeaders.insert(name, value); } diff --git a/src/core/api/qwebengineurlrequestinfo.h b/src/core/api/qwebengineurlrequestinfo.h index e6e225051..008df7751 100644 --- a/src/core/api/qwebengineurlrequestinfo.h +++ b/src/core/api/qwebengineurlrequestinfo.h @@ -88,10 +88,11 @@ public: QUrl requestUrl() const; QUrl firstPartyUrl() const; QByteArray requestMethod() const; + bool changed() const; void block(bool shouldBlock); void redirect(const QUrl &url); - void setExtraHeader(const QByteArray &name, const QByteArray &value); + void setHttpHeader(const QByteArray &name, const QByteArray &value); private: friend class QtWebEngineCore::NetworkDelegateQt; diff --git a/src/core/api/qwebengineurlrequestinfo_p.h b/src/core/api/qwebengineurlrequestinfo_p.h index 1b1279d27..df5f18d6e 100644 --- a/src/core/api/qwebengineurlrequestinfo_p.h +++ b/src/core/api/qwebengineurlrequestinfo_p.h @@ -68,6 +68,7 @@ public: QUrl url; QUrl firstPartyUrl; const QByteArray method; + bool changed; QHash<QByteArray, QByteArray> extraHeaders; QWebEngineUrlRequestInfo *q_ptr; diff --git a/src/core/api/qwebengineurlrequestinterceptor.h b/src/core/api/qwebengineurlrequestinterceptor.h index 72f3452d0..372ee9066 100644 --- a/src/core/api/qwebengineurlrequestinterceptor.h +++ b/src/core/api/qwebengineurlrequestinterceptor.h @@ -56,11 +56,8 @@ public: : QObject (p) { } - virtual ~QWebEngineUrlRequestInterceptor() - { - } - virtual bool interceptRequest(QWebEngineUrlRequestInfo &info) = 0; + virtual void interceptRequest(QWebEngineUrlRequestInfo &info) = 0; }; QT_END_NAMESPACE diff --git a/src/core/api/qwebengineurlschemehandler.cpp b/src/core/api/qwebengineurlschemehandler.cpp index 7f9ebaf48..485db0b4b 100644 --- a/src/core/api/qwebengineurlschemehandler.cpp +++ b/src/core/api/qwebengineurlschemehandler.cpp @@ -53,12 +53,6 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QWebEngineUrlSchemeHandler::destroyed(QWebEngineUrlSchemeHandler *handler) - - This signal is emitted when the custom URL scheme handler \a handler is deleted. -*/ - -/*! Constructs a new URL scheme handler. The handler is created with the parent \a parent. @@ -74,7 +68,7 @@ QWebEngineUrlSchemeHandler::QWebEngineUrlSchemeHandler(QObject *parent) */ QWebEngineUrlSchemeHandler::~QWebEngineUrlSchemeHandler() { - Q_EMIT destroyed(this); + Q_EMIT _q_destroyedUrlSchemeHandler(this); } /*! diff --git a/src/core/api/qwebengineurlschemehandler.h b/src/core/api/qwebengineurlschemehandler.h index 66aebe00d..fa24987c5 100644 --- a/src/core/api/qwebengineurlschemehandler.h +++ b/src/core/api/qwebengineurlschemehandler.h @@ -57,8 +57,10 @@ public: virtual void requestStarted(QWebEngineUrlRequestJob*) = 0; +#ifndef Q_QDOC Q_SIGNALS: - void destroyed(QWebEngineUrlSchemeHandler*); + void _q_destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*); +#endif private: Q_DISABLE_COPY(QWebEngineUrlSchemeHandler) diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp index b5fdf2ce0..7b40688a1 100644 --- a/src/core/browser_context_adapter.cpp +++ b/src/core/browser_context_adapter.cpp @@ -136,11 +136,11 @@ DownloadManagerDelegateQt *BrowserContextAdapter::downloadManagerDelegate() return m_downloadManagerDelegate.data(); } -QWebEngineCookieStoreClient *BrowserContextAdapter::cookieStoreClient() +QWebEngineCookieStore *BrowserContextAdapter::cookieStore() { - if (!m_cookieStoreClient) - m_cookieStoreClient.reset(new QWebEngineCookieStoreClient); - return m_cookieStoreClient.data(); + if (!m_cookieStore) + m_cookieStore.reset(new QWebEngineCookieStore); + return m_cookieStore.data(); } QWebEngineUrlRequestInterceptor *BrowserContextAdapter::requestInterceptor() diff --git a/src/core/browser_context_adapter.h b/src/core/browser_context_adapter.h index 818dfda3d..97a4dca4a 100644 --- a/src/core/browser_context_adapter.h +++ b/src/core/browser_context_adapter.h @@ -46,7 +46,7 @@ #include <QString> #include <QVector> -#include "api/qwebenginecookiestoreclient.h" +#include "api/qwebenginecookiestore.h" #include "api/qwebengineurlrequestinterceptor.h" #include "api/qwebengineurlschemehandler.h" @@ -73,7 +73,7 @@ public: WebEngineVisitedLinksManager *visitedLinksManager(); DownloadManagerDelegateQt *downloadManagerDelegate(); - QWebEngineCookieStoreClient *cookieStoreClient(); + QWebEngineCookieStore *cookieStore(); QWebEngineUrlRequestInterceptor* requestInterceptor(); void setRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor); @@ -164,7 +164,7 @@ private: QScopedPointer<WebEngineVisitedLinksManager> m_visitedLinksManager; QScopedPointer<DownloadManagerDelegateQt> m_downloadManagerDelegate; QScopedPointer<UserScriptControllerHost> m_userScriptController; - QScopedPointer<QWebEngineCookieStoreClient> m_cookieStoreClient; + QScopedPointer<QWebEngineCookieStore> m_cookieStore; QPointer<QWebEngineUrlRequestInterceptor> m_requestInterceptor; QString m_dataPath; diff --git a/src/core/config/windows.pri b/src/core/config/windows.pri index f0c0c8f43..1e875f308 100644 --- a/src/core/config/windows.pri +++ b/src/core/config/windows.pri @@ -28,6 +28,25 @@ contains(QT_CONFIG, angle) { GYP_ARGS += "-D qt_gl=\"opengl\"" } +defineTest(usingMSVC32BitCrossCompiler) { + CL_DIR = + for(dir, QMAKE_PATH_ENV) { + exists($$dir/cl.exe) { + CL_DIR = $$dir + break() + } + } + isEmpty(CL_DIR): { + warning(Cannot determine location of cl.exe.) + return(false) + } + CL_DIR = $$system_path($$CL_DIR) + CL_DIR = $$split(CL_DIR, \\) + CL_PLATFORM = $$last(CL_DIR) + equals(CL_PLATFORM, amd64_x86): return(true) + return(false) +} + msvc { equals(MSVC_VER, 12.0) { MSVS_VERSION = 2013 @@ -44,6 +63,11 @@ msvc { # is building for, not the system's actual architecture. PROGRAM_FILES_X86 = $$(ProgramW6432) isEmpty(PROGRAM_FILES_X86): GYP_ARGS += "-D windows_sdk_path=\"C:/Program Files/Windows Kits/8.1\"" + + contains(QT_ARCH, "i386"):!usingMSVC32BitCrossCompiler() { + # The 32 bit MSVC linker runs out of memory if we do not remove all debug information. + GYP_CONFIG += fastbuild=2 + } } else { fatal("Qt WebEngine for Windows can only be built with the Microsoft Visual Studio C++ compiler") } diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index 48e563a47..59991d558 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -106,10 +106,19 @@ void AddPepperFlashFromSystem(std::vector<content::PepperPluginInfo>* plugins) { QStringList pluginPaths; #if defined(Q_OS_WIN) && defined(Q_PROCESSOR_X86_32) - QDir pluginDir("C:/Windows/SysWOW64/Macromed/Flash"); - pluginDir.setFilter(QDir::Files); - QStringList nameFilters("pepflashplayer*.dll"); - pluginPaths << pluginDir.entryList(nameFilters); + QString winDir = QDir::fromNativeSeparators(qgetenv("WINDIR")); + if (winDir.isEmpty()) + winDir = QString::fromLatin1("C:/Windows"); + + const QStringList pluginDirs = { winDir + "/SysWOW64/Macromed/Flash", + winDir + "/System32/Macromed/Flash" }; + const QStringList nameFilters("pepflashplayer*.dll"); + Q_FOREACH (const QString &dirPath, pluginDirs) { + QDir pluginDir(dirPath); + pluginDir.setFilter(QDir::Files); + Q_FOREACH (const QFileInfo &info, pluginDir.entryInfoList(nameFilters)) + pluginPaths << info.absoluteFilePath(); + } #endif #if defined(Q_OS_OSX) pluginPaths << "/Library/Internet Plug-Ins/PepperFlashPlayer/PepperFlashPlayer.plugin"; // Mac OS X diff --git a/src/core/cookie_monster_delegate_qt.cpp b/src/core/cookie_monster_delegate_qt.cpp index 7622614ca..a81670a6c 100644 --- a/src/core/cookie_monster_delegate_qt.cpp +++ b/src/core/cookie_monster_delegate_qt.cpp @@ -40,8 +40,8 @@ #include "content/public/browser/browser_thread.h" #include "net/cookies/cookie_util.h" -#include "api/qwebenginecookiestoreclient.h" -#include "api/qwebenginecookiestoreclient_p.h" +#include "api/qwebenginecookiestore.h" +#include "api/qwebenginecookiestore_p.h" #include "type_conversion.h" #include <QStringBuilder> @@ -53,15 +53,15 @@ static GURL sourceUrlForCookie(const QNetworkCookie &cookie) { return net::cookie_util::CookieOriginToURL(urlFragment.toStdString(), /* is_https */ cookie.isSecure()); } -static void onSetCookieCallback(QWebEngineCookieStoreClientPrivate *client, qint64 callbackId, bool success) { +static void onSetCookieCallback(QWebEngineCookieStorePrivate *client, qint64 callbackId, bool success) { client->onSetCallbackResult(callbackId, success); } -static void onDeleteCookiesCallback(QWebEngineCookieStoreClientPrivate *client, qint64 callbackId, int numCookies) { +static void onDeleteCookiesCallback(QWebEngineCookieStorePrivate *client, qint64 callbackId, int numCookies) { client->onDeleteCallbackResult(callbackId, numCookies); } -static void onGetAllCookiesCallback(QWebEngineCookieStoreClientPrivate *client, qint64 callbackId, const net::CookieList& cookies) { +static void onGetAllCookiesCallback(QWebEngineCookieStorePrivate *client, qint64 callbackId, const net::CookieList& cookies) { QByteArray rawCookies; for (auto&& cookie: cookies) rawCookies += toQt(cookie).toRawForm() % QByteArrayLiteral("\n"); @@ -145,7 +145,7 @@ void CookieMonsterDelegateQt::setCookieMonster(net::CookieMonster* monster) m_client->d_func()->processPendingUserCookies(); } -void CookieMonsterDelegateQt::setClient(QWebEngineCookieStoreClient *client) +void CookieMonsterDelegateQt::setClient(QWebEngineCookieStore *client) { m_client = client; diff --git a/src/core/cookie_monster_delegate_qt.h b/src/core/cookie_monster_delegate_qt.h index db80bf0a1..c9f27c2bc 100644 --- a/src/core/cookie_monster_delegate_qt.h +++ b/src/core/cookie_monster_delegate_qt.h @@ -50,7 +50,7 @@ QT_WARNING_POP #include <QNetworkCookie> #include <QPointer> -QT_FORWARD_DECLARE_CLASS(QWebEngineCookieStoreClient) +QT_FORWARD_DECLARE_CLASS(QWebEngineCookieStore) namespace QtWebEngineCore { @@ -62,7 +62,7 @@ static const char* const kCookieableSchemes[] = { "http", "https", "qrc", "ws", "wss" }; class QWEBENGINE_EXPORT CookieMonsterDelegateQt: public net::CookieMonsterDelegate { - QPointer<QWebEngineCookieStoreClient> m_client; + QPointer<QWebEngineCookieStore> m_client; scoped_refptr<net::CookieMonster> m_cookieMonster; public: CookieMonsterDelegateQt(); @@ -77,7 +77,7 @@ public: void deleteAllCookies(quint64 callbackId); void setCookieMonster(net::CookieMonster* monster); - void setClient(QWebEngineCookieStoreClient *client); + void setClient(QWebEngineCookieStore *client); bool canSetCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &url); void OnCookieChanged(const net::CanonicalCookie& cookie, bool removed, ChangeCause cause) override; diff --git a/src/core/doc/src/qtwebenginecore-module.qdoc b/src/core/doc/src/qtwebenginecore-module.qdoc index 750a0244e..d0224c834 100644 --- a/src/core/doc/src/qtwebenginecore-module.qdoc +++ b/src/core/doc/src/qtwebenginecore-module.qdoc @@ -39,6 +39,12 @@ \snippet qtwebenginecore_build_snippet.qdoc 1 If you use qmake to build your projects, Qt WebEngine Core is usually - indirectly included through the \l[QtWebEngine]{Qt WebEngine} or - \l[QtWebEngineWidgets]{Qt WebEngine Widgets} modules. + indirectly included through the \l{Qt WebEngine QML Types}{Qt WebEngine} or + \l{Qt WebEngine Widgets C++ Classes}{Qt WebEngine Widgets} modules. + + To link against the module, add this line to your qmake project file: + + \snippet qtwebenginecore_build_snippet.qdoc 0 + + However, \c webenginecore is implied by adding \c webengine or \c webenginewidgets. */ diff --git a/src/core/gyp_run.pro b/src/core/gyp_run.pro index def7d4698..79e1dca64 100644 --- a/src/core/gyp_run.pro +++ b/src/core/gyp_run.pro @@ -83,6 +83,7 @@ contains(QT_ARCH, "arm") { contains(QT_ARCH, "x86_64"): GYP_CONFIG += target_arch=x64 contains(QT_ARCH, "i386"): GYP_CONFIG += target_arch=ia32 +contains(QT_ARCH, "arm64"): GYP_CONFIG += target_arch=arm64 contains(WEBENGINE_CONFIG, use_proprietary_codecs): GYP_CONFIG += proprietary_codecs=1 ffmpeg_branding=Chrome diff --git a/src/core/network_delegate_qt.cpp b/src/core/network_delegate_qt.cpp index 5e6b71e67..a80003a55 100644 --- a/src/core/network_delegate_qt.cpp +++ b/src/core/network_delegate_qt.cpp @@ -109,7 +109,8 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, const net::C , toQt(request->first_party_for_cookies()) , QByteArray::fromStdString(request->method())); QWebEngineUrlRequestInfo requestInfo(infoPrivate); - if (interceptor->interceptRequest(requestInfo)) { + interceptor->interceptRequest(requestInfo); + if (requestInfo.changed()) { int result = infoPrivate->shouldBlockRequest ? net::ERR_ABORTED : net::OK; if (qUrl != infoPrivate->url) diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index d2d292ee9..f8edcdfc9 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -75,6 +75,7 @@ #include <QTextFormat> #include <QKeyEvent> #include <QMouseEvent> +#include <QPixmap> #include <QScreen> #include <QStyleHints> #include <QVariant> @@ -534,7 +535,12 @@ void RenderWidgetHostViewQt::UpdateCursor(const content::WebCursor &webCursor) shape = Qt::ClosedHandCursor; break; case blink::WebCursorInfo::TypeCustom: - // FIXME: Extract from the CursorInfo. + if (cursorInfo.custom_image.colorType() == SkColorType::kN32_SkColorType) { + QImage cursor = toQImage(cursorInfo.custom_image, QImage::Format_ARGB32); + m_delegate->updateCursor(QCursor(QPixmap::fromImage(cursor))); + return; + } + // Use arrow cursor as fallback in case the Chromium implementation changes. shape = Qt::ArrowCursor; break; default: diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h index 84b66c62c..abc002ea5 100644 --- a/src/core/type_conversion.h +++ b/src/core/type_conversion.h @@ -40,6 +40,7 @@ #include <QColor> #include <QDateTime> #include <QDir> +#include <QImage> #include <QMatrix4x4> #include <QNetworkCookie> #include <QRect> @@ -49,8 +50,10 @@ #include "base/time/time.h" #include "content/public/common/file_chooser_file_info.h" #include "net/cookies/canonical_cookie.h" -#include "third_party/skia/include/utils/SkMatrix44.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkColor.h" +#include "third_party/skia/include/core/SkPixelRef.h" +#include "third_party/skia/include/utils/SkMatrix44.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect_f.h" #include "url/gurl.h" @@ -140,6 +143,12 @@ inline SkColor toSk(const QColor &c) return c.rgba(); } +inline QImage toQImage(const SkBitmap &bitmap, QImage::Format format) +{ + SkPixelRef *pixelRef = bitmap.pixelRef(); + return QImage((uchar *)pixelRef->pixels(), bitmap.width(), bitmap.height(), format); +} + inline QMatrix4x4 toQt(const SkMatrix44 &m) { QMatrix4x4 qtMatrix( diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp index 32ceb5db5..121a103b0 100644 --- a/src/core/url_request_context_getter_qt.cpp +++ b/src/core/url_request_context_getter_qt.cpp @@ -74,8 +74,8 @@ #include "network_delegate_qt.h" #include "proxy_config_service_qt.h" #include "qrc_protocol_handler_qt.h" -#include "qwebenginecookiestoreclient.h" -#include "qwebenginecookiestoreclient_p.h" +#include "qwebenginecookiestore.h" +#include "qwebenginecookiestore_p.h" #include "type_conversion.h" namespace QtWebEngineCore { @@ -204,7 +204,7 @@ void URLRequestContextGetterQt::generateCookieStore() // Unset it first to get a chance to destroy and flush the old cookie store before before opening a new on possibly the same file. m_storage->set_cookie_store(0); m_cookieDelegate->setCookieMonster(0); - m_cookieDelegate->setClient(m_browserContext->cookieStoreClient()); + m_cookieDelegate->setClient(m_browserContext->cookieStore()); net::CookieStore* cookieStore = 0; switch (m_browserContext->persistentCookiesPolicy()) { diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 2d707149d..f1c9a7f34 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -107,6 +107,7 @@ content::WebContents *WebContentsDelegateQt::OpenURLFromTab(content::WebContents load_url_params.extra_headers = params.extra_headers; load_url_params.should_replace_current_entry = params.should_replace_current_entry; load_url_params.is_renderer_initiated = params.is_renderer_initiated; + load_url_params.override_user_agent = content::NavigationController::UA_OVERRIDE_TRUE; if (params.transferred_global_request_id != content::GlobalRequestID()) load_url_params.transferred_global_request_id = params.transferred_global_request_id; |