summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/api/core_api.pro2
-rw-r--r--src/core/api/qwebenginecookiestore.cpp2
-rw-r--r--src/core/api/qwebenginemessagepumpscheduler.cpp72
-rw-r--r--src/core/api/qwebenginemessagepumpscheduler_p.h80
-rw-r--r--src/core/api/qwebengineurlschemehandler.cpp2
-rw-r--r--src/core/browser_accessibility_manager_qt.cpp6
-rw-r--r--src/core/browser_accessibility_manager_qt.h3
-rw-r--r--src/core/browser_accessibility_qt.cpp3
-rw-r--r--src/core/browser_main_parts_qt.cpp48
-rw-r--r--src/core/favicon_manager.cpp20
-rw-r--r--src/core/favicon_manager.h15
-rw-r--r--src/core/profile_adapter.cpp17
-rw-r--r--src/core/profile_adapter.h5
-rw-r--r--src/core/profile_adapter_client.h2
-rw-r--r--src/core/type_conversion.cpp2
-rw-r--r--src/core/web_contents_adapter_client.h1
-rw-r--r--src/core/web_engine_settings.cpp34
-rw-r--r--src/core/web_engine_settings.h5
18 files changed, 235 insertions, 84 deletions
diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro
index 4d3ddcc8e..326d4481f 100644
--- a/src/core/api/core_api.pro
+++ b/src/core/api/core_api.pro
@@ -38,6 +38,7 @@ HEADERS = \
qwebenginecookiestore.h \
qwebenginecookiestore_p.h \
qwebenginehttprequest.h \
+ qwebenginemessagepumpscheduler_p.h \
qwebenginenotification.h \
qwebenginequotarequest.h \
qwebengineregisterprotocolhandlerrequest.h \
@@ -53,6 +54,7 @@ SOURCES = \
qwebengineclientcertificatestore.cpp \
qwebenginecookiestore.cpp \
qwebenginehttprequest.cpp \
+ qwebenginemessagepumpscheduler.cpp \
qwebenginenotification.cpp \
qwebenginequotarequest.cpp \
qwebengineregisterprotocolhandlerrequest.cpp \
diff --git a/src/core/api/qwebenginecookiestore.cpp b/src/core/api/qwebenginecookiestore.cpp
index 035c98342..3897fb128 100644
--- a/src/core/api/qwebenginecookiestore.cpp
+++ b/src/core/api/qwebenginecookiestore.cpp
@@ -382,7 +382,7 @@ void QWebEngineCookieStore::setCookieFilter(std::function<bool(const FilterReque
\inmodule QtWebEngineCore
\since 5.11
- \brief This struct is used in conjunction with QWebEngineCookieStore::setCookieFilter() and is
+ \brief The QWebEngineCookieStore::FilterRequest struct is used in conjunction with QWebEngineCookieStore::setCookieFilter() and is
the type \a filterCallback operates on.
\sa QWebEngineCookieStore::setCookieFilter()
diff --git a/src/core/api/qwebenginemessagepumpscheduler.cpp b/src/core/api/qwebenginemessagepumpscheduler.cpp
new file mode 100644
index 000000000..34cbc49bf
--- /dev/null
+++ b/src/core/api/qwebenginemessagepumpscheduler.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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$
+**
+****************************************************************************/
+
+#include "qwebenginemessagepumpscheduler_p.h"
+
+#include <QAbstractEventDispatcher>
+#include <QCoreApplication>
+#include <QTimerEvent>
+
+QWebEngineMessagePumpScheduler::QWebEngineMessagePumpScheduler(std::function<void()> callback)
+ : m_callback(std::move(callback))
+{}
+
+void QWebEngineMessagePumpScheduler::scheduleWork()
+{
+ QCoreApplication::postEvent(this, new QTimerEvent(0));
+}
+
+void QWebEngineMessagePumpScheduler::scheduleDelayedWork(int delay)
+{
+ if (delay < 0) {
+ killTimer(m_timerId);
+ m_timerId = 0;
+ } else if (!m_timerId || delay < QAbstractEventDispatcher::instance()->remainingTime(m_timerId)) {
+ killTimer(m_timerId);
+ m_timerId = startTimer(delay);
+ }
+}
+
+void QWebEngineMessagePumpScheduler::timerEvent(QTimerEvent *ev)
+{
+ Q_ASSERT(!ev->timerId() || m_timerId == ev->timerId());
+ killTimer(m_timerId);
+ m_timerId = 0;
+ m_callback();
+}
diff --git a/src/core/api/qwebenginemessagepumpscheduler_p.h b/src/core/api/qwebenginemessagepumpscheduler_p.h
new file mode 100644
index 000000000..4c9e4d600
--- /dev/null
+++ b/src/core/api/qwebenginemessagepumpscheduler_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 QWEBENGINEMESSAGEPUMPSCHEDULER_P_H
+#define QWEBENGINEMESSAGEPUMPSCHEDULER_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 <QtCore/qobject.h>
+
+#include <functional>
+
+QT_BEGIN_NAMESPACE
+
+class QWEBENGINECORE_PRIVATE_EXPORT QWebEngineMessagePumpScheduler : public QObject
+{
+ Q_OBJECT
+public:
+ QWebEngineMessagePumpScheduler(std::function<void()> callback);
+ void scheduleWork();
+ void scheduleDelayedWork(int delay);
+
+protected:
+ void timerEvent(QTimerEvent *ev) override;
+
+private:
+ int m_timerId = 0;
+ std::function<void()> m_callback;
+};
+
+QT_END_NAMESPACE
+
+#endif // !QWEBENGINEMESSAGEPUMPSCHEDULER_P_H
diff --git a/src/core/api/qwebengineurlschemehandler.cpp b/src/core/api/qwebengineurlschemehandler.cpp
index 2e93f4b73..aecee5044 100644
--- a/src/core/api/qwebengineurlschemehandler.cpp
+++ b/src/core/api/qwebengineurlschemehandler.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QWebEngineUrlSchemeHandler
- \brief The QWebEngineUrlSchemeHandler is a base class for handling custom URL schemes.
+ \brief The QWebEngineUrlSchemeHandler class is a base class for handling custom URL schemes.
\since 5.6
To implement a custom URL scheme for QtWebEngine, you first have to create an instance of
diff --git a/src/core/browser_accessibility_manager_qt.cpp b/src/core/browser_accessibility_manager_qt.cpp
index 644a0a9f0..7fb1386c5 100644
--- a/src/core/browser_accessibility_manager_qt.cpp
+++ b/src/core/browser_accessibility_manager_qt.cpp
@@ -76,6 +76,12 @@ BrowserAccessibilityManagerQt::BrowserAccessibilityManagerQt(
, m_parentObject(parentObject)
{
Initialize(initialTree);
+ m_valid = true; // BrowserAccessibilityQt can start using the AXTree
+}
+
+BrowserAccessibilityManagerQt::~BrowserAccessibilityManagerQt()
+{
+ m_valid = false; // BrowserAccessibilityQt should stop using the AXTree
}
QAccessibleInterface *BrowserAccessibilityManagerQt::rootParentAccessible()
diff --git a/src/core/browser_accessibility_manager_qt.h b/src/core/browser_accessibility_manager_qt.h
index a2d6db458..87c8875ba 100644
--- a/src/core/browser_accessibility_manager_qt.h
+++ b/src/core/browser_accessibility_manager_qt.h
@@ -57,14 +57,17 @@ public:
const ui::AXTreeUpdate& initialTree,
BrowserAccessibilityDelegate* delegate,
BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory());
+ ~BrowserAccessibilityManagerQt() override;
void FireBlinkEvent(ax::mojom::Event event_type,
BrowserAccessibility* node) override;
QAccessibleInterface *rootParentAccessible();
+ bool isValid() const { return m_valid; }
private:
Q_DISABLE_COPY(BrowserAccessibilityManagerQt)
QObject *m_parentObject;
+ bool m_valid = false;
};
}
diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp
index c906071f2..75527ea95 100644
--- a/src/core/browser_accessibility_qt.cpp
+++ b/src/core/browser_accessibility_qt.cpp
@@ -73,7 +73,8 @@ BrowserAccessibilityQt::BrowserAccessibilityQt()
bool BrowserAccessibilityQt::isValid() const
{
- return true;
+ auto managerQt = static_cast<BrowserAccessibilityManagerQt *>(manager_);
+ return managerQt && managerQt->isValid();
}
QObject *BrowserAccessibilityQt::object() const
diff --git a/src/core/browser_main_parts_qt.cpp b/src/core/browser_main_parts_qt.cpp
index e6c76fb4f..4dbff086b 100644
--- a/src/core/browser_main_parts_qt.cpp
+++ b/src/core/browser_main_parts_qt.cpp
@@ -39,6 +39,8 @@
#include "browser_main_parts_qt.h"
+#include "api/qwebenginemessagepumpscheduler_p.h"
+
#include "base/message_loop/message_loop.h"
#include "base/process/process.h"
#include "base/threading/thread_restrictions.h"
@@ -63,11 +65,7 @@
#include "service/service_qt.h"
#include "web_engine_context.h"
-#include <QCoreApplication>
-#include <QEvent>
#include <QEventLoop>
-#include <QObject>
-#include <QTimerEvent>
#include <QtGui/qtgui-config.h>
#if QT_CONFIG(opengl)
@@ -106,16 +104,12 @@ int GetTimeIntervalMilliseconds(const base::TimeTicks &from)
return delay < 0 ? 0 : delay;
}
-class MessagePumpForUIQt : public QObject,
- public base::MessagePump
+class MessagePumpForUIQt : public base::MessagePump
{
public:
MessagePumpForUIQt()
- : m_delegate(nullptr)
- , m_explicitLoop(nullptr)
- , m_timerId(0)
- {
- }
+ : m_scheduler([this]() { handleScheduledWork(); })
+ {}
void Run(Delegate *delegate) override
{
@@ -138,36 +132,17 @@ public:
void ScheduleWork() override
{
+ // NOTE: This method may called from any thread at any time.
if (!m_delegate)
m_delegate = base::MessageLoopForUI::current();
- QCoreApplication::postEvent(this, new QTimerEvent(0));
- m_timerScheduledTime = base::TimeTicks::Now();
+ m_scheduler.scheduleWork();
}
void ScheduleDelayedWork(const base::TimeTicks &delayed_work_time) override
{
if (!m_delegate)
m_delegate = base::MessageLoopForUI::current();
- if (delayed_work_time.is_null()) {
- killTimer(m_timerId);
- m_timerId = 0;
- m_timerScheduledTime = base::TimeTicks();
- } else if (!m_timerId || delayed_work_time < m_timerScheduledTime) {
- killTimer(m_timerId);
- m_timerId = startTimer(GetTimeIntervalMilliseconds(delayed_work_time));
- m_timerScheduledTime = delayed_work_time;
- }
- }
-
-protected:
- void timerEvent(QTimerEvent *ev) override
- {
- Q_ASSERT(!ev->timerId() || m_timerId == ev->timerId());
- killTimer(m_timerId);
- m_timerId = 0;
- m_timerScheduledTime = base::TimeTicks();
-
- handleScheduledWork();
+ m_scheduler.scheduleDelayedWork(GetTimeIntervalMilliseconds(delayed_work_time));
}
private:
@@ -235,10 +210,9 @@ private:
ScheduleDelayedWork(delayed_work_time);
}
- Delegate *m_delegate;
- QEventLoop *m_explicitLoop;
- int m_timerId;
- base::TimeTicks m_timerScheduledTime;
+ Delegate *m_delegate = nullptr;
+ QEventLoop *m_explicitLoop = nullptr;
+ QWebEngineMessagePumpScheduler m_scheduler;
};
} // anonymous namespace
diff --git a/src/core/favicon_manager.cpp b/src/core/favicon_manager.cpp
index de6a0f183..f7ba858c1 100644
--- a/src/core/favicon_manager.cpp
+++ b/src/core/favicon_manager.cpp
@@ -253,7 +253,7 @@ void FaviconManager::update(const QList<FaviconInfo> &candidates)
const QList<FaviconInfo> &faviconInfoList = getFaviconInfoList(true /* candidates only */);
for (auto it = faviconInfoList.cbegin(), end = faviconInfoList.cend(); it != end; ++it) {
- if (!touchIconsEnabled && it->type != FaviconInfo::Favicon)
+ if (!touchIconsEnabled && !(it->type & FaviconInfo::Favicon))
continue;
if (it->isValid())
@@ -272,6 +272,14 @@ void FaviconManager::update(const QList<FaviconInfo> &candidates)
void FaviconManager::updateCandidates(const QList<FaviconInfo> &candidates)
{
+ // Invalidate types of the already stored candidate icons because it might differ
+ // among pages.
+ for (FaviconInfo candidateFaviconInfo : candidates) {
+ const QUrl &candidateUrl = candidateFaviconInfo.url;
+ if (m_faviconInfoMap.contains(candidateUrl))
+ m_faviconInfoMap[candidateUrl].type = FaviconInfo::InvalidIcon;
+ }
+
m_candidateCount = candidates.count();
for (FaviconInfo candidateFaviconInfo : candidates) {
const QUrl &candidateUrl = candidateFaviconInfo.url;
@@ -279,8 +287,8 @@ void FaviconManager::updateCandidates(const QList<FaviconInfo> &candidates)
if (!m_faviconInfoMap.contains(candidateUrl))
m_faviconInfoMap.insert(candidateUrl, candidateFaviconInfo);
else {
- // The same icon can be used for more than one page with different types.
- m_faviconInfoMap[candidateUrl].type = candidateFaviconInfo.type;
+ // The same icon URL can be used for different types.
+ m_faviconInfoMap[candidateUrl].type |= candidateFaviconInfo.type;
}
m_faviconInfoMap[candidateUrl].candidate = true;
@@ -311,7 +319,7 @@ QUrl FaviconManager::candidateIconUrl(bool touchIconsEnabled) const
unsigned bestArea = 0;
for (auto it = faviconInfoList.cbegin(), end = faviconInfoList.cend(); it != end; ++it) {
- if (!touchIconsEnabled && it->type != FaviconInfo::Favicon)
+ if (!touchIconsEnabled && !(it->type & FaviconInfo::Favicon))
continue;
if (it->isValid() && bestArea < area(it->size)) {
@@ -331,7 +339,7 @@ void FaviconManager::generateCandidateIcon(bool touchIconsEnabled)
const QList<FaviconInfo> &faviconInfoList = getFaviconInfoList(true /* candidates only */);
for (auto it = faviconInfoList.cbegin(), end = faviconInfoList.cend(); it != end; ++it) {
- if (!touchIconsEnabled && it->type != FaviconInfo::Favicon)
+ if (!touchIconsEnabled && !(it->type & FaviconInfo::Favicon))
continue;
if (!it->isValid() || !it->isDownloaded())
@@ -373,7 +381,7 @@ FaviconInfo::FaviconInfo(const FaviconInfo &other)
{
}
-FaviconInfo::FaviconInfo(const QUrl &url, FaviconInfo::FaviconType type)
+FaviconInfo::FaviconInfo(const QUrl &url, FaviconInfo::FaviconTypeFlags type)
: url(url)
, type(type)
, size(QSize(0, 0))
diff --git a/src/core/favicon_manager.h b/src/core/favicon_manager.h
index f9758d0f0..60d194c4b 100644
--- a/src/core/favicon_manager.h
+++ b/src/core/favicon_manager.h
@@ -84,23 +84,24 @@ class WebContentsAdapterClient;
// Based on src/3rdparty/chromium/content/public/common/favicon_url.h
class QWEBENGINECORE_PRIVATE_EXPORT FaviconInfo {
public:
- enum FaviconType {
- InvalidIcon,
- Favicon,
- TouchIcon,
- TouchPrecomposedIcon
+ enum FaviconTypeFlag {
+ InvalidIcon = 0,
+ Favicon = 1 << 0,
+ TouchIcon = 1 << 1,
+ TouchPrecomposedIcon = 1 << 2
};
+ Q_DECLARE_FLAGS(FaviconTypeFlags, FaviconTypeFlag);
FaviconInfo();
FaviconInfo(const FaviconInfo &);
- FaviconInfo(const QUrl &, FaviconInfo::FaviconType);
+ FaviconInfo(const QUrl &, FaviconInfo::FaviconTypeFlags);
~FaviconInfo();
bool isValid() const;
bool isDownloaded() const;
QUrl url;
- FaviconType type;
+ FaviconTypeFlags type;
// Stores the largest size in case of multi-size icon
QSize size;
bool candidate;
diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp
index 4625d238e..7070292d6 100644
--- a/src/core/profile_adapter.cpp
+++ b/src/core/profile_adapter.cpp
@@ -55,6 +55,7 @@
#include "type_conversion.h"
#include "visited_links_manager_qt.h"
#include "web_engine_context.h"
+#include "web_contents_adapter_client.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
@@ -105,6 +106,9 @@ ProfileAdapter::ProfileAdapter(const QString &storageName):
ProfileAdapter::~ProfileAdapter()
{
+ while (!m_webContentsAdapterClients.isEmpty()) {
+ m_webContentsAdapterClients.first()->releaseProfile();
+ }
WebEngineContext::current()->removeProfileAdapter(this);
if (m_downloadManagerDelegate) {
m_profile->GetDownloadManager(m_profile.data())->Shutdown();
@@ -231,7 +235,8 @@ ProfileAdapter *ProfileAdapter::createDefaultProfileAdapter()
ProfileAdapter *ProfileAdapter::defaultProfileAdapter()
{
- return WebEngineContext::current()->defaultProfileAdapter();
+ WebEngineContext *context = WebEngineContext::current();
+ return context ? context->defaultProfileAdapter() : nullptr;
}
QObject* ProfileAdapter::globalQObjectRoot()
@@ -618,6 +623,16 @@ bool ProfileAdapter::isSpellCheckEnabled() const
#endif
}
+void ProfileAdapter::addWebContentsAdapterClient(WebContentsAdapterClient *client)
+{
+ m_webContentsAdapterClients.append(client);
+}
+
+void ProfileAdapter::removeWebContentsAdapterClient(WebContentsAdapterClient *client)
+{
+ m_webContentsAdapterClients.removeAll(client);
+}
+
void ProfileAdapter::resetVisitedLinksManager()
{
m_visitedLinksManager.reset(new VisitedLinksManagerQt(m_profile.data(), persistVisitedLinks()));
diff --git a/src/core/profile_adapter.h b/src/core/profile_adapter.h
index 480ca61f6..1aff145b2 100644
--- a/src/core/profile_adapter.h
+++ b/src/core/profile_adapter.h
@@ -76,6 +76,7 @@ class ProfileAdapterClient;
class ProfileQt;
class UserResourceControllerHost;
class VisitedLinksManagerQt;
+class WebContentsAdapterClient;
class QWEBENGINECORE_PRIVATE_EXPORT ProfileAdapter : public QObject
{
@@ -133,6 +134,9 @@ public:
void setSpellCheckEnabled(bool enabled);
bool isSpellCheckEnabled() const;
+ void addWebContentsAdapterClient(WebContentsAdapterClient *client);
+ void removeWebContentsAdapterClient(WebContentsAdapterClient *client);
+
// KEEP IN SYNC with API or add mapping layer
enum HttpCacheType {
MemoryHttpCache = 0,
@@ -237,6 +241,7 @@ private:
QHash<QByteArray, QSharedPointer<UserNotificationController>> m_persistentNotifications;
QList<ProfileAdapterClient*> m_clients;
+ QVector<WebContentsAdapterClient *> m_webContentsAdapterClients;
int m_httpCacheMaxSize;
int m_pageRequestInterceptors;
QrcUrlSchemeHandler m_qrcHandler;
diff --git a/src/core/profile_adapter_client.h b/src/core/profile_adapter_client.h
index 0309200b4..8ee9d240e 100644
--- a/src/core/profile_adapter_client.h
+++ b/src/core/profile_adapter_client.h
@@ -147,6 +147,8 @@ public:
virtual void useForGlobalCertificateVerificationChanged() {}
virtual void showNotification(QSharedPointer<UserNotificationController> &) { }
+ virtual void addWebContentsAdapterClient(WebContentsAdapterClient *adapter) = 0;
+ virtual void removeWebContentsAdapterClient(WebContentsAdapterClient *adapter) = 0;
static QString downloadInterruptReasonToString(DownloadInterruptReason reason);
};
diff --git a/src/core/type_conversion.cpp b/src/core/type_conversion.cpp
index ef16e2add..02d2db448 100644
--- a/src/core/type_conversion.cpp
+++ b/src/core/type_conversion.cpp
@@ -218,7 +218,7 @@ int flagsFromModifiers(Qt::KeyboardModifiers modifiers)
return modifierFlags;
}
-FaviconInfo::FaviconType toQt(content::FaviconURL::IconType type)
+FaviconInfo::FaviconTypeFlags toQt(content::FaviconURL::IconType type)
{
switch (type) {
case content::FaviconURL::IconType::kFavicon:
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h
index d155ed391..cdfcae450 100644
--- a/src/core/web_contents_adapter_client.h
+++ b/src/core/web_contents_adapter_client.h
@@ -485,6 +485,7 @@ public:
virtual ProfileAdapter *profileAdapter() = 0;
virtual WebContentsAdapter* webContentsAdapter() = 0;
+ virtual void releaseProfile() = 0;
};
diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp
index a652469cb..705c0c106 100644
--- a/src/core/web_engine_settings.cpp
+++ b/src/core/web_engine_settings.cpp
@@ -67,27 +67,6 @@ QHash<WebEngineSettings::FontSize, int> WebEngineSettings::s_defaultFontSizes;
static const int batchTimerTimeout = 0;
-class BatchTimer : public QTimer {
- Q_OBJECT
-public:
- BatchTimer(WebEngineSettings *settings)
- : m_settings(settings)
- {
- setSingleShot(true);
- setInterval(batchTimerTimeout);
- connect(this, SIGNAL(timeout()), SLOT(onTimeout()));
- }
-
-private Q_SLOTS:
- void onTimeout()
- {
- m_settings->doApply();
- }
-
-private:
- WebEngineSettings *m_settings;
-};
-
static inline bool isTouchEventsAPIEnabled() {
static bool initialized = false;
static bool touchEventsAPIEnabled = false;
@@ -113,12 +92,17 @@ static inline bool isTouchEventsAPIEnabled() {
WebEngineSettings::WebEngineSettings(WebEngineSettings *_parentSettings)
: m_adapter(0)
- , m_batchTimer(new BatchTimer(this))
, parentSettings(_parentSettings)
, m_unknownUrlSchemePolicy(WebEngineSettings::InheritedUnknownUrlSchemePolicy)
{
if (parentSettings)
parentSettings->childSettings.insert(this);
+
+ m_batchTimer.setSingleShot(true);
+ m_batchTimer.setInterval(batchTimerTimeout);
+ QObject::connect(&m_batchTimer, &QTimer::timeout, [this]() {
+ doApply();
+ });
}
WebEngineSettings::~WebEngineSettings()
@@ -340,8 +324,8 @@ void WebEngineSettings::initDefaults()
void WebEngineSettings::scheduleApply()
{
- if (!m_batchTimer->isActive())
- m_batchTimer->start();
+ if (!m_batchTimer.isActive())
+ m_batchTimer.start();
}
void WebEngineSettings::doApply()
@@ -453,5 +437,3 @@ void WebEngineSettings::setParentSettings(WebEngineSettings *_parentSettings)
}
} // namespace QtWebEngineCore
-
-#include "web_engine_settings.moc"
diff --git a/src/core/web_engine_settings.h b/src/core/web_engine_settings.h
index 8ed727524..8e1bb741c 100644
--- a/src/core/web_engine_settings.h
+++ b/src/core/web_engine_settings.h
@@ -57,6 +57,7 @@
#include <QHash>
#include <QUrl>
#include <QSet>
+#include <QTimer>
namespace content {
struct RendererPreferences;
@@ -65,7 +66,6 @@ struct WebPreferences;
}
namespace QtWebEngineCore {
-class BatchTimer;
class WebContentsAdapter;
class QWEBENGINECORE_PRIVATE_EXPORT WebEngineSettings {
@@ -178,7 +178,7 @@ private:
QHash<FontSize, int> m_fontSizes;
QString m_defaultEncoding;
QScopedPointer<content::WebPreferences> webPreferences;
- QScopedPointer<BatchTimer> m_batchTimer;
+ QTimer m_batchTimer;
WebEngineSettings *parentSettings;
QSet<WebEngineSettings *> childSettings;
@@ -188,7 +188,6 @@ private:
static QHash<FontSize, int> s_defaultFontSizes;
UnknownUrlSchemePolicy m_unknownUrlSchemePolicy;
- friend class BatchTimer;
friend class WebContentsAdapter;
};