diff options
author | Michal Klocek <michal.klocek@qt.io> | 2018-06-15 12:38:30 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2018-07-09 19:22:11 +0000 |
commit | d599aea151a5c7753e7eb1fc1a2c2b5953ac580b (patch) | |
tree | 3563522c3c15e4043a8e8a0023cb2f21a9709891 /src/webengine | |
parent | 10877c3ec0184e6c2a07b8775d32c8efc38a29a3 (diff) |
Rename BrowserContextAdapter to ProfileAdapter
Follow change of BrowserContextQt to ProfileQt.
Fix wrong naming usage of browserContext instead
of browserContextAdapter.
Change-Id: I75fdac685d9bffd44f0144921d3e87305d6d44c9
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'src/webengine')
-rw-r--r-- | src/webengine/api/qquickwebenginedownloaditem.cpp | 6 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineprofile.cpp | 144 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineprofile.h | 4 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineprofile_p.h | 10 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview.cpp | 16 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview_p_p.h | 2 |
6 files changed, 94 insertions, 88 deletions
diff --git a/src/webengine/api/qquickwebenginedownloaditem.cpp b/src/webengine/api/qquickwebenginedownloaditem.cpp index 4f60083c8..8f903564b 100644 --- a/src/webengine/api/qquickwebenginedownloaditem.cpp +++ b/src/webengine/api/qquickwebenginedownloaditem.cpp @@ -40,7 +40,7 @@ #include "qquickwebenginedownloaditem_p.h" #include "qquickwebenginedownloaditem_p_p.h" -#include "browser_context_adapter.h" +#include "profile_adapter.h" #include "qquickwebengineprofile_p.h" using QtWebEngineCore::BrowserContextAdapterClient; @@ -286,7 +286,7 @@ void QQuickWebEngineDownloadItem::pause() return; if (d->profile) - d->profile->d_ptr->browserContext()->pauseDownload(d->downloadId); + d->profile->d_ptr->profileAdapter()->pauseDownload(d->downloadId); } /*! @@ -310,7 +310,7 @@ void QQuickWebEngineDownloadItem::resume() return; if (d->profile) - d->profile->d_ptr->browserContext()->resumeDownload(d->downloadId); + d->profile->d_ptr->profileAdapter()->resumeDownload(d->downloadId); } /*! diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp index d8db796de..858b2bd95 100644 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ b/src/webengine/api/qquickwebengineprofile.cpp @@ -49,11 +49,11 @@ #include <QQmlEngine> -#include "browser_context_adapter.h" +#include "profile_adapter.h" #include "renderer_host/user_resource_controller_host.h" #include "web_engine_settings.h" -using QtWebEngineCore::BrowserContextAdapter; +using QtWebEngineCore::ProfileAdapter; QT_BEGIN_NAMESPACE @@ -141,11 +141,11 @@ ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::MimeHtmlSaveFormat, QtWebEngineC The \a download argument holds the state of the finished download instance. */ -QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(BrowserContextAdapter *browserContext) +QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(ProfileAdapter *profileAdapter) : m_settings(new QQuickWebEngineSettings()) - , m_browserContextAdapter(browserContext) + , m_profileAdapter(profileAdapter) { - m_browserContextAdapter->addClient(this); + profileAdapter->addClient(this); m_settings->d_ptr->initDefaults(); // Fullscreen API was implemented before the supported setting, so we must // make it default true to avoid change in default API behavior. @@ -159,11 +159,11 @@ QQuickWebEngineProfilePrivate::~QQuickWebEngineProfilePrivate() m_webContentsAdapterClients.first()->destroy(); } - if (m_browserContextAdapter) { + if (m_profileAdapter) { // In the case the user sets this profile as the parent of the interceptor // it can be deleted before the browser-context still referencing it is. - m_browserContextAdapter->setRequestInterceptor(nullptr); - m_browserContextAdapter->removeClient(this); + m_profileAdapter->setRequestInterceptor(nullptr); + m_profileAdapter->removeClient(this); } for (QQuickWebEngineDownloadItem *download : qAsConst(m_ongoingDownloads)) { @@ -174,7 +174,7 @@ QQuickWebEngineProfilePrivate::~QQuickWebEngineProfilePrivate() m_ongoingDownloads.clear(); if (q_ptr != QQuickWebEngineProfile::defaultProfile()) - delete m_browserContextAdapter; + delete m_profileAdapter; } void QQuickWebEngineProfilePrivate::addWebContentsAdapterClient(QQuickWebEngineViewPrivate *adapter) @@ -187,10 +187,20 @@ void QQuickWebEngineProfilePrivate::removeWebContentsAdapterClient(QQuickWebEngi m_webContentsAdapterClients.removeAll(adapter); } +QtWebEngineCore::ProfileAdapter *QQuickWebEngineProfilePrivate::profileAdapter() const +{ + return m_profileAdapter; +} + +QQuickWebEngineSettings *QQuickWebEngineProfilePrivate::settings() const +{ + return m_settings.data(); +} + void QQuickWebEngineProfilePrivate::cancelDownload(quint32 downloadId) { - if (m_browserContextAdapter) - m_browserContextAdapter->cancelDownload(downloadId); + if (m_profileAdapter) + m_profileAdapter->cancelDownload(downloadId); } void QQuickWebEngineProfilePrivate::downloadDestroyed(quint32 downloadId) @@ -260,7 +270,7 @@ void QQuickWebEngineProfilePrivate::userScripts_append(QQmlListProperty<QQuickWe { Q_ASSERT(p && p->data); QQuickWebEngineProfilePrivate *d = static_cast<QQuickWebEngineProfilePrivate *>(p->data); - QtWebEngineCore::UserResourceControllerHost *resourceController = d->browserContext()->userResourceController(); + QtWebEngineCore::UserResourceControllerHost *resourceController = d->profileAdapter()->userResourceController(); d->m_userScripts.append(script); script->d_func()->bind(resourceController); } @@ -283,7 +293,7 @@ void QQuickWebEngineProfilePrivate::userScripts_clear(QQmlListProperty<QQuickWeb { Q_ASSERT(p && p->data); QQuickWebEngineProfilePrivate *d = static_cast<QQuickWebEngineProfilePrivate *>(p->data); - QtWebEngineCore::UserResourceControllerHost *resourceController = d->browserContext()->userResourceController(); + QtWebEngineCore::UserResourceControllerHost *resourceController = d->profileAdapter()->userResourceController(); resourceController->clearAllScripts(NULL); d->m_userScripts.clear(); } @@ -325,7 +335,7 @@ void QQuickWebEngineProfilePrivate::userScripts_clear(QQmlListProperty<QQuickWeb */ QQuickWebEngineProfile::QQuickWebEngineProfile(QObject *parent) : QObject(parent), - d_ptr(new QQuickWebEngineProfilePrivate(new QtWebEngineCore::BrowserContextAdapter())) + d_ptr(new QQuickWebEngineProfilePrivate(new QtWebEngineCore::ProfileAdapter())) { // Sets up the global WebEngineContext QQuickWebEngineProfile::defaultProfile(); @@ -367,23 +377,23 @@ QQuickWebEngineProfile::~QQuickWebEngineProfile() QString QQuickWebEngineProfile::storageName() const { const Q_D(QQuickWebEngineProfile); - return d->browserContext()->storageName(); + return d->profileAdapter()->storageName(); } void QQuickWebEngineProfile::setStorageName(const QString &name) { Q_D(QQuickWebEngineProfile); - if (d->browserContext()->storageName() == name) + if (d->profileAdapter()->storageName() == name) return; - BrowserContextAdapter::HttpCacheType oldCacheType = d->browserContext()->httpCacheType(); - BrowserContextAdapter::PersistentCookiesPolicy oldPolicy = d->browserContext()->persistentCookiesPolicy(); - d->browserContext()->setStorageName(name); + ProfileAdapter::HttpCacheType oldCacheType = d->profileAdapter()->httpCacheType(); + ProfileAdapter::PersistentCookiesPolicy oldPolicy = d->profileAdapter()->persistentCookiesPolicy(); + d->profileAdapter()->setStorageName(name); emit storageNameChanged(); emit persistentStoragePathChanged(); emit cachePathChanged(); - if (d->browserContext()->httpCacheType() != oldCacheType) + if (d->profileAdapter()->httpCacheType() != oldCacheType) emit httpCacheTypeChanged(); - if (d->browserContext()->persistentCookiesPolicy() != oldPolicy) + if (d->profileAdapter()->persistentCookiesPolicy() != oldPolicy) emit persistentCookiesPolicyChanged(); } @@ -407,21 +417,21 @@ void QQuickWebEngineProfile::setStorageName(const QString &name) bool QQuickWebEngineProfile::isOffTheRecord() const { const Q_D(QQuickWebEngineProfile); - return d->browserContext()->isOffTheRecord(); + return d->profileAdapter()->isOffTheRecord(); } void QQuickWebEngineProfile::setOffTheRecord(bool offTheRecord) { Q_D(QQuickWebEngineProfile); - if (d->browserContext()->isOffTheRecord() == offTheRecord) + if (d->profileAdapter()->isOffTheRecord() == offTheRecord) return; - BrowserContextAdapter::HttpCacheType oldCacheType = d->browserContext()->httpCacheType(); - BrowserContextAdapter::PersistentCookiesPolicy oldPolicy = d->browserContext()->persistentCookiesPolicy(); - d->browserContext()->setOffTheRecord(offTheRecord); + ProfileAdapter::HttpCacheType oldCacheType = d->profileAdapter()->httpCacheType(); + ProfileAdapter::PersistentCookiesPolicy oldPolicy = d->profileAdapter()->persistentCookiesPolicy(); + d->profileAdapter()->setOffTheRecord(offTheRecord); emit offTheRecordChanged(); - if (d->browserContext()->httpCacheType() != oldCacheType) + if (d->profileAdapter()->httpCacheType() != oldCacheType) emit httpCacheTypeChanged(); - if (d->browserContext()->persistentCookiesPolicy() != oldPolicy) + if (d->profileAdapter()->persistentCookiesPolicy() != oldPolicy) emit persistentCookiesPolicyChanged(); } @@ -450,7 +460,7 @@ void QQuickWebEngineProfile::setOffTheRecord(bool offTheRecord) QString QQuickWebEngineProfile::persistentStoragePath() const { const Q_D(QQuickWebEngineProfile); - return d->browserContext()->dataPath(); + return d->profileAdapter()->dataPath(); } void QQuickWebEngineProfile::setPersistentStoragePath(const QString &path) @@ -458,7 +468,7 @@ void QQuickWebEngineProfile::setPersistentStoragePath(const QString &path) Q_D(QQuickWebEngineProfile); if (persistentStoragePath() == path) return; - d->browserContext()->setDataPath(path); + d->profileAdapter()->setDataPath(path); emit persistentStoragePathChanged(); } @@ -485,7 +495,7 @@ void QQuickWebEngineProfile::setPersistentStoragePath(const QString &path) QString QQuickWebEngineProfile::cachePath() const { const Q_D(QQuickWebEngineProfile); - return d->browserContext()->cachePath(); + return d->profileAdapter()->cachePath(); } void QQuickWebEngineProfile::setCachePath(const QString &path) @@ -493,7 +503,7 @@ void QQuickWebEngineProfile::setCachePath(const QString &path) Q_D(QQuickWebEngineProfile); if (cachePath() == path) return; - d->browserContext()->setCachePath(path); + d->profileAdapter()->setCachePath(path); emit cachePathChanged(); } @@ -516,15 +526,15 @@ void QQuickWebEngineProfile::setCachePath(const QString &path) QString QQuickWebEngineProfile::httpUserAgent() const { const Q_D(QQuickWebEngineProfile); - return d->browserContext()->httpUserAgent(); + return d->profileAdapter()->httpUserAgent(); } void QQuickWebEngineProfile::setHttpUserAgent(const QString &userAgent) { Q_D(QQuickWebEngineProfile); - if (d->browserContext()->httpUserAgent() == userAgent) + if (d->profileAdapter()->httpUserAgent() == userAgent) return; - d->browserContext()->setHttpUserAgent(userAgent); + d->profileAdapter()->setHttpUserAgent(userAgent); emit httpUserAgentChanged(); } @@ -554,15 +564,15 @@ void QQuickWebEngineProfile::setHttpUserAgent(const QString &userAgent) QQuickWebEngineProfile::HttpCacheType QQuickWebEngineProfile::httpCacheType() const { const Q_D(QQuickWebEngineProfile); - return QQuickWebEngineProfile::HttpCacheType(d->browserContext()->httpCacheType()); + return QQuickWebEngineProfile::HttpCacheType(d->profileAdapter()->httpCacheType()); } void QQuickWebEngineProfile::setHttpCacheType(QQuickWebEngineProfile::HttpCacheType httpCacheType) { Q_D(QQuickWebEngineProfile); - BrowserContextAdapter::HttpCacheType oldCacheType = d->browserContext()->httpCacheType(); - d->browserContext()->setHttpCacheType(BrowserContextAdapter::HttpCacheType(httpCacheType)); - if (d->browserContext()->httpCacheType() != oldCacheType) + ProfileAdapter::HttpCacheType oldCacheType = d->profileAdapter()->httpCacheType(); + d->profileAdapter()->setHttpCacheType(ProfileAdapter::HttpCacheType(httpCacheType)); + if (d->profileAdapter()->httpCacheType() != oldCacheType) emit httpCacheTypeChanged(); } @@ -591,15 +601,15 @@ void QQuickWebEngineProfile::setHttpCacheType(QQuickWebEngineProfile::HttpCacheT QQuickWebEngineProfile::PersistentCookiesPolicy QQuickWebEngineProfile::persistentCookiesPolicy() const { const Q_D(QQuickWebEngineProfile); - return QQuickWebEngineProfile::PersistentCookiesPolicy(d->browserContext()->persistentCookiesPolicy()); + return QQuickWebEngineProfile::PersistentCookiesPolicy(d->profileAdapter()->persistentCookiesPolicy()); } void QQuickWebEngineProfile::setPersistentCookiesPolicy(QQuickWebEngineProfile::PersistentCookiesPolicy newPersistentCookiesPolicy) { Q_D(QQuickWebEngineProfile); - BrowserContextAdapter::PersistentCookiesPolicy oldPolicy = d->browserContext()->persistentCookiesPolicy(); - d->browserContext()->setPersistentCookiesPolicy(BrowserContextAdapter::PersistentCookiesPolicy(newPersistentCookiesPolicy)); - if (d->browserContext()->persistentCookiesPolicy() != oldPolicy) + ProfileAdapter::PersistentCookiesPolicy oldPolicy = d->profileAdapter()->persistentCookiesPolicy(); + d->profileAdapter()->setPersistentCookiesPolicy(ProfileAdapter::PersistentCookiesPolicy(newPersistentCookiesPolicy)); + if (d->profileAdapter()->persistentCookiesPolicy() != oldPolicy) emit persistentCookiesPolicyChanged(); } @@ -624,15 +634,15 @@ void QQuickWebEngineProfile::setPersistentCookiesPolicy(QQuickWebEngineProfile:: int QQuickWebEngineProfile::httpCacheMaximumSize() const { const Q_D(QQuickWebEngineProfile); - return d->browserContext()->httpCacheMaxSize(); + return d->profileAdapter()->httpCacheMaxSize(); } void QQuickWebEngineProfile::setHttpCacheMaximumSize(int maximumSize) { Q_D(QQuickWebEngineProfile); - if (d->browserContext()->httpCacheMaxSize() == maximumSize) + if (d->profileAdapter()->httpCacheMaxSize() == maximumSize) return; - d->browserContext()->setHttpCacheMaxSize(maximumSize); + d->profileAdapter()->setHttpCacheMaxSize(maximumSize); emit httpCacheMaximumSizeChanged(); } @@ -653,15 +663,15 @@ void QQuickWebEngineProfile::setHttpCacheMaximumSize(int maximumSize) QString QQuickWebEngineProfile::httpAcceptLanguage() const { Q_D(const QQuickWebEngineProfile); - return d->browserContext()->httpAcceptLanguage(); + return d->profileAdapter()->httpAcceptLanguage(); } void QQuickWebEngineProfile::setHttpAcceptLanguage(const QString &httpAcceptLanguage) { Q_D(QQuickWebEngineProfile); - if (d->browserContext()->httpAcceptLanguage() == httpAcceptLanguage) + if (d->profileAdapter()->httpAcceptLanguage() == httpAcceptLanguage) return; - d->browserContext()->setHttpAcceptLanguage(httpAcceptLanguage); + d->profileAdapter()->setHttpAcceptLanguage(httpAcceptLanguage); emit httpAcceptLanguageChanged(); } @@ -675,8 +685,8 @@ void QQuickWebEngineProfile::setHttpAcceptLanguage(const QString &httpAcceptLang QQuickWebEngineProfile *QQuickWebEngineProfile::defaultProfile() { static QQuickWebEngineProfile *profile = new QQuickWebEngineProfile( - new QQuickWebEngineProfilePrivate(BrowserContextAdapter::defaultContext()), - BrowserContextAdapter::globalQObjectRoot()); + new QQuickWebEngineProfilePrivate(ProfileAdapter::defaultProfileAdapter()), + ProfileAdapter::globalQObjectRoot()); return profile; } @@ -706,8 +716,8 @@ QQuickWebEngineProfile *QQuickWebEngineProfile::defaultProfile() void QQuickWebEngineProfile::setSpellCheckLanguages(const QStringList &languages) { Q_D(QQuickWebEngineProfile); - if (languages != d->browserContext()->spellCheckLanguages()) { - d->browserContext()->setSpellCheckLanguages(languages); + if (languages != d->profileAdapter()->spellCheckLanguages()) { + d->profileAdapter()->setSpellCheckLanguages(languages); emit spellCheckLanguagesChanged(); } } @@ -720,7 +730,7 @@ void QQuickWebEngineProfile::setSpellCheckLanguages(const QStringList &languages QStringList QQuickWebEngineProfile::spellCheckLanguages() const { const Q_D(QQuickWebEngineProfile); - return d->browserContext()->spellCheckLanguages(); + return d->profileAdapter()->spellCheckLanguages(); } /*! @@ -741,7 +751,7 @@ void QQuickWebEngineProfile::setSpellCheckEnabled(bool enable) { Q_D(QQuickWebEngineProfile); if (enable != isSpellCheckEnabled()) { - d->browserContext()->setSpellCheckEnabled(enable); + d->profileAdapter()->setSpellCheckEnabled(enable); emit spellCheckEnabledChanged(); } } @@ -749,7 +759,7 @@ void QQuickWebEngineProfile::setSpellCheckEnabled(bool enable) bool QQuickWebEngineProfile::isSpellCheckEnabled() const { const Q_D(QQuickWebEngineProfile); - return d->browserContext()->isSpellCheckEnabled(); + return d->profileAdapter()->isSpellCheckEnabled(); } /*! @@ -759,7 +769,7 @@ bool QQuickWebEngineProfile::isSpellCheckEnabled() const QWebEngineCookieStore *QQuickWebEngineProfile::cookieStore() const { const Q_D(QQuickWebEngineProfile); - return d->browserContext()->cookieStore(); + return d->profileAdapter()->cookieStore(); } /*! @@ -781,7 +791,7 @@ QWebEngineCookieStore *QQuickWebEngineProfile::cookieStore() const void QQuickWebEngineProfile::clearHttpCache() { Q_D(QQuickWebEngineProfile); - d->browserContext()->clearHttpCache(); + d->profileAdapter()->clearHttpCache(); } @@ -795,7 +805,7 @@ void QQuickWebEngineProfile::clearHttpCache() void QQuickWebEngineProfile::setRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor) { Q_D(QQuickWebEngineProfile); - d->browserContext()->setRequestInterceptor(interceptor); + d->profileAdapter()->setRequestInterceptor(interceptor); } /*! @@ -804,8 +814,8 @@ void QQuickWebEngineProfile::setRequestInterceptor(QWebEngineUrlRequestIntercept const QWebEngineUrlSchemeHandler *QQuickWebEngineProfile::urlSchemeHandler(const QByteArray &scheme) const { const Q_D(QQuickWebEngineProfile); - if (d->browserContext()->customUrlSchemeHandlers().contains(scheme)) - return d->browserContext()->customUrlSchemeHandlers().value(scheme); + if (d->profileAdapter()->customUrlSchemeHandlers().contains(scheme)) + return d->profileAdapter()->customUrlSchemeHandlers().value(scheme); return 0; } @@ -832,12 +842,12 @@ void QQuickWebEngineProfile::installUrlSchemeHandler(const QByteArray &scheme, Q return; } - if (d->browserContext()->customUrlSchemeHandlers().contains(scheme)) { - if (d->browserContext()->customUrlSchemeHandlers().value(scheme) != handler) + if (d->profileAdapter()->customUrlSchemeHandlers().contains(scheme)) { + if (d->profileAdapter()->customUrlSchemeHandlers().value(scheme) != handler) qWarning("URL scheme handler already installed for the scheme: %s", scheme.constData()); return; } - d->browserContext()->addCustomUrlSchemeHandler(scheme, handler); + d->profileAdapter()->addCustomUrlSchemeHandler(scheme, handler); connect(handler, SIGNAL(_q_destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)), this, SLOT(destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*))); } @@ -850,7 +860,7 @@ void QQuickWebEngineProfile::removeUrlSchemeHandler(QWebEngineUrlSchemeHandler * { Q_D(QQuickWebEngineProfile); Q_ASSERT(handler); - if (!d->browserContext()->removeCustomUrlSchemeHandler(handler)) + if (!d->profileAdapter()->removeCustomUrlSchemeHandler(handler)) return; disconnect(handler, SIGNAL(_q_destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)), this, SLOT(destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*))); } @@ -863,7 +873,7 @@ void QQuickWebEngineProfile::removeUrlSchemeHandler(QWebEngineUrlSchemeHandler * void QQuickWebEngineProfile::removeUrlScheme(const QByteArray &scheme) { Q_D(QQuickWebEngineProfile); - QWebEngineUrlSchemeHandler *handler = d->browserContext()->takeCustomUrlSchemeHandler(scheme); + QWebEngineUrlSchemeHandler *handler = d->profileAdapter()->takeCustomUrlSchemeHandler(scheme); if (!handler) return; disconnect(handler, SIGNAL(_q_destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)), this, SLOT(destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*))); @@ -875,7 +885,7 @@ void QQuickWebEngineProfile::removeUrlScheme(const QByteArray &scheme) void QQuickWebEngineProfile::removeAllUrlSchemeHandlers() { Q_D(QQuickWebEngineProfile); - d->browserContext()->clearCustomUrlSchemeHandlers(); + d->profileAdapter()->clearCustomUrlSchemeHandlers(); } void QQuickWebEngineProfile::destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler *obj) diff --git a/src/webengine/api/qquickwebengineprofile.h b/src/webengine/api/qquickwebengineprofile.h index 0155c954a..4f1053924 100644 --- a/src/webengine/api/qquickwebengineprofile.h +++ b/src/webengine/api/qquickwebengineprofile.h @@ -48,10 +48,6 @@ #include <QtCore/QString> #include <QtQml/QQmlListProperty> -namespace QtWebEngineCore { -class BrowserContextAdapter; -} - QT_BEGIN_NAMESPACE class QQuickWebEngineDownloadItem; diff --git a/src/webengine/api/qquickwebengineprofile_p.h b/src/webengine/api/qquickwebengineprofile_p.h index 4bb5e6b39..dcd634b42 100644 --- a/src/webengine/api/qquickwebengineprofile_p.h +++ b/src/webengine/api/qquickwebengineprofile_p.h @@ -52,7 +52,7 @@ // #include "browser_context_adapter_client.h" -#include "browser_context_adapter.h" +#include "profile_adapter.h" #include "qquickwebengineprofile_p.h" #include <QExplicitlySharedDataPointer> @@ -69,13 +69,13 @@ class QQuickWebEngineViewPrivate; class QQuickWebEngineProfilePrivate : public QtWebEngineCore::BrowserContextAdapterClient { public: Q_DECLARE_PUBLIC(QQuickWebEngineProfile) - QQuickWebEngineProfilePrivate(QtWebEngineCore::BrowserContextAdapter *browserContext); + QQuickWebEngineProfilePrivate(QtWebEngineCore::ProfileAdapter *profileAdapter); ~QQuickWebEngineProfilePrivate(); void addWebContentsAdapterClient(QQuickWebEngineViewPrivate *adapter); void removeWebContentsAdapterClient(QQuickWebEngineViewPrivate *adapter); - QtWebEngineCore::BrowserContextAdapter* browserContext() const { return m_browserContextAdapter; } - QQuickWebEngineSettings *settings() const { return m_settings.data(); } + QtWebEngineCore::ProfileAdapter* profileAdapter() const; + QQuickWebEngineSettings *settings() const; void cancelDownload(quint32 downloadId); void downloadDestroyed(quint32 downloadId); @@ -93,7 +93,7 @@ private: friend class QQuickWebEngineViewPrivate; QQuickWebEngineProfile *q_ptr; QScopedPointer<QQuickWebEngineSettings> m_settings; - QPointer<QtWebEngineCore::BrowserContextAdapter> m_browserContextAdapter; + QPointer<QtWebEngineCore::ProfileAdapter> m_profileAdapter; QMap<quint32, QPointer<QQuickWebEngineDownloadItem> > m_ongoingDownloads; QList<QQuickWebEngineScript *> m_userScripts; QVector<QQuickWebEngineViewPrivate *> m_webContentsAdapterClients; diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index c19c731a8..83ee19f03 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -41,7 +41,7 @@ #include "qquickwebengineview_p_p.h" #include "qtwebenginecoreglobal_p.h" #include "authentication_dialog_controller.h" -#include "browser_context_adapter.h" +#include "profile_adapter.h" #include "certificate_error_controller.h" #include "file_picker_controller.h" #include "javascript_dialog_controller.h" @@ -626,9 +626,9 @@ QObject *QQuickWebEngineViewPrivate::accessibilityParentObject() return q; } -BrowserContextAdapter *QQuickWebEngineViewPrivate::browserContextAdapter() +ProfileAdapter *QQuickWebEngineViewPrivate::profileAdapter() { - return m_profile->d_ptr->browserContext(); + return m_profile->d_ptr->profileAdapter(); } WebContentsAdapter *QQuickWebEngineViewPrivate::webContentsAdapter() @@ -717,7 +717,7 @@ void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContent return; } - if (webContents->browserContextAdapter() && browserContextAdapter() != webContents->browserContextAdapter()) { + if (webContents->profileAdapter() && profileAdapter() != webContents->profileAdapter()) { qWarning("Can not adopt content from a different WebEngineProfile."); return; } @@ -774,7 +774,7 @@ void QQuickWebEngineViewPrivate::initializationFinished() adapter->openDevToolsFrontend(devToolsView->d_ptr->adapter); for (QQuickWebEngineScript *script : qAsConst(m_userScripts)) - script->d_func()->bind(browserContextAdapter()->userResourceController(), adapter.data()); + script->d_func()->bind(profileAdapter()->userResourceController(), adapter.data()); if (!m_isBeingAdopted) return; @@ -918,7 +918,7 @@ void QQuickWebEngineViewPrivate::setProfile(QQuickWebEngineProfile *profile) Q_EMIT q->profileChanged(); m_settings->setParentSettings(profile->settings()); - if (adapter->profile() != browserContextAdapter()->profile()) { + if (adapter->profile() != profileAdapter()->profile()) { // When the profile changes we need to create a new WebContentAdapter and reload the active URL. bool wasInitialized = adapter->isInitialized(); QUrl activeUrl = adapter->activeUrl(); @@ -1667,7 +1667,7 @@ void QQuickWebEngineViewPrivate::userScripts_append(QQmlListProperty<QQuickWebEn // If the adapter hasn't been initialized, we'll bind the scripts in initializationFinished() if (!d->adapter->isInitialized()) return; - UserResourceControllerHost *resourceController = d->browserContextAdapter()->userResourceController(); + UserResourceControllerHost *resourceController = d->profileAdapter()->userResourceController(); script->d_func()->bind(resourceController, d->adapter.data()); } @@ -1692,7 +1692,7 @@ void QQuickWebEngineViewPrivate::userScripts_clear(QQmlListProperty<QQuickWebEng d->m_userScripts.clear(); if (!d->adapter->isInitialized()) return; - UserResourceControllerHost *resourceController = d->browserContextAdapter()->userResourceController(); + UserResourceControllerHost *resourceController = d->profileAdapter()->userResourceController(); resourceController->clearAllScripts(d->adapter.data()); } diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index 0e48ffc94..062125e70 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -152,7 +152,7 @@ public: void setToolTip(const QString &toolTipText) override; const QObject *holdingQObject() const override; - QtWebEngineCore::BrowserContextAdapter *browserContextAdapter() override; + QtWebEngineCore::ProfileAdapter *profileAdapter() override; QtWebEngineCore::WebContentsAdapter *webContentsAdapter() override; void adoptWebContents(QtWebEngineCore::WebContentsAdapter *webContents); |