summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-07-23 10:59:10 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-08-10 13:56:48 +0000
commitf21f37496501199d0e50b3b4375add235a05a3ec (patch)
tree01023f21d4de2273045262cfdb4972fe3160687a /src
parent0746e419c1ad5648028d58edd4a2c68fcf586f79 (diff)
Remove QWebEngineCallback
Was no longer used in exposed APIs Fixes: QTBUG-74588 Change-Id: Iaf4943983655fc79e67df28f5cd4c4961b360579 Reviewed-by: Michal Klocek <michal.klocek@qt.io> (cherry picked from commit c4d794898394d7d0f79001a04c8cff50dbc4fba7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/core/api/CMakeLists.txt1
-rw-r--r--src/core/api/qwebenginecallback.h101
-rw-r--r--src/core/api/qwebenginecallback_p.h253
-rw-r--r--src/core/api/qwebenginecookiestore.cpp54
-rw-r--r--src/core/api/qwebenginecookiestore_p.h10
-rw-r--r--src/core/find_text_helper.h6
-rw-r--r--src/core/net/cookie_monster_delegate_qt.cpp43
-rw-r--r--src/core/net/cookie_monster_delegate_qt.h13
-rw-r--r--src/core/web_contents_adapter.cpp21
9 files changed, 37 insertions, 465 deletions
diff --git a/src/core/api/CMakeLists.txt b/src/core/api/CMakeLists.txt
index e1fa62cd7..cee72966d 100644
--- a/src/core/api/CMakeLists.txt
+++ b/src/core/api/CMakeLists.txt
@@ -13,7 +13,6 @@ qt_internal_add_module(WebEngineCore
${configureMode}
SOURCES
qtwebenginecoreglobal.cpp qtwebenginecoreglobal.h qtwebenginecoreglobal_p.h
- qwebenginecallback.h qwebenginecallback_p.h
qwebenginecertificateerror.cpp qwebenginecertificateerror.h
qwebengineclientcertificateselection.cpp qwebengineclientcertificateselection.h
qwebengineclientcertificatestore.cpp qwebengineclientcertificatestore.h
diff --git a/src/core/api/qwebenginecallback.h b/src/core/api/qwebenginecallback.h
deleted file mode 100644
index 49efc50b2..000000000
--- a/src/core/api/qwebenginecallback.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWEBENGINECALLBACK_H
-#define QWEBENGINECALLBACK_H
-
-#include <QtWebEngineCore/qtwebenginecoreglobal.h>
-
-#include <QtCore/qshareddata.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qvariant.h>
-
-namespace QtWebEngineCore {
-class CallbackDirectory;
-}
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWebEnginePrivate {
-
-template<typename T>
-class QWebEngineCallbackPrivateBase : public QSharedData {
-public:
- QWebEngineCallbackPrivateBase() {}
- virtual ~QWebEngineCallbackPrivateBase() {}
- virtual void operator()(T) = 0;
-};
-
-template<typename T, typename F>
-class QWebEngineCallbackPrivate : public QWebEngineCallbackPrivateBase<T> {
-public:
- QWebEngineCallbackPrivate(F callable) : m_callable(callable) {}
- void operator()(T value) override { m_callable(value); }
-
-private:
- F m_callable;
-};
-
-} // namespace QtWebEnginePrivate
-
-template<typename T>
-class QWebEngineCallback {
-public:
- template<typename F>
- QWebEngineCallback(F f)
- : d(new QtWebEnginePrivate::QWebEngineCallbackPrivate<T, F>(f))
- {}
- QWebEngineCallback() {}
- void swap(QWebEngineCallback &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
- operator bool() const { return d; }
-
-private:
- friend class QtWebEngineCore::CallbackDirectory;
- QExplicitlySharedDataPointer<QtWebEnginePrivate::QWebEngineCallbackPrivateBase<T>> d;
-};
-
-Q_DECLARE_SHARED(QWebEngineCallback<int>)
-Q_DECLARE_SHARED(QWebEngineCallback<const QByteArray &>)
-Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineCallback<bool>)
-Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineCallback<const QString &>)
-Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineCallback<const QVariant &>)
-
-QT_END_NAMESPACE
-
-#endif // QWEBENGINECALLBACK_H
diff --git a/src/core/api/qwebenginecallback_p.h b/src/core/api/qwebenginecallback_p.h
deleted file mode 100644
index 9cc25b7fd..000000000
--- a/src/core/api/qwebenginecallback_p.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWEBENGINECALLBACK_P_H
-#define QWEBENGINECALLBACK_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 "qtwebenginecoreglobal_p.h"
-#include "qwebenginecallback.h"
-
-#include <QByteArray>
-#include <QHash>
-#include <QSharedData>
-#include <QString>
-#include <QVariant>
-#include <type_traits>
-
-// keep in sync with Q_DECLARE_SHARED... in qwebenginecallback.h
-#define FOR_EACH_TYPE(F) \
- F(bool) \
- F(int) \
- F(const QString &) \
- F(const QByteArray &) \
- F(const QVariant &)
-
-namespace QtWebEngineCore {
-
-class CallbackDirectory {
- template<typename T>
- void invokeInternal(quint64 callbackId, T result);
- template<typename T>
- void invokeEmptyInternal(QtWebEnginePrivate::QWebEngineCallbackPrivateBase<T> *callback);
-
-public:
- ~CallbackDirectory()
- {
- // "Cancel" pending callbacks by calling them with an invalid value.
- // This guarantees that each callback is called exactly once.
- for (CallbackSharedDataPointerBase *const sharedPtrBase : m_callbackMap) {
- Q_ASSERT(sharedPtrBase);
- sharedPtrBase->invokeEmpty();
- delete sharedPtrBase;
- }
- }
-
- enum ReservedCallbackIds {
- NoCallbackId = 0,
- DeleteCookieCallbackId,
- DeleteSessionCookiesCallbackId,
- DeleteAllCookiesCallbackId,
- GetAllCookiesCallbackId,
-
- // Place reserved id's before this.
- ReservedCallbackIdsEnd
- };
-
- template<typename T>
- void registerCallback(quint64 callbackId, const QWebEngineCallback<T> &callback);
-
- template<typename T>
- void invokeEmpty(const QWebEngineCallback<T> &callback);
-
-#define DEFINE_INVOKE_FOR_TYPE(Type) \
- void invoke(quint64 callbackId, Type result) { invokeInternal<Type>(callbackId, std::forward<Type>(result)); }
- FOR_EACH_TYPE(DEFINE_INVOKE_FOR_TYPE)
-#undef DEFINE_INVOKE_FOR_TYPE
-
- template<typename A>
- void invokeDirectly(const QWebEngineCallback<typename std::remove_reference<A>::type &> &callback, A &argument)
- {
- return callback.d.data()->operator()(argument);
- }
-
- template<typename A>
- void invokeDirectly(const QWebEngineCallback<typename std::remove_reference<A>::type> &callback, const A &argument)
- {
- return callback.d.data()->operator()(std::forward<const A &>(argument));
- }
-
-private:
- struct CallbackSharedDataPointerBase {
- virtual ~CallbackSharedDataPointerBase() {}
- virtual void invokeEmpty() = 0;
- virtual void doRef() = 0;
- virtual void doDeref() = 0;
- virtual operator bool() const = 0;
- };
-
- template<typename T>
- struct CallbackSharedDataPointer : public CallbackSharedDataPointerBase {
- CallbackDirectory *parent;
- QtWebEnginePrivate::QWebEngineCallbackPrivateBase<T> *callback;
-
- ~CallbackSharedDataPointer() { doDeref(); }
- CallbackSharedDataPointer() : parent(0), callback(0) {}
- CallbackSharedDataPointer(const CallbackSharedDataPointer<T> &other)
- : parent(other.parent), callback(other.callback)
- {
- doRef();
- }
- CallbackSharedDataPointer(CallbackDirectory *p, QtWebEnginePrivate::QWebEngineCallbackPrivateBase<T> *c)
- : parent(p), callback(c)
- {
- Q_ASSERT(callback);
- doRef();
- }
-
- void invokeEmpty() override;
- operator bool() const override { return callback; }
-
- private:
- void doRef() override;
- void doDeref() override;
- };
-
- QHash<quint64, CallbackSharedDataPointerBase *> m_callbackMap;
-};
-
-template<typename T>
-inline void CallbackDirectory::registerCallback(quint64 callbackId, const QWebEngineCallback<T> &callback)
-{
- if (!callback.d)
- return;
- m_callbackMap.insert(callbackId, new CallbackSharedDataPointer<T>(this, callback.d.data()));
-}
-
-template<typename T>
-inline void CallbackDirectory::invokeInternal(quint64 callbackId, T result)
-{
- CallbackSharedDataPointerBase *const sharedPtrBase = m_callbackMap.take(callbackId);
- if (!sharedPtrBase)
- return;
-
- auto ptr = static_cast<CallbackSharedDataPointer<T> *>(sharedPtrBase);
- Q_ASSERT(ptr);
- (*ptr->callback)(std::forward<T>(result));
- delete ptr;
-}
-
-template<typename T>
-inline void CallbackDirectory::invokeEmptyInternal(QtWebEnginePrivate::QWebEngineCallbackPrivateBase<T> *callback)
-{
- Q_ASSERT(callback);
- using NoRefT = typename std::remove_reference<T>::type;
- using NoConstNoRefT = typename std::remove_const<NoRefT>::type;
- NoConstNoRefT t;
- (*callback)(t);
-}
-
-template<>
-inline void CallbackDirectory::invokeEmptyInternal(QtWebEnginePrivate::QWebEngineCallbackPrivateBase<bool> *callback)
-{
- Q_ASSERT(callback);
- (*callback)(false);
-}
-
-template<>
-inline void CallbackDirectory::invokeEmptyInternal(QtWebEnginePrivate::QWebEngineCallbackPrivateBase<int> *callback)
-{
- Q_ASSERT(callback);
- (*callback)(0);
-}
-
-template<typename T>
-inline void CallbackDirectory::invokeEmpty(const QWebEngineCallback<T> &callback)
-{
- if (!callback.d)
- return;
-
- invokeEmptyInternal(callback.d.data());
-}
-
-template<typename T>
-inline void CallbackDirectory::CallbackSharedDataPointer<T>::doRef()
-{
- if (!callback)
- return;
-
- callback->ref.ref();
-}
-
-template<typename T>
-inline void CallbackDirectory::CallbackSharedDataPointer<T>::doDeref()
-{
- if (!callback)
- return;
- if (!callback->ref.deref())
- delete callback;
-}
-
-template<typename T>
-inline void CallbackDirectory::CallbackSharedDataPointer<T>::invokeEmpty()
-{
- if (!callback)
- return;
-
- Q_ASSERT(parent);
- parent->invokeEmptyInternal(callback);
-}
-
-#define CHECK_RELOCATABLE(x) Q_STATIC_ASSERT((QTypeInfo<QWebEngineCallback<x>>::isRelocatable));
-FOR_EACH_TYPE(CHECK_RELOCATABLE)
-#undef CHECK_RELOCATABLE
-
-} // namespace QtWebEngineCore
-
-#endif // QWEBENGINECALLBACK_P_H
diff --git a/src/core/api/qwebenginecookiestore.cpp b/src/core/api/qwebenginecookiestore.cpp
index f24ac7b27..e8d552caf 100644
--- a/src/core/api/qwebenginecookiestore.cpp
+++ b/src/core/api/qwebenginecookiestore.cpp
@@ -62,7 +62,6 @@ using namespace QtWebEngineCore;
QWebEngineCookieStorePrivate::QWebEngineCookieStorePrivate(QWebEngineCookieStore *q)
: q_ptr(q)
- , m_nextCallbackId(CallbackDirectory::ReservedCallbackIdsEnd)
, m_deleteSessionCookiesPending(false)
, m_deleteAllCookiesPending(false)
, m_getAllCookiesPending(false)
@@ -76,17 +75,17 @@ void QWebEngineCookieStorePrivate::processPendingUserCookies()
if (m_getAllCookiesPending) {
m_getAllCookiesPending = false;
- delegate->getAllCookies(CallbackDirectory::GetAllCookiesCallbackId);
+ delegate->getAllCookies();
}
if (m_deleteAllCookiesPending) {
m_deleteAllCookiesPending = false;
- delegate->deleteAllCookies(CallbackDirectory::DeleteAllCookiesCallbackId);
+ delegate->deleteAllCookies();
}
if (m_deleteSessionCookiesPending) {
m_deleteSessionCookiesPending = false;
- delegate->deleteSessionCookies(CallbackDirectory::DeleteSessionCookiesCallbackId);
+ delegate->deleteSessionCookies();
}
if (bool(filterCallback))
@@ -96,10 +95,10 @@ void QWebEngineCookieStorePrivate::processPendingUserCookies()
return;
for (const CookieData &cookieData : qAsConst(m_pendingUserCookies)) {
- if (cookieData.callbackId == CallbackDirectory::DeleteCookieCallbackId)
+ if (cookieData.wasDelete)
delegate->deleteCookie(cookieData.cookie, cookieData.origin);
else
- delegate->setCookie(cookieData.callbackId, cookieData.cookie, cookieData.origin);
+ delegate->setCookie(cookieData.cookie, cookieData.origin);
}
m_pendingUserCookies.clear();
@@ -113,26 +112,20 @@ void QWebEngineCookieStorePrivate::rejectPendingUserCookies()
m_pendingUserCookies.clear();
}
-void QWebEngineCookieStorePrivate::setCookie(const QWebEngineCallback<bool> &callback, const QNetworkCookie &cookie,
- const QUrl &origin)
+void QWebEngineCookieStorePrivate::setCookie(const QNetworkCookie &cookie, const QUrl &origin)
{
- const quint64 currentCallbackId = callback ? m_nextCallbackId++ : static_cast<quint64>(CallbackDirectory::NoCallbackId);
-
- if (currentCallbackId != CallbackDirectory::NoCallbackId)
- callbackDirectory.registerCallback(currentCallbackId, callback);
-
if (!delegate || !delegate->hasCookieMonster()) {
- m_pendingUserCookies.append(CookieData{ currentCallbackId, cookie, origin });
+ m_pendingUserCookies.append(CookieData{ false, cookie, origin });
return;
}
- delegate->setCookie(currentCallbackId, cookie, origin);
+ delegate->setCookie(cookie, origin);
}
void QWebEngineCookieStorePrivate::deleteCookie(const QNetworkCookie &cookie, const QUrl &url)
{
if (!delegate || !delegate->hasCookieMonster()) {
- m_pendingUserCookies.append(CookieData{ CallbackDirectory::DeleteCookieCallbackId, cookie, url });
+ m_pendingUserCookies.append(CookieData{ true, cookie, url });
return;
}
@@ -146,7 +139,7 @@ void QWebEngineCookieStorePrivate::deleteSessionCookies()
return;
}
- delegate->deleteSessionCookies(CallbackDirectory::DeleteSessionCookiesCallbackId);
+ delegate->deleteSessionCookies();
}
void QWebEngineCookieStorePrivate::deleteAllCookies()
@@ -157,7 +150,7 @@ void QWebEngineCookieStorePrivate::deleteAllCookies()
return;
}
- delegate->deleteAllCookies(CallbackDirectory::DeleteAllCookiesCallbackId);
+ delegate->deleteAllCookies();
}
void QWebEngineCookieStorePrivate::getAllCookies()
@@ -167,22 +160,9 @@ void QWebEngineCookieStorePrivate::getAllCookies()
return;
}
- delegate->getAllCookies(CallbackDirectory::GetAllCookiesCallbackId);
+ delegate->getAllCookies();
}
-void QWebEngineCookieStorePrivate::onGetAllCallbackResult(qint64 callbackId, const QByteArray &cookieList)
-{
- callbackDirectory.invoke(callbackId, cookieList);
-}
-void QWebEngineCookieStorePrivate::onSetCallbackResult(qint64 callbackId, bool success)
-{
- callbackDirectory.invoke(callbackId, success);
-}
-
-void QWebEngineCookieStorePrivate::onDeleteCallbackResult(qint64 callbackId, int numCookies)
-{
- callbackDirectory.invoke(callbackId, numCookies);
-}
void QWebEngineCookieStorePrivate::onCookieChanged(const QNetworkCookie &cookie, bool removed)
{
@@ -266,8 +246,7 @@ QWebEngineCookieStore::~QWebEngineCookieStore() {}
void QWebEngineCookieStore::setCookie(const QNetworkCookie &cookie, const QUrl &origin)
{
- //TODO: use callbacks or delete dummy ones
- d_ptr->setCookie(QWebEngineCallback<bool>(), cookie, origin);
+ d_ptr->setCookie(cookie, origin);
}
/*!
@@ -294,11 +273,8 @@ void QWebEngineCookieStore::deleteCookie(const QNetworkCookie &cookie, const QUr
void QWebEngineCookieStore::loadAllCookies()
{
- //TODO: use callbacks or delete dummy ones
if (d_ptr->m_getAllCookiesPending)
return;
- d_ptr->callbackDirectory.registerCallback(CallbackDirectory::GetAllCookiesCallbackId,
- QWebEngineCallback<const QByteArray &>());
//this will trigger cookieAdded signal
d_ptr->getAllCookies();
}
@@ -313,10 +289,8 @@ void QWebEngineCookieStore::loadAllCookies()
void QWebEngineCookieStore::deleteSessionCookies()
{
- //TODO: use callbacks or delete dummy ones
if (d_ptr->m_deleteAllCookiesPending || d_ptr->m_deleteSessionCookiesPending)
return;
- d_ptr->callbackDirectory.registerCallback(CallbackDirectory::DeleteSessionCookiesCallbackId, QWebEngineCallback<int>());
d_ptr->deleteSessionCookies();
}
@@ -328,10 +302,8 @@ void QWebEngineCookieStore::deleteSessionCookies()
void QWebEngineCookieStore::deleteAllCookies()
{
- //TODO: use callbacks or delete dummy ones
if (d_ptr->m_deleteAllCookiesPending)
return;
- d_ptr->callbackDirectory.registerCallback(CallbackDirectory::DeleteAllCookiesCallbackId, QWebEngineCallback<int>());
d_ptr->deleteAllCookies();
}
diff --git a/src/core/api/qwebenginecookiestore_p.h b/src/core/api/qwebenginecookiestore_p.h
index e6fa245c2..fefcc5b31 100644
--- a/src/core/api/qwebenginecookiestore_p.h
+++ b/src/core/api/qwebenginecookiestore_p.h
@@ -53,7 +53,6 @@
#include "qtwebenginecoreglobal_p.h"
-#include "qwebenginecallback_p.h"
#include "qwebenginecookiestore.h"
#include <QList>
@@ -69,7 +68,7 @@ QT_BEGIN_NAMESPACE
class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEngineCookieStorePrivate {
Q_DECLARE_PUBLIC(QWebEngineCookieStore)
struct CookieData {
- quint64 callbackId;
+ bool wasDelete;
QNetworkCookie cookie;
QUrl origin;
};
@@ -77,10 +76,8 @@ class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEngineCookieStorePrivate {
QWebEngineCookieStore *q_ptr;
public:
- QtWebEngineCore::CallbackDirectory callbackDirectory;
std::function<bool(const QWebEngineCookieStore::FilterRequest &)> filterCallback;
QList<CookieData> m_pendingUserCookies;
- quint64 m_nextCallbackId;
bool m_deleteSessionCookiesPending;
bool m_deleteAllCookiesPending;
bool m_getAllCookiesPending;
@@ -91,7 +88,7 @@ public:
void processPendingUserCookies();
void rejectPendingUserCookies();
- void setCookie(const QWebEngineCallback<bool> &callback, const QNetworkCookie &cookie, const QUrl &origin);
+ void setCookie(const QNetworkCookie &cookie, const QUrl &origin);
void deleteCookie(const QNetworkCookie &cookie, const QUrl &url);
void deleteSessionCookies();
void deleteAllCookies();
@@ -99,9 +96,6 @@ public:
bool canAccessCookies(const QUrl &firstPartyUrl, const QUrl &url) const;
- void onGetAllCallbackResult(qint64 callbackId, const QByteArray &cookieList);
- void onSetCallbackResult(qint64 callbackId, bool success);
- void onDeleteCallbackResult(qint64 callbackId, int numCookies);
void onCookieChanged(const QNetworkCookie &cookie, bool removed);
};
diff --git a/src/core/find_text_helper.h b/src/core/find_text_helper.h
index cdea3c2f8..f795731e3 100644
--- a/src/core/find_text_helper.h
+++ b/src/core/find_text_helper.h
@@ -52,8 +52,12 @@
#define FIND_TEXT_HELPER_H
#include <QtWebEngineCore/private/qtwebenginecoreglobal_p.h>
-#include <QtWebEngineCore/private/qwebenginecallback_p.h>
+
#include <QJSValue>
+#include <QMap>
+#include <QString>
+
+#include <functional>
namespace content {
class WebContents;
diff --git a/src/core/net/cookie_monster_delegate_qt.cpp b/src/core/net/cookie_monster_delegate_qt.cpp
index 9f703bcbc..2fbacd73b 100644
--- a/src/core/net/cookie_monster_delegate_qt.cpp
+++ b/src/core/net/cookie_monster_delegate_qt.cpp
@@ -125,23 +125,19 @@ bool CookieMonsterDelegateQt::hasCookieMonster()
return m_mojoCookieManager.is_bound();
}
-void CookieMonsterDelegateQt::getAllCookies(quint64 callbackId)
+void CookieMonsterDelegateQt::getAllCookies()
{
- m_mojoCookieManager->GetAllCookies(base::BindOnce(&CookieMonsterDelegateQt::GetAllCookiesCallbackOnUIThread, this, callbackId));
+ m_mojoCookieManager->GetAllCookies(net::CookieStore::GetAllCookiesCallback());
}
-void CookieMonsterDelegateQt::setCookie(quint64 callbackId, const QNetworkCookie &cookie, const QUrl &origin)
+void CookieMonsterDelegateQt::setCookie(const QNetworkCookie &cookie, const QUrl &origin)
{
Q_ASSERT(hasCookieMonster());
Q_ASSERT(m_client);
- net::CookieStore::SetCookiesCallback callback;
-
GURL gurl = origin.isEmpty() ? sourceUrlForCookie(cookie) : toGurl(origin);
std::string cookie_line = cookie.toRawForm().toStdString();
- if (callbackId != CallbackDirectory::NoCallbackId)
- callback = base::BindOnce(&CookieMonsterDelegateQt::SetCookieCallbackOnUIThread, this, callbackId);
net::CookieInclusionStatus inclusion;
auto canonCookie = net::CanonicalCookie::Create(gurl, cookie_line, base::Time::Now(), base::nullopt, &inclusion);
if (!inclusion.IsInclude()) {
@@ -151,7 +147,7 @@ void CookieMonsterDelegateQt::setCookie(quint64 callbackId, const QNetworkCookie
net::CookieOptions options;
options.set_include_httponly();
options.set_same_site_cookie_context(net::CookieOptions::SameSiteCookieContext::MakeInclusiveForSet());
- m_mojoCookieManager->SetCanonicalCookie(*canonCookie.get(), gurl, options, std::move(callback));
+ m_mojoCookieManager->SetCanonicalCookie(*canonCookie.get(), gurl, options, net::CookieStore::SetCookiesCallback());
}
void CookieMonsterDelegateQt::deleteCookie(const QNetworkCookie &cookie, const QUrl &origin)
@@ -167,27 +163,23 @@ void CookieMonsterDelegateQt::deleteCookie(const QNetworkCookie &cookie, const Q
m_mojoCookieManager->DeleteCookies(std::move(filter), network::mojom::CookieManager::DeleteCookiesCallback());
}
-void CookieMonsterDelegateQt::deleteSessionCookies(quint64 callbackId)
+void CookieMonsterDelegateQt::deleteSessionCookies()
{
Q_ASSERT(hasCookieMonster());
Q_ASSERT(m_client);
- network::mojom::CookieManager::DeleteCookiesCallback callback =
- base::BindOnce(&CookieMonsterDelegateQt::DeleteCookiesCallbackOnUIThread, this, callbackId);
auto filter = network::mojom::CookieDeletionFilter::New();
filter->session_control = network::mojom::CookieDeletionSessionControl::SESSION_COOKIES;
- m_mojoCookieManager->DeleteCookies(std::move(filter), std::move(callback));
+ m_mojoCookieManager->DeleteCookies(std::move(filter), network::mojom::CookieManager::DeleteCookiesCallback());
}
-void CookieMonsterDelegateQt::deleteAllCookies(quint64 callbackId)
+void CookieMonsterDelegateQt::deleteAllCookies()
{
Q_ASSERT(hasCookieMonster());
Q_ASSERT(m_client);
- network::mojom::CookieManager::DeleteCookiesCallback callback =
- base::BindOnce(&CookieMonsterDelegateQt::DeleteCookiesCallbackOnUIThread, this, callbackId);
auto filter = network::mojom::CookieDeletionFilter::New();
- m_mojoCookieManager->DeleteCookies(std::move(filter), std::move(callback));
+ m_mojoCookieManager->DeleteCookies(std::move(filter), network::mojom::CookieManager::DeleteCookiesCallback());
}
void CookieMonsterDelegateQt::setMojoCookieManager(network::mojom::CookieManagerPtrInfo cookie_manager_info)
@@ -265,23 +257,4 @@ void CookieMonsterDelegateQt::OnCookieChanged(const net::CookieChangeInfo &chang
m_client->d_func()->onCookieChanged(toQt(change.cookie), change.cause != net::CookieChangeCause::INSERTED);
}
-void CookieMonsterDelegateQt::GetAllCookiesCallbackOnUIThread(qint64 callbackId, const net::CookieList &cookies)
-{
- QByteArray rawCookies = QByteArray::fromStdString(net::CanonicalCookie::BuildCookieLine(cookies));
- if (m_client)
- m_client->d_func()->onGetAllCallbackResult(callbackId, rawCookies);
-}
-
-void CookieMonsterDelegateQt::SetCookieCallbackOnUIThread(qint64 callbackId, net::CookieAccessResult status)
-{
- if (m_client)
- m_client->d_func()->onSetCallbackResult(callbackId, status.status.IsInclude());
-}
-
-void CookieMonsterDelegateQt::DeleteCookiesCallbackOnUIThread(qint64 callbackId, uint numCookies)
-{
- if (m_client)
- m_client->d_func()->onDeleteCallbackResult(callbackId, numCookies);
-}
-
} // namespace QtWebEngineCore
diff --git a/src/core/net/cookie_monster_delegate_qt.h b/src/core/net/cookie_monster_delegate_qt.h
index 9078bcd58..4359119f9 100644
--- a/src/core/net/cookie_monster_delegate_qt.h
+++ b/src/core/net/cookie_monster_delegate_qt.h
@@ -95,11 +95,11 @@ public:
bool hasCookieMonster();
- void setCookie(quint64 callbackId, const QNetworkCookie &cookie, const QUrl &origin);
+ void setCookie(const QNetworkCookie &cookie, const QUrl &origin);
void deleteCookie(const QNetworkCookie &cookie, const QUrl &origin);
- void getAllCookies(quint64 callbackId);
- void deleteSessionCookies(quint64 callbackId);
- void deleteAllCookies(quint64 callbackId);
+ void getAllCookies();
+ void deleteSessionCookies();
+ void deleteAllCookies();
void setClient(QWebEngineCookieStore *client);
void setMojoCookieManager(network::mojom::CookieManagerPtrInfo cookie_manager_info);
@@ -111,11 +111,6 @@ public:
void AddStore(net::CookieStore *store);
void OnCookieChanged(const net::CookieChangeInfo &change);
-
-private:
- void GetAllCookiesCallbackOnUIThread(qint64 callbackId, const net::CookieList &cookies);
- void SetCookieCallbackOnUIThread(qint64 callbackId, net::CookieAccessResult status);
- void DeleteCookiesCallbackOnUIThread(qint64 callbackId, uint numCookies);
};
}
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 733283cc7..0a83b248f 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -438,15 +438,15 @@ QSharedPointer<WebContentsAdapter> WebContentsAdapter::createFromSerializedNavig
return QSharedPointer<WebContentsAdapter>::create(std::move(newWebContents));
}
-WebContentsAdapter::WebContentsAdapter()
+WebContentsAdapter::WebContentsAdapter(std::unique_ptr<content::WebContents> webContents)
: m_profileAdapter(nullptr)
- , m_webContents(nullptr)
+ , m_webContents(std::move(webContents))
#if QT_CONFIG(webengine_webchannel)
, m_webChannel(nullptr)
, m_webChannelWorld(0)
#endif
, m_adapterClient(nullptr)
- , m_nextRequestId(CallbackDirectory::ReservedCallbackIdsEnd)
+ , m_nextRequestId(1)
, m_currentDropAction(blink::kDragOperationNone)
, m_devToolsFrontend(nullptr)
{
@@ -454,20 +454,9 @@ WebContentsAdapter::WebContentsAdapter()
WebEngineContext::current();
}
-WebContentsAdapter::WebContentsAdapter(std::unique_ptr<content::WebContents> webContents)
- : m_profileAdapter(nullptr)
- , m_webContents(std::move(webContents))
-#if QT_CONFIG(webengine_webchannel)
- , m_webChannel(nullptr)
- , m_webChannelWorld(0)
-#endif
- , m_adapterClient(nullptr)
- , m_nextRequestId(CallbackDirectory::ReservedCallbackIdsEnd)
- , m_currentDropAction(blink::kDragOperationNone)
- , m_devToolsFrontend(nullptr)
+WebContentsAdapter::WebContentsAdapter()
+ : WebContentsAdapter(nullptr)
{
- // This has to be the first thing we create, and the last we destroy.
- WebEngineContext::current();
}
WebContentsAdapter::~WebContentsAdapter()