diff options
Diffstat (limited to 'src/core/profile_adapter.h')
-rw-r--r-- | src/core/profile_adapter.h | 105 |
1 files changed, 51 insertions, 54 deletions
diff --git a/src/core/profile_adapter.h b/src/core/profile_adapter.h index efd56e50e..4be0ea51e 100644 --- a/src/core/profile_adapter.h +++ b/src/core/profile_adapter.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only // // W A R N I N G @@ -51,23 +15,27 @@ #ifndef PROFILE_ADAPTER_H #define PROFILE_ADAPTER_H -#include "qtwebenginecoreglobal_p.h" +#include <QtWebEngineCore/private/qtwebenginecoreglobal_p.h> -#include <QEnableSharedFromThis> +#include <QHash> #include <QList> #include <QPointer> #include <QScopedPointer> +#include <QSharedPointer> #include <QString> -#include <QVector> -#include "api/qwebengineclientcertificatestore.h" -#include "api/qwebenginecookiestore.h" -#include "api/qwebengineurlrequestinterceptor.h" -#include "api/qwebengineurlschemehandler.h" +#include <QtWebEngineCore/qwebengineclientcertificatestore.h> +#include <QtWebEngineCore/qwebenginecookiestore.h> +#include <QtWebEngineCore/qwebengineurlrequestinterceptor.h> +#include <QtWebEngineCore/qwebengineurlschemehandler.h> #include "net/qrc_url_scheme_handler.h" QT_FORWARD_DECLARE_CLASS(QObject) +namespace base { +class CancelableTaskTracker; +} + namespace QtWebEngineCore { class UserNotificationController; @@ -78,7 +46,7 @@ class UserResourceControllerHost; class VisitedLinksManagerQt; class WebContentsAdapterClient; -class Q_WEBENGINECORE_PRIVATE_EXPORT ProfileAdapter : public QObject +class Q_WEBENGINECORE_EXPORT ProfileAdapter : public QObject { public: explicit ProfileAdapter(const QString &storagePrefix = QString()); @@ -100,12 +68,13 @@ public: void addClient(ProfileAdapterClient *adapterClient); void removeClient(ProfileAdapterClient *adapterClient); - void cancelDownload(quint32 downloadId); + bool cancelDownload(quint32 downloadId); void pauseDownload(quint32 downloadId); void resumeDownload(quint32 downloadId); void removeDownload(quint32 downloadId); ProfileQt *profile(); + bool ensureDataPathExists(); QString storageName() const { return m_name; } void setStorageName(const QString &storageName); @@ -132,8 +101,12 @@ public: void setSpellCheckEnabled(bool enabled); bool isSpellCheckEnabled() const; + bool pushServiceEnabled() const; + void setPushServiceEnabled(bool enabled); + void addWebContentsAdapterClient(WebContentsAdapterClient *client); void removeWebContentsAdapterClient(WebContentsAdapterClient *client); + void releaseAllWebContentsAdapterClients(); // KEEP IN SYNC with API or add mapping layer enum HttpCacheType { @@ -160,8 +133,8 @@ public: NotificationPermission = 2, AudioCapturePermission = 3, VideoCapturePermission = 4, - ClipboardRead = 5, - ClipboardWrite = 6, + ClipboardReadWrite = 5, + LocalFontsPermission = 6, }; enum PermissionState { @@ -170,6 +143,18 @@ public: DeniedPermission = 2 }; + enum ClientHint : uchar { + UAArchitecture, + UAPlatform, + UAModel, + UAMobile, + UAFullVersion, + UAPlatformVersion, + UABitness, + UAFullVersionList, + UAWOW64, + }; + HttpCacheType httpCacheType() const; void setHttpCacheType(ProfileAdapter::HttpCacheType); @@ -200,10 +185,13 @@ public: QString httpAcceptLanguage() const; void setHttpAcceptLanguage(const QString &httpAcceptLanguage); - void clearHttpCache(); + QVariant clientHint(ClientHint clientHint) const; + void setClientHint(ClientHint clientHint, const QVariant &value); + bool clientHintsEnabled(); + void setClientHintsEnabled(bool enabled); + void resetClientHints(); - void setUseForGlobalCertificateVerification(bool enable = true); - bool isUsedForGlobalCertificateVerification() const; + void clearHttpCache(); #if QT_CONFIG(ssl) QWebEngineClientCertificateStore *clientCertificateStore(); @@ -216,14 +204,20 @@ public: QString determineDownloadPath(const QString &downloadDirectory, const QString &suggestedFilename, const time_t &startTime); + void requestIconForPageURL(const QUrl &pageUrl, int desiredSizeInPixel, bool touchIconsEnabled, + std::function<void (const QIcon &, const QUrl &, const QUrl &)> iconAvailableCallback); + void requestIconForIconURL(const QUrl &iconUrl, int desiredSizeInPixel, bool touchIconsEnabled, + std::function<void (const QIcon &, const QUrl &)> iconAvailableCallback); + base::CancelableTaskTracker *cancelableTaskTracker() { return m_cancelableTaskTracker.get(); } + private: void updateCustomUrlSchemeHandlers(); void resetVisitedLinksManager(); bool persistVisitedLinks() const; + void reinitializeHistoryService(); QString m_name; bool m_offTheRecord; - bool m_usedForGlobalCertificateVerification = false; QScopedPointer<ProfileQt> m_profile; QScopedPointer<VisitedLinksManagerQt> m_visitedLinksManager; QScopedPointer<DownloadManagerDelegateQt> m_downloadManagerDelegate; @@ -245,11 +239,14 @@ private: QHash<QByteArray, QPointer<QWebEngineUrlSchemeHandler>> m_customUrlSchemeHandlers; QHash<QByteArray, QWeakPointer<UserNotificationController>> m_ephemeralNotifications; QHash<QByteArray, QSharedPointer<UserNotificationController>> m_persistentNotifications; + bool m_clientHintsEnabled; QList<ProfileAdapterClient*> m_clients; - QVector<WebContentsAdapterClient *> m_webContentsAdapterClients; + QList<WebContentsAdapterClient *> m_webContentsAdapterClients; + bool m_pushServiceEnabled; int m_httpCacheMaxSize; QrcUrlSchemeHandler m_qrcHandler; + std::unique_ptr<base::CancelableTaskTracker> m_cancelableTaskTracker; Q_DISABLE_COPY(ProfileAdapter) }; |