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/core | |
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/core')
31 files changed, 250 insertions, 251 deletions
diff --git a/src/core/api/qwebenginecookiestore.h b/src/core/api/qwebenginecookiestore.h index 764c7b9a7..89e72dfb0 100644 --- a/src/core/api/qwebenginecookiestore.h +++ b/src/core/api/qwebenginecookiestore.h @@ -50,7 +50,7 @@ #include <functional> namespace QtWebEngineCore { -class BrowserContextAdapter; +class ProfileAdapter; class CookieMonsterDelegateQt; } @@ -84,7 +84,7 @@ Q_SIGNALS: private: explicit QWebEngineCookieStore(QObject *parent = Q_NULLPTR); - friend class QtWebEngineCore::BrowserContextAdapter; + friend class QtWebEngineCore::ProfileAdapter; friend class QtWebEngineCore::CookieMonsterDelegateQt; Q_DISABLE_COPY(QWebEngineCookieStore) Q_DECLARE_PRIVATE(QWebEngineCookieStore) diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 7bbe85b4e..a7a2605eb 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -89,7 +89,7 @@ #include "service/service_qt.h" #include "qtwebengine/grit/qt_webengine_resources.h" -#include "browser_context_adapter.h" +#include "profile_adapter.h" #include "browser_message_filter_qt.h" #include "certificate_error_controller.h" #include "certificate_error_controller_p.h" @@ -412,7 +412,7 @@ void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost* Profile *profile = Profile::FromBrowserContext(host->GetBrowserContext()); // FIXME: Add a settings variable to enable/disable the file scheme. content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme(id, url::kFileScheme); - static_cast<ProfileQt*>(host->GetBrowserContext())->m_adapter->userResourceController()->renderProcessStartedWithHost(host); + static_cast<ProfileQt*>(host->GetBrowserContext())->m_profileAdapter->userResourceController()->renderProcessStartedWithHost(host); host->AddFilter(new BrowserMessageFilterQt(id, profile)); #if defined(Q_OS_MACOS) && QT_CONFIG(webengine_spellchecker) && QT_CONFIG(webengine_native_spellchecker) host->AddFilter(new SpellCheckMessageFilterPlatform(id)); @@ -562,7 +562,7 @@ std::string ContentBrowserClientQt::GetApplicationLocale() std::string ContentBrowserClientQt::GetAcceptLangs(content::BrowserContext *context) { - return static_cast<ProfileQt*>(context)->adapter()->httpAcceptLanguage().toStdString(); + return static_cast<ProfileQt*>(context)->profileAdapter()->httpAcceptLanguage().toStdString(); } void ContentBrowserClientQt::AppendExtraCommandLineSwitches(base::CommandLine* command_line, int child_process_id) @@ -765,7 +765,7 @@ scoped_refptr<net::URLRequestContextGetter> GetSystemRequestContextOnUIThread() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); return scoped_refptr<net::URLRequestContextGetter>( - BrowserContextAdapter::defaultContext()->profile()->GetRequestContext()); + ProfileAdapter::defaultProfileAdapter()->profile()->GetRequestContext()); } void ContentBrowserClientQt::GetGeolocationRequestContext( diff --git a/src/core/core_chromium.pri b/src/core/core_chromium.pri index 6c4bfc0e1..b349b0f4f 100644 --- a/src/core/core_chromium.pri +++ b/src/core/core_chromium.pri @@ -41,7 +41,6 @@ SOURCES = \ authentication_dialog_controller.cpp \ browser_accessibility_manager_qt.cpp \ browser_accessibility_qt.cpp \ - browser_context_adapter.cpp \ browser_context_adapter_client.cpp \ browsing_data_remover_delegate_qt.cpp \ browser_message_filter_qt.cpp \ @@ -93,6 +92,7 @@ SOURCES = \ ozone/surface_factory_qt.cpp \ permission_manager_qt.cpp \ process_main.cpp \ + profile_adapter.cpp \ profile_qt.cpp \ profile_io_data_qt.cpp \ quota_permission_context_qt.cpp \ @@ -130,7 +130,6 @@ HEADERS = \ build_config_qt.h \ browser_accessibility_manager_qt.h \ browser_accessibility_qt.h \ - browser_context_adapter.h \ browser_context_adapter_client.h \ browsing_data_remover_delegate_qt.h \ browser_message_filter_qt.h \ @@ -183,6 +182,7 @@ HEADERS = \ ozone/surface_factory_qt.h \ permission_manager_qt.h \ process_main.h \ + profile_adapter.h \ profile_qt.h \ profile_io_data_qt.h \ proxy_config_service_qt.h \ diff --git a/src/core/devtools_frontend_qt.cpp b/src/core/devtools_frontend_qt.cpp index 02473079f..154b275b5 100644 --- a/src/core/devtools_frontend_qt.cpp +++ b/src/core/devtools_frontend_qt.cpp @@ -44,7 +44,7 @@ #include "devtools_frontend_qt.h" -#include "browser_context_adapter.h" +#include "profile_adapter.h" #include "profile_qt.h" #include "web_contents_adapter.h" @@ -209,7 +209,7 @@ DevToolsFrontendQt::DevToolsFrontendQt(QSharedPointer<WebContentsAdapter> webCon { // We use a separate prefstore than one in ProfileQt, because that one is in-memory only, and this // needs to be stored or it will show introduction text on every load. - if (webContentsAdapter->browserContextAdapter()->isOffTheRecord()) + if (webContentsAdapter->profileAdapter()->isOffTheRecord()) m_prefStore = std::move(scoped_refptr<PersistentPrefStore>(new InMemoryPrefStore())); else CreateJsonPreferences(false); diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index 0a40d4284..720f88d1f 100644 --- a/src/core/download_manager_delegate_qt.cpp +++ b/src/core/download_manager_delegate_qt.cpp @@ -53,7 +53,7 @@ #include <QStandardPaths> #include "browser_context_adapter_client.h" -#include "browser_context_adapter.h" +#include "profile_adapter.h" #include "profile_qt.h" #include "qtwebenginecoreglobal.h" #include "type_conversion.h" @@ -61,13 +61,13 @@ namespace QtWebEngineCore { -DownloadManagerDelegateQt::DownloadManagerDelegateQt(BrowserContextAdapter *contextAdapter) - : m_contextAdapter(contextAdapter) +DownloadManagerDelegateQt::DownloadManagerDelegateQt(ProfileAdapter *profileAdapter) + : m_profileAdapter(profileAdapter) , m_currentId(0) , m_weakPtrFactory(this) , m_nextDownloadIsUserRequested(false) { - Q_ASSERT(m_contextAdapter); + Q_ASSERT(m_profileAdapter); } DownloadManagerDelegateQt::~DownloadManagerDelegateQt() @@ -86,7 +86,7 @@ void DownloadManagerDelegateQt::cancelDownload(const content::DownloadTargetCall void DownloadManagerDelegateQt::cancelDownload(quint32 downloadId) { - content::DownloadManager* dlm = content::BrowserContext::GetDownloadManager(m_contextAdapter->profile()); + content::DownloadManager* dlm = content::BrowserContext::GetDownloadManager(m_profileAdapter->profile()); download::DownloadItem *download = dlm->GetDownload(downloadId); if (download) download->Cancel(/* user_cancel */ true); @@ -94,7 +94,7 @@ void DownloadManagerDelegateQt::cancelDownload(quint32 downloadId) void DownloadManagerDelegateQt::pauseDownload(quint32 downloadId) { - content::DownloadManager* dlm = content::BrowserContext::GetDownloadManager(m_contextAdapter->profile()); + content::DownloadManager* dlm = content::BrowserContext::GetDownloadManager(m_profileAdapter->profile()); download::DownloadItem *download = dlm->GetDownload(downloadId); if (download) download->Pause(); @@ -102,7 +102,7 @@ void DownloadManagerDelegateQt::pauseDownload(quint32 downloadId) void DownloadManagerDelegateQt::resumeDownload(quint32 downloadId) { - content::DownloadManager* dlm = content::BrowserContext::GetDownloadManager(m_contextAdapter->profile()); + content::DownloadManager* dlm = content::BrowserContext::GetDownloadManager(m_profileAdapter->profile()); download::DownloadItem *download = dlm->GetDownload(downloadId); if (download) download->Resume(); @@ -166,7 +166,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem* } item->AddObserver(this); - QList<BrowserContextAdapterClient*> clients = m_contextAdapter->clients(); + QList<BrowserContextAdapterClient*> clients = m_profileAdapter->clients(); if (!clients.isEmpty()) { BrowserContextAdapterClient::DownloadItemInfo info = { item->GetId(), @@ -234,7 +234,7 @@ void DownloadManagerDelegateQt::ChooseSavePath(content::WebContents *web_content Q_UNUSED(default_extension); Q_UNUSED(can_save_as_complete); - QList<BrowserContextAdapterClient*> clients = m_contextAdapter->clients(); + QList<BrowserContextAdapterClient*> clients = m_profileAdapter->clients(); if (clients.isEmpty()) return; @@ -321,7 +321,7 @@ void DownloadManagerDelegateQt::savePackageDownloadCreated(download::DownloadIte void DownloadManagerDelegateQt::OnDownloadUpdated(download::DownloadItem *download) { - QList<BrowserContextAdapterClient*> clients = m_contextAdapter->clients(); + QList<BrowserContextAdapterClient*> clients = m_profileAdapter->clients(); if (!clients.isEmpty()) { BrowserContextAdapterClient::DownloadItemInfo info = { download->GetId(), diff --git a/src/core/download_manager_delegate_qt.h b/src/core/download_manager_delegate_qt.h index 57fd5389b..fa5bd12ec 100644 --- a/src/core/download_manager_delegate_qt.h +++ b/src/core/download_manager_delegate_qt.h @@ -59,7 +59,7 @@ class DownloadItem; } namespace QtWebEngineCore { -class BrowserContextAdapter; +class ProfileAdapter; class DownloadManagerDelegateInstance; class DownloadTargetHelper; @@ -68,7 +68,7 @@ class DownloadManagerDelegateQt , public download::DownloadItem::Observer { public: - DownloadManagerDelegateQt(BrowserContextAdapter *contextAdapter); + DownloadManagerDelegateQt(ProfileAdapter *profileAdapter); ~DownloadManagerDelegateQt(); void GetNextId(const content::DownloadIdCallback& callback) override; @@ -100,7 +100,7 @@ public: private: void cancelDownload(const content::DownloadTargetCallback& callback); void savePackageDownloadCreated(download::DownloadItem *download); - BrowserContextAdapter *m_contextAdapter; + ProfileAdapter *m_profileAdapter; uint64_t m_currentId; base::WeakPtrFactory<DownloadManagerDelegateQt> m_weakPtrFactory; diff --git a/src/core/net/custom_protocol_handler.cpp b/src/core/net/custom_protocol_handler.cpp index 3620bc10c..5132782c2 100644 --- a/src/core/net/custom_protocol_handler.cpp +++ b/src/core/net/custom_protocol_handler.cpp @@ -46,8 +46,8 @@ namespace QtWebEngineCore { -CustomProtocolHandler::CustomProtocolHandler(QPointer<BrowserContextAdapter> adapter) - : m_adapter(adapter) +CustomProtocolHandler::CustomProtocolHandler(QPointer<ProfileAdapter> profileAdapter) + : m_profileAdapter(profileAdapter) { } @@ -56,7 +56,7 @@ net::URLRequestJob *CustomProtocolHandler::MaybeCreateJob(net::URLRequest *reque if (!networkDelegate) return new net::URLRequestErrorJob(request, Q_NULLPTR, net::ERR_ACCESS_DENIED); - return new URLRequestCustomJob(request, networkDelegate, request->url().scheme(), m_adapter); + return new URLRequestCustomJob(request, networkDelegate, request->url().scheme(), m_profileAdapter); } } // namespace diff --git a/src/core/net/custom_protocol_handler.h b/src/core/net/custom_protocol_handler.h index 3869af143..d5b512b03 100644 --- a/src/core/net/custom_protocol_handler.h +++ b/src/core/net/custom_protocol_handler.h @@ -67,20 +67,20 @@ class URLRequestJob; namespace QtWebEngineCore { -class BrowserContextAdapter; +class ProfileAdapter; // Implements a ProtocolHandler for custom URL schemes. // If |network_delegate_| is NULL then all file requests will fail with ERR_ACCESS_DENIED. class QWEBENGINECORE_PRIVATE_EXPORT CustomProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { public: - CustomProtocolHandler(QPointer<BrowserContextAdapter> adapter); + CustomProtocolHandler(QPointer<ProfileAdapter> profileAdapter); net::URLRequestJob *MaybeCreateJob(net::URLRequest *request, net::NetworkDelegate *networkDelegate) const override; private: DISALLOW_COPY_AND_ASSIGN(CustomProtocolHandler); - QPointer<BrowserContextAdapter> m_adapter; + QPointer<ProfileAdapter> m_profileAdapter; }; } // namespace diff --git a/src/core/net/network_delegate_qt.cpp b/src/core/net/network_delegate_qt.cpp index a67baf96f..580f202e5 100644 --- a/src/core/net/network_delegate_qt.cpp +++ b/src/core/net/network_delegate_qt.cpp @@ -39,7 +39,7 @@ #include "network_delegate_qt.h" -#include "browser_context_adapter.h" +#include "profile_adapter.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/resource_request_info.h" diff --git a/src/core/net/ssl_host_state_delegate_qt.h b/src/core/net/ssl_host_state_delegate_qt.h index 3ebabb601..aeccb42fd 100644 --- a/src/core/net/ssl_host_state_delegate_qt.h +++ b/src/core/net/ssl_host_state_delegate_qt.h @@ -41,7 +41,7 @@ #define SSL_HOST_STATE_DELEGATE_QT_H #include "content/public/browser/ssl_host_state_delegate.h" -#include "browser_context_adapter.h" +#include "profile_adapter.h" namespace QtWebEngineCore { diff --git a/src/core/net/url_request_custom_job.cpp b/src/core/net/url_request_custom_job.cpp index d9337687b..c69fb1808 100644 --- a/src/core/net/url_request_custom_job.cpp +++ b/src/core/net/url_request_custom_job.cpp @@ -51,9 +51,9 @@ namespace QtWebEngineCore { URLRequestCustomJob::URLRequestCustomJob(URLRequest *request, NetworkDelegate *networkDelegate, const std::string &scheme, - QPointer<BrowserContextAdapter> adapter) + QPointer<ProfileAdapter> profileAdapter) : URLRequestJob(request, networkDelegate) - , m_proxy(new URLRequestCustomJobProxy(this, scheme, adapter)) + , m_proxy(new URLRequestCustomJobProxy(this, scheme, profileAdapter)) , m_device(nullptr) , m_error(0) , m_pendingReadSize(0) diff --git a/src/core/net/url_request_custom_job.h b/src/core/net/url_request_custom_job.h index 71c8d2613..cc997fc66 100644 --- a/src/core/net/url_request_custom_job.h +++ b/src/core/net/url_request_custom_job.h @@ -48,7 +48,7 @@ QT_FORWARD_DECLARE_CLASS(QIODevice) namespace QtWebEngineCore { -class BrowserContextAdapter; +class ProfileAdapter; class URLRequestCustomJobDelegate; class URLRequestCustomJobProxy; @@ -58,7 +58,7 @@ public: URLRequestCustomJob(net::URLRequest *request, net::NetworkDelegate *networkDelegate, const std::string &scheme, - QPointer<BrowserContextAdapter> adapter); + QPointer<ProfileAdapter> profileAdapter); void Start() override; void Kill() override; int ReadRawData(net::IOBuffer *buf, int buf_size) override; diff --git a/src/core/net/url_request_custom_job_proxy.cpp b/src/core/net/url_request_custom_job_proxy.cpp index 38fbd7670..5280318ad 100644 --- a/src/core/net/url_request_custom_job_proxy.cpp +++ b/src/core/net/url_request_custom_job_proxy.cpp @@ -41,7 +41,7 @@ #include "url_request_custom_job.h" #include "url_request_custom_job_delegate.h" #include "api/qwebengineurlrequestjob.h" -#include "browser_context_adapter.h" +#include "profile_adapter.h" #include "type_conversion.h" #include "content/public/browser/browser_thread.h" #include "web_engine_context.h" @@ -52,12 +52,12 @@ namespace QtWebEngineCore { URLRequestCustomJobProxy::URLRequestCustomJobProxy(URLRequestCustomJob *job, const std::string &scheme, - QPointer<BrowserContextAdapter> adapter) + QPointer<ProfileAdapter> profileAdapter) : m_job(job) , m_started(false) , m_scheme(scheme) , m_delegate(nullptr) - , m_adapter(adapter) + , m_profileAdapter(profileAdapter) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); } @@ -163,8 +163,8 @@ void URLRequestCustomJobProxy::initialize(GURL url, std::string method, base::Op QWebEngineUrlSchemeHandler *schemeHandler = nullptr; - if (m_adapter) - schemeHandler = m_adapter->customUrlSchemeHandlers()[toQByteArray(m_scheme)]; + if (m_profileAdapter) + schemeHandler = m_profileAdapter->customUrlSchemeHandlers()[toQByteArray(m_scheme)]; if (schemeHandler) { m_delegate = new URLRequestCustomJobDelegate(this, toQt(url), diff --git a/src/core/net/url_request_custom_job_proxy.h b/src/core/net/url_request_custom_job_proxy.h index 34d526348..3986fe119 100644 --- a/src/core/net/url_request_custom_job_proxy.h +++ b/src/core/net/url_request_custom_job_proxy.h @@ -52,7 +52,7 @@ namespace QtWebEngineCore { class URLRequestCustomJob; class URLRequestCustomJobDelegate; -class BrowserContextAdapter; +class ProfileAdapter; // Used to comunicate between URLRequestCustomJob living on the IO thread // and URLRequestCustomJobDelegate living on the UI thread. @@ -62,7 +62,7 @@ class URLRequestCustomJobProxy public: URLRequestCustomJobProxy(URLRequestCustomJob *job, const std::string &scheme, - QPointer<BrowserContextAdapter> adapter); + QPointer<ProfileAdapter> profileAdapter); ~URLRequestCustomJobProxy(); // Called from URLRequestCustomJobDelegate via post: @@ -82,7 +82,7 @@ public: // UI thread owned: std::string m_scheme; URLRequestCustomJobDelegate *m_delegate; - QPointer<BrowserContextAdapter> m_adapter; + QPointer<ProfileAdapter> m_profileAdapter; }; } // namespace QtWebEngineCore diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp index b0614ada4..65a806452 100644 --- a/src/core/permission_manager_qt.cpp +++ b/src/core/permission_manager_qt.cpp @@ -50,15 +50,15 @@ namespace QtWebEngineCore { -BrowserContextAdapter::PermissionType toQt(content::PermissionType type) +ProfileAdapter::PermissionType toQt(content::PermissionType type) { switch (type) { case content::PermissionType::GEOLOCATION: - return BrowserContextAdapter::GeolocationPermission; + return ProfileAdapter::GeolocationPermission; case content::PermissionType::AUDIO_CAPTURE: - return BrowserContextAdapter::AudioCapturePermission; + return ProfileAdapter::AudioCapturePermission; case content::PermissionType::VIDEO_CAPTURE: - return BrowserContextAdapter::VideoCapturePermission; + return ProfileAdapter::VideoCapturePermission; case content::PermissionType::FLASH: case content::PermissionType::NOTIFICATIONS: case content::PermissionType::MIDI_SYSEX: @@ -74,7 +74,7 @@ BrowserContextAdapter::PermissionType toQt(content::PermissionType type) case content::PermissionType::NUM: break; } - return BrowserContextAdapter::UnsupportedPermission; + return ProfileAdapter::UnsupportedPermission; } PermissionManagerQt::PermissionManagerQt() @@ -87,9 +87,9 @@ PermissionManagerQt::~PermissionManagerQt() { } -void PermissionManagerQt::permissionRequestReply(const QUrl &origin, BrowserContextAdapter::PermissionType type, bool reply) +void PermissionManagerQt::permissionRequestReply(const QUrl &origin, ProfileAdapter::PermissionType type, bool reply) { - QPair<QUrl, BrowserContextAdapter::PermissionType> key(origin, type); + QPair<QUrl, ProfileAdapter::PermissionType> key(origin, type); m_permissions[key] = reply; blink::mojom::PermissionStatus status = reply ? blink::mojom::PermissionStatus::GRANTED : blink::mojom::PermissionStatus::DENIED; { @@ -114,13 +114,13 @@ void PermissionManagerQt::permissionRequestReply(const QUrl &origin, BrowserCont std::vector<blink::mojom::PermissionStatus> result; result.reserve(it->types.size()); for (content::PermissionType permission : it->types) { - const BrowserContextAdapter::PermissionType permissionType = toQt(permission); - if (permissionType == BrowserContextAdapter::UnsupportedPermission) { + const ProfileAdapter::PermissionType permissionType = toQt(permission); + if (permissionType == ProfileAdapter::UnsupportedPermission) { result.push_back(blink::mojom::PermissionStatus::DENIED); continue; } - QPair<QUrl, BrowserContextAdapter::PermissionType> key(origin, permissionType); + QPair<QUrl, ProfileAdapter::PermissionType> key(origin, permissionType); if (!m_permissions.contains(key)) { answerable = false; break; @@ -140,9 +140,9 @@ void PermissionManagerQt::permissionRequestReply(const QUrl &origin, BrowserCont } } -bool PermissionManagerQt::checkPermission(const QUrl &origin, BrowserContextAdapter::PermissionType type) +bool PermissionManagerQt::checkPermission(const QUrl &origin, ProfileAdapter::PermissionType type) { - QPair<QUrl, BrowserContextAdapter::PermissionType> key(origin, type); + QPair<QUrl, ProfileAdapter::PermissionType> key(origin, type); return m_permissions.contains(key) && m_permissions[key]; } @@ -153,14 +153,14 @@ int PermissionManagerQt::RequestPermission(content::PermissionType permission, const base::Callback<void(blink::mojom::PermissionStatus)>& callback) { int request_id = ++m_requestIdCount; - BrowserContextAdapter::PermissionType permissionType = toQt(permission); - if (permissionType == BrowserContextAdapter::UnsupportedPermission) { + ProfileAdapter::PermissionType permissionType = toQt(permission); + if (permissionType == ProfileAdapter::UnsupportedPermission) { callback.Run(blink::mojom::PermissionStatus::DENIED); return kNoPendingOperation; } // Audio and video-capture should not come this way currently - Q_ASSERT(permissionType != BrowserContextAdapter::AudioCapturePermission - && permissionType != BrowserContextAdapter::VideoCapturePermission); + Q_ASSERT(permissionType != ProfileAdapter::AudioCapturePermission + && permissionType != ProfileAdapter::VideoCapturePermission); content::WebContents *webContents = frameHost->GetRenderViewHost()->GetDelegate()->GetAsWebContents(); WebContentsDelegateQt* contentsDelegate = static_cast<WebContentsDelegateQt*>(webContents->GetDelegate()); @@ -171,7 +171,7 @@ int PermissionManagerQt::RequestPermission(content::PermissionType permission, callback }; m_requests.insert(request_id, request); - if (permissionType == BrowserContextAdapter::GeolocationPermission) + if (permissionType == ProfileAdapter::GeolocationPermission) contentsDelegate->requestGeolocationPermission(request.origin); return request_id; } @@ -186,8 +186,8 @@ int PermissionManagerQt::RequestPermissions(const std::vector<content::Permissio std::vector<blink::mojom::PermissionStatus> result; result.reserve(permissions.size()); for (content::PermissionType permission : permissions) { - const BrowserContextAdapter::PermissionType permissionType = toQt(permission); - if (permissionType == BrowserContextAdapter::UnsupportedPermission) + const ProfileAdapter::PermissionType permissionType = toQt(permission); + if (permissionType == ProfileAdapter::UnsupportedPermission) result.push_back(blink::mojom::PermissionStatus::DENIED); else { answerable = false; @@ -210,8 +210,8 @@ int PermissionManagerQt::RequestPermissions(const std::vector<content::Permissio }; m_multiRequests.insert(request_id, request); for (content::PermissionType permission : permissions) { - const BrowserContextAdapter::PermissionType permissionType = toQt(permission); - if (permissionType == BrowserContextAdapter::GeolocationPermission) + const ProfileAdapter::PermissionType permissionType = toQt(permission); + if (permissionType == ProfileAdapter::GeolocationPermission) contentsDelegate->requestGeolocationPermission(request.origin); } return request_id; @@ -222,11 +222,11 @@ blink::mojom::PermissionStatus PermissionManagerQt::GetPermissionStatus( const GURL& requesting_origin, const GURL& /*embedding_origin*/) { - const BrowserContextAdapter::PermissionType permissionType = toQt(permission); - if (permissionType == BrowserContextAdapter::UnsupportedPermission) + const ProfileAdapter::PermissionType permissionType = toQt(permission); + if (permissionType == ProfileAdapter::UnsupportedPermission) return blink::mojom::PermissionStatus::DENIED; - QPair<QUrl, BrowserContextAdapter::PermissionType> key(toQt(requesting_origin), permissionType); + QPair<QUrl, ProfileAdapter::PermissionType> key(toQt(requesting_origin), permissionType); if (!m_permissions.contains(key)) return blink::mojom::PermissionStatus::ASK; if (m_permissions[key]) @@ -250,11 +250,11 @@ void PermissionManagerQt::ResetPermission( const GURL& requesting_origin, const GURL& /*embedding_origin*/) { - const BrowserContextAdapter::PermissionType permissionType = toQt(permission); - if (permissionType == BrowserContextAdapter::UnsupportedPermission) + const ProfileAdapter::PermissionType permissionType = toQt(permission); + if (permissionType == ProfileAdapter::UnsupportedPermission) return; - QPair<QUrl, BrowserContextAdapter::PermissionType> key(toQt(requesting_origin), permissionType); + QPair<QUrl, ProfileAdapter::PermissionType> key(toQt(requesting_origin), permissionType); m_permissions.remove(key); } diff --git a/src/core/permission_manager_qt.h b/src/core/permission_manager_qt.h index 6a4b78d7c..31fb257b6 100644 --- a/src/core/permission_manager_qt.h +++ b/src/core/permission_manager_qt.h @@ -42,7 +42,7 @@ #include "base/callback.h" #include "content/public/browser/permission_manager.h" -#include "browser_context_adapter.h" +#include "profile_adapter.h" #include <QHash> @@ -53,7 +53,7 @@ class PermissionManagerQt : public content::PermissionManager { public: PermissionManagerQt(); ~PermissionManagerQt(); - typedef BrowserContextAdapter::PermissionType PermissionType; + typedef ProfileAdapter::PermissionType PermissionType; void permissionRequestReply(const QUrl &origin, PermissionType type, bool reply); bool checkPermission(const QUrl &origin, PermissionType type); diff --git a/src/core/browser_context_adapter.cpp b/src/core/profile_adapter.cpp index 7d74d06c0..aa539f857 100644 --- a/src/core/browser_context_adapter.cpp +++ b/src/core/profile_adapter.cpp @@ -37,7 +37,7 @@ ** ****************************************************************************/ -#include "browser_context_adapter.h" +#include "profile_adapter.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/browser_thread.h" @@ -74,7 +74,7 @@ inline QString buildLocationFromStandardPath(const QString &standardPath, const namespace QtWebEngineCore { -BrowserContextAdapter::BrowserContextAdapter(const QString &storageName): +ProfileAdapter::ProfileAdapter(const QString &storageName): m_name(storageName) , m_offTheRecord(storageName.isEmpty()) , m_httpCacheType(DiskHttpCache) @@ -90,7 +90,7 @@ BrowserContextAdapter::BrowserContextAdapter(const QString &storageName): m_profile->m_profileIOData->initializeOnUIThread(); } -BrowserContextAdapter::~BrowserContextAdapter() +ProfileAdapter::~ProfileAdapter() { WebEngineContext::current()->removeBrowserContext(this); if (m_downloadManagerDelegate) { @@ -99,7 +99,7 @@ BrowserContextAdapter::~BrowserContextAdapter() } } -void BrowserContextAdapter::setStorageName(const QString &storageName) +void ProfileAdapter::setStorageName(const QString &storageName) { if (storageName == m_name) return; @@ -112,7 +112,7 @@ void BrowserContextAdapter::setStorageName(const QString &storageName) } } -void BrowserContextAdapter::setOffTheRecord(bool offTheRecord) +void ProfileAdapter::setOffTheRecord(bool offTheRecord) { if (offTheRecord == m_offTheRecord) return; @@ -123,38 +123,38 @@ void BrowserContextAdapter::setOffTheRecord(bool offTheRecord) resetVisitedLinksManager(); } -ProfileQt *BrowserContextAdapter::profile() +ProfileQt *ProfileAdapter::profile() { return m_profile.data(); } -VisitedLinksManagerQt *BrowserContextAdapter::visitedLinksManager() +VisitedLinksManagerQt *ProfileAdapter::visitedLinksManager() { if (!m_visitedLinksManager) resetVisitedLinksManager(); return m_visitedLinksManager.data(); } -DownloadManagerDelegateQt *BrowserContextAdapter::downloadManagerDelegate() +DownloadManagerDelegateQt *ProfileAdapter::downloadManagerDelegate() { if (!m_downloadManagerDelegate) m_downloadManagerDelegate.reset(new DownloadManagerDelegateQt(this)); return m_downloadManagerDelegate.data(); } -QWebEngineCookieStore *BrowserContextAdapter::cookieStore() +QWebEngineCookieStore *ProfileAdapter::cookieStore() { if (!m_cookieStore) m_cookieStore.reset(new QWebEngineCookieStore); return m_cookieStore.data(); } -QWebEngineUrlRequestInterceptor *BrowserContextAdapter::requestInterceptor() +QWebEngineUrlRequestInterceptor *ProfileAdapter::requestInterceptor() { return m_requestInterceptor.data(); } -void BrowserContextAdapter::setRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor) +void ProfileAdapter::setRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor) { if (m_requestInterceptor == interceptor) return; @@ -163,42 +163,42 @@ void BrowserContextAdapter::setRequestInterceptor(QWebEngineUrlRequestIntercepto m_profile->m_profileIOData->updateRequestInterceptor(); } -void BrowserContextAdapter::addClient(BrowserContextAdapterClient *adapterClient) +void ProfileAdapter::addClient(BrowserContextAdapterClient *adapterClient) { m_clients.append(adapterClient); } -void BrowserContextAdapter::removeClient(BrowserContextAdapterClient *adapterClient) +void ProfileAdapter::removeClient(BrowserContextAdapterClient *adapterClient) { m_clients.removeOne(adapterClient); } -void BrowserContextAdapter::cancelDownload(quint32 downloadId) +void ProfileAdapter::cancelDownload(quint32 downloadId) { downloadManagerDelegate()->cancelDownload(downloadId); } -void BrowserContextAdapter::pauseDownload(quint32 downloadId) +void ProfileAdapter::pauseDownload(quint32 downloadId) { downloadManagerDelegate()->pauseDownload(downloadId); } -void BrowserContextAdapter::resumeDownload(quint32 downloadId) +void ProfileAdapter::resumeDownload(quint32 downloadId) { downloadManagerDelegate()->resumeDownload(downloadId); } -BrowserContextAdapter *BrowserContextAdapter::defaultContext() +ProfileAdapter *ProfileAdapter::defaultProfileAdapter() { - return WebEngineContext::current()->defaultBrowserContext(); + return WebEngineContext::current()->defaultProfileAdapter(); } -QObject* BrowserContextAdapter::globalQObjectRoot() +QObject* ProfileAdapter::globalQObjectRoot() { return WebEngineContext::current()->globalQObject(); } -QString BrowserContextAdapter::dataPath() const +QString ProfileAdapter::dataPath() const { if (m_offTheRecord) return QString(); @@ -209,7 +209,7 @@ QString BrowserContextAdapter::dataPath() const return QString(); } -void BrowserContextAdapter::setDataPath(const QString &path) +void ProfileAdapter::setDataPath(const QString &path) { if (m_dataPath == path) return; @@ -222,7 +222,7 @@ void BrowserContextAdapter::setDataPath(const QString &path) } } -QString BrowserContextAdapter::cachePath() const +QString ProfileAdapter::cachePath() const { if (m_offTheRecord) return QString(); @@ -233,7 +233,7 @@ QString BrowserContextAdapter::cachePath() const return QString(); } -void BrowserContextAdapter::setCachePath(const QString &path) +void ProfileAdapter::setCachePath(const QString &path) { if (m_cachePath == path) return; @@ -242,7 +242,7 @@ void BrowserContextAdapter::setCachePath(const QString &path) m_profile->m_profileIOData->updateHttpCache(); } -QString BrowserContextAdapter::cookiesPath() const +QString ProfileAdapter::cookiesPath() const { if (m_offTheRecord) return QString(); @@ -257,7 +257,7 @@ QString BrowserContextAdapter::cookiesPath() const return QString(); } -QString BrowserContextAdapter::channelIdPath() const +QString ProfileAdapter::channelIdPath() const { if (m_offTheRecord) return QString(); @@ -267,7 +267,7 @@ QString BrowserContextAdapter::channelIdPath() const return QString(); } -QString BrowserContextAdapter::httpCachePath() const +QString ProfileAdapter::httpCachePath() const { if (m_offTheRecord) return QString(); @@ -277,14 +277,14 @@ QString BrowserContextAdapter::httpCachePath() const return QString(); } -QString BrowserContextAdapter::httpUserAgent() const +QString ProfileAdapter::httpUserAgent() const { if (m_httpUserAgent.isNull()) return QString::fromStdString(ContentClientQt::getUserAgent()); return m_httpUserAgent; } -void BrowserContextAdapter::setHttpUserAgent(const QString &userAgent) +void ProfileAdapter::setHttpUserAgent(const QString &userAgent) { if (m_httpUserAgent == userAgent) return; @@ -299,7 +299,7 @@ void BrowserContextAdapter::setHttpUserAgent(const QString &userAgent) m_profile->m_profileIOData->updateUserAgent(); } -BrowserContextAdapter::HttpCacheType BrowserContextAdapter::httpCacheType() const +ProfileAdapter::HttpCacheType ProfileAdapter::httpCacheType() const { if (m_httpCacheType == NoCache) return NoCache; @@ -308,9 +308,9 @@ BrowserContextAdapter::HttpCacheType BrowserContextAdapter::httpCacheType() cons return m_httpCacheType; } -void BrowserContextAdapter::setHttpCacheType(BrowserContextAdapter::HttpCacheType newhttpCacheType) +void ProfileAdapter::setHttpCacheType(ProfileAdapter::HttpCacheType newhttpCacheType) { - BrowserContextAdapter::HttpCacheType oldCacheType = httpCacheType(); + ProfileAdapter::HttpCacheType oldCacheType = httpCacheType(); m_httpCacheType = newhttpCacheType; if (oldCacheType == httpCacheType()) return; @@ -318,16 +318,16 @@ void BrowserContextAdapter::setHttpCacheType(BrowserContextAdapter::HttpCacheTyp m_profile->m_profileIOData->updateHttpCache(); } -BrowserContextAdapter::PersistentCookiesPolicy BrowserContextAdapter::persistentCookiesPolicy() const +ProfileAdapter::PersistentCookiesPolicy ProfileAdapter::persistentCookiesPolicy() const { if (isOffTheRecord() || cookiesPath().isEmpty()) return NoPersistentCookies; return m_persistentCookiesPolicy; } -void BrowserContextAdapter::setPersistentCookiesPolicy(BrowserContextAdapter::PersistentCookiesPolicy newPersistentCookiesPolicy) +void ProfileAdapter::setPersistentCookiesPolicy(ProfileAdapter::PersistentCookiesPolicy newPersistentCookiesPolicy) { - BrowserContextAdapter::PersistentCookiesPolicy oldPolicy = persistentCookiesPolicy(); + ProfileAdapter::PersistentCookiesPolicy oldPolicy = persistentCookiesPolicy(); m_persistentCookiesPolicy = newPersistentCookiesPolicy; if (oldPolicy == persistentCookiesPolicy()) return; @@ -335,7 +335,7 @@ void BrowserContextAdapter::setPersistentCookiesPolicy(BrowserContextAdapter::Pe m_profile->m_profileIOData->updateCookieStore(); } -BrowserContextAdapter::VisitedLinksPolicy BrowserContextAdapter::visitedLinksPolicy() const +ProfileAdapter::VisitedLinksPolicy ProfileAdapter::visitedLinksPolicy() const { if (isOffTheRecord() || m_visitedLinksPolicy == DoNotTrackVisitedLinks) return DoNotTrackVisitedLinks; @@ -344,7 +344,7 @@ BrowserContextAdapter::VisitedLinksPolicy BrowserContextAdapter::visitedLinksPol return m_visitedLinksPolicy; } -bool BrowserContextAdapter::trackVisitedLinks() const +bool ProfileAdapter::trackVisitedLinks() const { switch (visitedLinksPolicy()) { case DoNotTrackVisitedLinks: @@ -355,7 +355,7 @@ bool BrowserContextAdapter::trackVisitedLinks() const return true; } -bool BrowserContextAdapter::persistVisitedLinks() const +bool ProfileAdapter::persistVisitedLinks() const { switch (visitedLinksPolicy()) { case DoNotTrackVisitedLinks: @@ -367,7 +367,7 @@ bool BrowserContextAdapter::persistVisitedLinks() const return true; } -void BrowserContextAdapter::setVisitedLinksPolicy(BrowserContextAdapter::VisitedLinksPolicy visitedLinksPolicy) +void ProfileAdapter::setVisitedLinksPolicy(ProfileAdapter::VisitedLinksPolicy visitedLinksPolicy) { if (m_visitedLinksPolicy == visitedLinksPolicy) return; @@ -376,12 +376,12 @@ void BrowserContextAdapter::setVisitedLinksPolicy(BrowserContextAdapter::Visited resetVisitedLinksManager(); } -int BrowserContextAdapter::httpCacheMaxSize() const +int ProfileAdapter::httpCacheMaxSize() const { return m_httpCacheMaxSize; } -void BrowserContextAdapter::setHttpCacheMaxSize(int maxSize) +void ProfileAdapter::setHttpCacheMaxSize(int maxSize) { if (m_httpCacheMaxSize == maxSize) return; @@ -390,23 +390,23 @@ void BrowserContextAdapter::setHttpCacheMaxSize(int maxSize) m_profile->m_profileIOData->updateHttpCache(); } -const QHash<QByteArray, QWebEngineUrlSchemeHandler *> &BrowserContextAdapter::customUrlSchemeHandlers() const +const QHash<QByteArray, QWebEngineUrlSchemeHandler *> &ProfileAdapter::customUrlSchemeHandlers() const { return m_customUrlSchemeHandlers; } -const QList<QByteArray> BrowserContextAdapter::customUrlSchemes() const +const QList<QByteArray> ProfileAdapter::customUrlSchemes() const { return m_customUrlSchemeHandlers.keys(); } -void BrowserContextAdapter::updateCustomUrlSchemeHandlers() +void ProfileAdapter::updateCustomUrlSchemeHandlers() { if (m_profile->m_urlRequestContextGetter.get()) m_profile->m_profileIOData->updateJobFactory(); } -bool BrowserContextAdapter::removeCustomUrlSchemeHandler(QWebEngineUrlSchemeHandler *handler) +bool ProfileAdapter::removeCustomUrlSchemeHandler(QWebEngineUrlSchemeHandler *handler) { bool removedOneOrMore = false; auto it = m_customUrlSchemeHandlers.begin(); @@ -423,7 +423,7 @@ bool BrowserContextAdapter::removeCustomUrlSchemeHandler(QWebEngineUrlSchemeHand return removedOneOrMore; } -QWebEngineUrlSchemeHandler *BrowserContextAdapter::takeCustomUrlSchemeHandler(const QByteArray &scheme) +QWebEngineUrlSchemeHandler *ProfileAdapter::takeCustomUrlSchemeHandler(const QByteArray &scheme) { QWebEngineUrlSchemeHandler *handler = m_customUrlSchemeHandlers.take(scheme); if (handler) @@ -431,36 +431,36 @@ QWebEngineUrlSchemeHandler *BrowserContextAdapter::takeCustomUrlSchemeHandler(co return handler; } -void BrowserContextAdapter::addCustomUrlSchemeHandler(const QByteArray &scheme, QWebEngineUrlSchemeHandler *handler) +void ProfileAdapter::addCustomUrlSchemeHandler(const QByteArray &scheme, QWebEngineUrlSchemeHandler *handler) { m_customUrlSchemeHandlers.insert(scheme, handler); updateCustomUrlSchemeHandlers(); } -void BrowserContextAdapter::clearCustomUrlSchemeHandlers() +void ProfileAdapter::clearCustomUrlSchemeHandlers() { m_customUrlSchemeHandlers.clear(); updateCustomUrlSchemeHandlers(); } -UserResourceControllerHost *BrowserContextAdapter::userResourceController() +UserResourceControllerHost *ProfileAdapter::userResourceController() { if (!m_userResourceController) m_userResourceController.reset(new UserResourceControllerHost); return m_userResourceController.data(); } -void BrowserContextAdapter::permissionRequestReply(const QUrl &origin, PermissionType type, bool reply) +void ProfileAdapter::permissionRequestReply(const QUrl &origin, PermissionType type, bool reply) { static_cast<PermissionManagerQt*>(profile()->GetPermissionManager())->permissionRequestReply(origin, type, reply); } -bool BrowserContextAdapter::checkPermission(const QUrl &origin, PermissionType type) +bool ProfileAdapter::checkPermission(const QUrl &origin, PermissionType type) { return static_cast<PermissionManagerQt*>(profile()->GetPermissionManager())->checkPermission(origin, type); } -QString BrowserContextAdapter::httpAcceptLanguageWithoutQualities() const +QString ProfileAdapter::httpAcceptLanguageWithoutQualities() const { const QStringList list = m_httpAcceptLanguage.split(QLatin1Char(',')); QString out; @@ -472,12 +472,12 @@ QString BrowserContextAdapter::httpAcceptLanguageWithoutQualities() const return out; } -QString BrowserContextAdapter::httpAcceptLanguage() const +QString ProfileAdapter::httpAcceptLanguage() const { return m_httpAcceptLanguage; } -void BrowserContextAdapter::setHttpAcceptLanguage(const QString &httpAcceptLanguage) +void ProfileAdapter::setHttpAcceptLanguage(const QString &httpAcceptLanguage) { if (m_httpAcceptLanguage == httpAcceptLanguage) return; @@ -496,7 +496,7 @@ void BrowserContextAdapter::setHttpAcceptLanguage(const QString &httpAcceptLangu m_profile->m_profileIOData->updateUserAgent(); } -void BrowserContextAdapter::clearHttpCache() +void ProfileAdapter::clearHttpCache() { content::BrowsingDataRemover *remover = content::BrowserContext::GetBrowsingDataRemover(m_profile.data()); remover->Remove(base::Time(), base::Time::Max(), @@ -504,14 +504,14 @@ void BrowserContextAdapter::clearHttpCache() content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB | content::BrowsingDataRemover::ORIGIN_TYPE_PROTECTED_WEB); } -void BrowserContextAdapter::setSpellCheckLanguages(const QStringList &languages) +void ProfileAdapter::setSpellCheckLanguages(const QStringList &languages) { #if QT_CONFIG(webengine_spellchecker) m_profile->setSpellCheckLanguages(languages); #endif } -QStringList BrowserContextAdapter::spellCheckLanguages() const +QStringList ProfileAdapter::spellCheckLanguages() const { #if QT_CONFIG(webengine_spellchecker) return m_profile->spellCheckLanguages(); @@ -520,14 +520,14 @@ QStringList BrowserContextAdapter::spellCheckLanguages() const #endif } -void BrowserContextAdapter::setSpellCheckEnabled(bool enabled) +void ProfileAdapter::setSpellCheckEnabled(bool enabled) { #if QT_CONFIG(webengine_spellchecker) m_profile->setSpellCheckEnabled(enabled); #endif } -bool BrowserContextAdapter::isSpellCheckEnabled() const +bool ProfileAdapter::isSpellCheckEnabled() const { #if QT_CONFIG(webengine_spellchecker) return m_profile->isSpellCheckEnabled(); @@ -536,7 +536,7 @@ bool BrowserContextAdapter::isSpellCheckEnabled() const #endif } -void BrowserContextAdapter::resetVisitedLinksManager() +void ProfileAdapter::resetVisitedLinksManager() { m_visitedLinksManager.reset(new VisitedLinksManagerQt(this)); } diff --git a/src/core/browser_context_adapter.h b/src/core/profile_adapter.h index da9f37645..64d73bd34 100644 --- a/src/core/browser_context_adapter.h +++ b/src/core/profile_adapter.h @@ -48,8 +48,8 @@ // We mean it. // -#ifndef BROWSER_CONTEXT_ADAPTER_H -#define BROWSER_CONTEXT_ADAPTER_H +#ifndef PROFILE_ADAPTER_H +#define PROFILE_ADAPTER_H #include "qtwebenginecoreglobal_p.h" @@ -74,13 +74,13 @@ class ProfileQt; class UserResourceControllerHost; class VisitedLinksManagerQt; -class QWEBENGINECORE_PRIVATE_EXPORT BrowserContextAdapter : public QObject +class QWEBENGINECORE_PRIVATE_EXPORT ProfileAdapter : public QObject { public: - explicit BrowserContextAdapter(const QString &storagePrefix = QString()); - virtual ~BrowserContextAdapter(); + explicit ProfileAdapter(const QString &storagePrefix = QString()); + virtual ~ProfileAdapter(); - static BrowserContextAdapter* defaultContext(); + static ProfileAdapter* defaultProfileAdapter(); static QObject* globalQObjectRoot(); VisitedLinksManagerQt *visitedLinksManager(); @@ -154,13 +154,13 @@ public: }; HttpCacheType httpCacheType() const; - void setHttpCacheType(BrowserContextAdapter::HttpCacheType); + void setHttpCacheType(ProfileAdapter::HttpCacheType); PersistentCookiesPolicy persistentCookiesPolicy() const; - void setPersistentCookiesPolicy(BrowserContextAdapter::PersistentCookiesPolicy); + void setPersistentCookiesPolicy(ProfileAdapter::PersistentCookiesPolicy); VisitedLinksPolicy visitedLinksPolicy() const; - void setVisitedLinksPolicy(BrowserContextAdapter::VisitedLinksPolicy); + void setVisitedLinksPolicy(ProfileAdapter::VisitedLinksPolicy); int httpCacheMaxSize() const; void setHttpCacheMaxSize(int maxSize); @@ -209,9 +209,9 @@ private: QList<BrowserContextAdapterClient*> m_clients; int m_httpCacheMaxSize; - Q_DISABLE_COPY(BrowserContextAdapter) + Q_DISABLE_COPY(ProfileAdapter) }; } // namespace QtWebEngineCore -#endif // BROWSER_CONTEXT_ADAPTER_H +#endif // PROFILE_ADAPTER_H diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp index 3ed4f2650..a011c2b81 100644 --- a/src/core/profile_io_data_qt.cpp +++ b/src/core/profile_io_data_qt.cpp @@ -207,7 +207,7 @@ void ProfileIODataQt::initializeOnIOThread() void ProfileIODataQt::initializeOnUIThread() { - m_browserContextAdapter = m_profile->adapter(); + m_profileAdapter = m_profile->profileAdapter(); DCHECK_CURRENTLY_ON(content::BrowserThread::UI); m_resourceContext.reset(new ResourceContextQt(this)); ProtocolHandlerRegistry* protocolHandlerRegistry = @@ -216,7 +216,7 @@ void ProfileIODataQt::initializeOnUIThread() m_protocolHandlerInterceptor = protocolHandlerRegistry->CreateJobInterceptorFactory(); m_cookieDelegate = new CookieMonsterDelegateQt(); - m_cookieDelegate->setClient(m_profile->adapter()->cookieStore()); + m_cookieDelegate->setClient(m_profile->profileAdapter()->cookieStore()); } void ProfileIODataQt::cancelAllUrlRequests() @@ -320,7 +320,7 @@ void ProfileIODataQt::generateCookieStore() m_updateCookieStore = false; scoped_refptr<net::SQLiteChannelIDStore> channel_id_db; - if (!m_channelIdPath.isEmpty() && m_persistentCookiesPolicy != BrowserContextAdapter::NoPersistentCookies) { + if (!m_channelIdPath.isEmpty() && m_persistentCookiesPolicy != ProfileAdapter::NoPersistentCookies) { channel_id_db = new net::SQLiteChannelIDStore( toFilePath(m_channelIdPath), base::CreateSequencedTaskRunnerWithTraits( @@ -338,7 +338,7 @@ void ProfileIODataQt::generateCookieStore() std::unique_ptr<net::CookieStore> cookieStore; switch (m_persistentCookiesPolicy) { - case BrowserContextAdapter::NoPersistentCookies: + case ProfileAdapter::NoPersistentCookies: cookieStore = content::CreateCookieStore( content::CookieStoreConfig( base::FilePath(), @@ -347,7 +347,7 @@ void ProfileIODataQt::generateCookieStore() nullptr) ); break; - case BrowserContextAdapter::AllowPersistentCookies: + case ProfileAdapter::AllowPersistentCookies: cookieStore = content::CreateCookieStore( content::CookieStoreConfig( toFilePath(m_cookiesPath), @@ -356,7 +356,7 @@ void ProfileIODataQt::generateCookieStore() nullptr) ); break; - case BrowserContextAdapter::ForcePersistentCookies: + case ProfileAdapter::ForcePersistentCookies: cookieStore = content::CreateCookieStore( content::CookieStoreConfig( toFilePath(m_cookiesPath), @@ -410,7 +410,7 @@ void ProfileIODataQt::generateHttpCache() net::HttpCache::DefaultBackend* main_backend = 0; switch (m_httpCacheType) { - case BrowserContextAdapter::MemoryHttpCache: + case ProfileAdapter::MemoryHttpCache: main_backend = new net::HttpCache::DefaultBackend( net::MEMORY_CACHE, @@ -419,7 +419,7 @@ void ProfileIODataQt::generateHttpCache() m_httpCacheMaxSize ); break; - case BrowserContextAdapter::DiskHttpCache: + case ProfileAdapter::DiskHttpCache: main_backend = new net::HttpCache::DefaultBackend( net::DISK_CACHE, @@ -428,7 +428,7 @@ void ProfileIODataQt::generateHttpCache() m_httpCacheMaxSize ); break; - case BrowserContextAdapter::NoCache: + case ProfileAdapter::NoCache: // It's safe to not create BackendFactory. break; } @@ -485,7 +485,7 @@ void ProfileIODataQt::generateJobFactory() for (const QByteArray &scheme : qAsConst(m_installedCustomSchemes)) { jobFactory->SetProtocolHandler(scheme.toStdString(), std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>( - new CustomProtocolHandler(m_browserContextAdapter))); + new CustomProtocolHandler(m_profileAdapter))); } m_baseJobFactory = jobFactory.get(); @@ -531,7 +531,7 @@ void ProfileIODataQt::regenerateJobFactory() for (const QByteArray &scheme : qAsConst(m_installedCustomSchemes)) { m_baseJobFactory->SetProtocolHandler(scheme.toStdString(), std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>( - new CustomProtocolHandler(m_browserContextAdapter))); + new CustomProtocolHandler(m_profileAdapter))); } } @@ -547,16 +547,16 @@ void ProfileIODataQt::setRequestContextData(content::ProtocolHandlerMap *protoco void ProfileIODataQt::setFullConfiguration() { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - m_requestInterceptor = m_browserContextAdapter->requestInterceptor(); - m_persistentCookiesPolicy = m_browserContextAdapter->persistentCookiesPolicy(); - m_cookiesPath = m_browserContextAdapter->cookiesPath(); - m_channelIdPath = m_browserContextAdapter->channelIdPath(); - m_httpAcceptLanguage = m_browserContextAdapter->httpAcceptLanguage(); - m_httpUserAgent = m_browserContextAdapter->httpUserAgent(); - m_httpCacheType = m_browserContextAdapter->httpCacheType(); - m_httpCachePath = m_browserContextAdapter->httpCachePath(); - m_httpCacheMaxSize = m_browserContextAdapter->httpCacheMaxSize(); - m_customUrlSchemes = m_browserContextAdapter->customUrlSchemes(); + m_requestInterceptor = m_profileAdapter->requestInterceptor(); + m_persistentCookiesPolicy = m_profileAdapter->persistentCookiesPolicy(); + m_cookiesPath = m_profileAdapter->cookiesPath(); + m_channelIdPath = m_profileAdapter->channelIdPath(); + m_httpAcceptLanguage = m_profileAdapter->httpAcceptLanguage(); + m_httpUserAgent = m_profileAdapter->httpUserAgent(); + m_httpCacheType = m_profileAdapter->httpCacheType(); + m_httpCachePath = m_profileAdapter->httpCachePath(); + m_httpCacheMaxSize = m_profileAdapter->httpCacheMaxSize(); + m_customUrlSchemes = m_profileAdapter->customUrlSchemes(); } void ProfileIODataQt::updateStorageSettings() @@ -588,9 +588,9 @@ void ProfileIODataQt::updateCookieStore() { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); QMutexLocker lock(&m_mutex); - m_persistentCookiesPolicy = m_browserContextAdapter->persistentCookiesPolicy(); - m_cookiesPath = m_browserContextAdapter->cookiesPath(); - m_channelIdPath = m_browserContextAdapter->channelIdPath(); + m_persistentCookiesPolicy = m_profileAdapter->persistentCookiesPolicy(); + m_cookiesPath = m_profileAdapter->cookiesPath(); + m_channelIdPath = m_profileAdapter->channelIdPath(); if (m_initialized && !m_updateAllStorage && !m_updateCookieStore) { m_updateCookieStore = true; @@ -604,8 +604,8 @@ void ProfileIODataQt::updateUserAgent() { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); QMutexLocker lock(&m_mutex); - m_httpAcceptLanguage = m_browserContextAdapter->httpAcceptLanguage(); - m_httpUserAgent = m_browserContextAdapter->httpUserAgent(); + m_httpAcceptLanguage = m_profileAdapter->httpAcceptLanguage(); + m_httpUserAgent = m_profileAdapter->httpUserAgent(); if (m_initialized && !m_updateAllStorage && !m_updateUserAgent) { m_updateUserAgent = true; @@ -618,13 +618,13 @@ void ProfileIODataQt::updateHttpCache() { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); QMutexLocker lock(&m_mutex); - m_httpCacheType = m_browserContextAdapter->httpCacheType(); - m_httpCachePath = m_browserContextAdapter->httpCachePath(); - m_httpCacheMaxSize = m_browserContextAdapter->httpCacheMaxSize(); + m_httpCacheType = m_profileAdapter->httpCacheType(); + m_httpCachePath = m_profileAdapter->httpCachePath(); + m_httpCacheMaxSize = m_profileAdapter->httpCacheMaxSize(); - if (m_httpCacheType == BrowserContextAdapter::NoCache) { + if (m_httpCacheType == ProfileAdapter::NoCache) { content::BrowsingDataRemover *remover = - content::BrowserContext::GetBrowsingDataRemover(m_browserContextAdapter->profile()); + content::BrowserContext::GetBrowsingDataRemover(m_profileAdapter->profile()); remover->Remove(base::Time(), base::Time::Max(), content::BrowsingDataRemover::DATA_TYPE_CACHE, content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB | @@ -643,7 +643,7 @@ void ProfileIODataQt::updateJobFactory() Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); QMutexLocker lock(&m_mutex); - m_customUrlSchemes = m_browserContextAdapter->customUrlSchemes(); + m_customUrlSchemes = m_profileAdapter->customUrlSchemes(); if (m_initialized && !m_updateJobFactory) { m_updateJobFactory = true; @@ -656,7 +656,7 @@ void ProfileIODataQt::updateRequestInterceptor() { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); QMutexLocker lock(&m_mutex); - m_requestInterceptor = m_browserContextAdapter->requestInterceptor(); + m_requestInterceptor = m_profileAdapter->requestInterceptor(); // We in this case do not need to regenerate any Chromium classes. } } // namespace QtWebEngineCore diff --git a/src/core/profile_io_data_qt.h b/src/core/profile_io_data_qt.h index c11227423..db0ec0146 100644 --- a/src/core/profile_io_data_qt.h +++ b/src/core/profile_io_data_qt.h @@ -40,8 +40,7 @@ #ifndef PROFILE_IO_DATA_QT_H #define PROFILE_IO_DATA_QT_H -#include "browser_context_adapter.h" - +#include "profile_adapter.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/custom_handlers/protocol_handler_registry.h" #include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h" @@ -118,13 +117,13 @@ private: proxy_resolver::mojom::ProxyResolverFactoryPtr m_proxyResolverFactory; net::URLRequestJobFactoryImpl *m_baseJobFactory = nullptr; QAtomicPointer<net::ProxyConfigService> m_proxyConfigService; - QPointer<BrowserContextAdapter> m_browserContextAdapter; // never dereferenced in IO thread and it is passed by qpointer - BrowserContextAdapter::PersistentCookiesPolicy m_persistentCookiesPolicy; + QPointer<ProfileAdapter> m_profileAdapter; // never dereferenced in IO thread and it is passed by qpointer + ProfileAdapter::PersistentCookiesPolicy m_persistentCookiesPolicy; QString m_cookiesPath; QString m_channelIdPath; QString m_httpAcceptLanguage; QString m_httpUserAgent; - BrowserContextAdapter::HttpCacheType m_httpCacheType; + ProfileAdapter::HttpCacheType m_httpCacheType; QString m_httpCachePath; QList<QByteArray> m_customUrlSchemes; QList<QByteArray> m_installedCustomSchemes; diff --git a/src/core/profile_qt.cpp b/src/core/profile_qt.cpp index a499e0849..f14782cfe 100644 --- a/src/core/profile_qt.cpp +++ b/src/core/profile_qt.cpp @@ -39,7 +39,7 @@ #include "profile_qt.h" -#include "browser_context_adapter.h" +#include "profile_adapter.h" #include "browsing_data_remover_delegate_qt.h" #include "download_manager_delegate_qt.h" #include "net/ssl_host_state_delegate_qt.h" @@ -70,9 +70,9 @@ namespace QtWebEngineCore { -ProfileQt::ProfileQt(BrowserContextAdapter *adapter) +ProfileQt::ProfileQt(ProfileAdapter *profileAdapter) : m_profileIOData(new ProfileIODataQt(this)), - m_adapter(adapter) + m_profileAdapter(profileAdapter) { PrefServiceFactory factory; factory.set_user_prefs(new InMemoryPrefStore); @@ -120,12 +120,12 @@ const PrefService* ProfileQt::GetPrefs() const base::FilePath ProfileQt::GetPath() const { - return toFilePath(m_adapter->dataPath()); + return toFilePath(m_profileAdapter->dataPath()); } bool ProfileQt::IsOffTheRecord() const { - return m_adapter->isOffTheRecord(); + return m_profileAdapter->isOffTheRecord(); } net::URLRequestContextGetter *ProfileQt::GetRequestContext() @@ -151,7 +151,7 @@ content::ResourceContext *ProfileQt::GetResourceContext() content::DownloadManagerDelegate *ProfileQt::GetDownloadManagerDelegate() { - return m_adapter->downloadManagerDelegate(); + return m_profileAdapter->downloadManagerDelegate(); } content::BrowserPluginGuestManager *ProfileQt::GetGuestManager() diff --git a/src/core/profile_qt.h b/src/core/profile_qt.h index b8de5531c..56b52198c 100644 --- a/src/core/profile_qt.h +++ b/src/core/profile_qt.h @@ -55,14 +55,14 @@ class PrefService; namespace QtWebEngineCore { -class BrowserContextAdapter; +class ProfileAdapter; class PermissionManagerQt; class SSLHostStateDelegateQt; class ProfileQt : public Profile { public: - explicit ProfileQt(BrowserContextAdapter *); + explicit ProfileQt(ProfileAdapter *profileAdapter); virtual ~ProfileQt(); @@ -99,7 +99,7 @@ public: const PrefService *GetPrefs() const override; net::URLRequestContextGetter *GetRequestContext() override; - BrowserContextAdapter *adapter() { return m_adapter; } + ProfileAdapter *profileAdapter() { return m_profileAdapter; } #if QT_CONFIG(webengine_spellchecker) void FailedToLoadDictionary(const std::string &language) override; @@ -117,8 +117,8 @@ private: std::unique_ptr<SSLHostStateDelegateQt> m_sslHostStateDelegate; std::unique_ptr<PrefService> m_prefService; std::unique_ptr<ProfileIODataQt> m_profileIOData; - BrowserContextAdapter *m_adapter; - friend class BrowserContextAdapter; + ProfileAdapter *m_profileAdapter; + friend class ProfileAdapter; DISALLOW_COPY_AND_ASSIGN(ProfileQt); }; diff --git a/src/core/visited_links_manager_qt.cpp b/src/core/visited_links_manager_qt.cpp index abde6c2c3..ac27446b8 100644 --- a/src/core/visited_links_manager_qt.cpp +++ b/src/core/visited_links_manager_qt.cpp @@ -39,7 +39,7 @@ #include "visited_links_manager_qt.h" -#include "browser_context_adapter.h" +#include "profile_adapter.h" #include "content_browser_client_qt.h" #include "profile_qt.h" #include "type_conversion.h" @@ -106,7 +106,7 @@ static void ensureDirectoryExists(const base::FilePath &path) errorstr.c_str()); } -VisitedLinksManagerQt::VisitedLinksManagerQt(BrowserContextAdapter *adapter) +VisitedLinksManagerQt::VisitedLinksManagerQt(ProfileAdapter *adapter) : m_delegate(new VisitedLinkDelegateQt) { Q_ASSERT(adapter && adapter->profile()); diff --git a/src/core/visited_links_manager_qt.h b/src/core/visited_links_manager_qt.h index ee836d118..8d9a7495b 100644 --- a/src/core/visited_links_manager_qt.h +++ b/src/core/visited_links_manager_qt.h @@ -67,14 +67,14 @@ class GURL; namespace QtWebEngineCore { -class BrowserContextAdapter; +class ProfileAdapter; class VisitedLinkDelegateQt; class QWEBENGINECORE_PRIVATE_EXPORT VisitedLinksManagerQt { public: virtual~VisitedLinksManagerQt(); - VisitedLinksManagerQt(BrowserContextAdapter*); + VisitedLinksManagerQt(ProfileAdapter *profileAdapter); void deleteAllVisitedLinkData(); void deleteVisitedLinkDataForUrls(const QList<QUrl> &); diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index e239e853a..047d3e0c2 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -45,7 +45,7 @@ #include "browser_accessibility_qt.h" #include "browser_context_adapter_client.h" -#include "browser_context_adapter.h" +#include "profile_adapter.h" #include "devtools_frontend_qt.h" #include "download_manager_delegate_qt.h" #include "media_capture_devices_dispatcher.h" @@ -358,13 +358,13 @@ QSharedPointer<WebContentsAdapter> WebContentsAdapter::createFromSerializedNavig { int currentIndex; std::vector<std::unique_ptr<content::NavigationEntry>> entries; - deserializeNavigationHistory(input, ¤tIndex, &entries, adapterClient->browserContextAdapter()->profile()); + deserializeNavigationHistory(input, ¤tIndex, &entries, adapterClient->profileAdapter()->profile()); if (currentIndex == -1) return QSharedPointer<WebContentsAdapter>(); // Unlike WebCore, Chromium only supports Restoring to a new WebContents instance. - content::WebContents* newWebContents = createBlankWebContents(adapterClient, adapterClient->browserContextAdapter()->profile()); + content::WebContents* newWebContents = createBlankWebContents(adapterClient, adapterClient->profileAdapter()->profile()); content::NavigationController &controller = newWebContents->GetController(); controller.Restore(currentIndex, content::RestoreType::LAST_SESSION_EXITED_CLEANLY, &entries); @@ -383,7 +383,7 @@ QSharedPointer<WebContentsAdapter> WebContentsAdapter::createFromSerializedNavig } WebContentsAdapter::WebContentsAdapter(content::WebContents *webContents) - : m_browserContextAdapter(nullptr) + : m_profileAdapter(nullptr) , m_webContents(webContents) , m_webChannel(nullptr) , m_webChannelWorld(0) @@ -408,8 +408,8 @@ void WebContentsAdapter::setClient(WebContentsAdapterClient *adapterClient) { Q_ASSERT(!isInitialized()); m_adapterClient = adapterClient; - m_browserContextAdapter = adapterClient->browserContextAdapter(); - Q_ASSERT(m_browserContextAdapter); + m_profileAdapter = adapterClient->profileAdapter(); + Q_ASSERT(m_profileAdapter); // This might replace any adapter that has been initialized with this WebEngineSettings. adapterClient->webEngineSettings()->setWebContentsAdapter(this); @@ -427,7 +427,7 @@ void WebContentsAdapter::initialize(content::SiteInstance *site) // Create our own if a WebContents wasn't provided at construction. if (!m_webContents) { - content::WebContents::CreateParams create_params(m_browserContextAdapter->profile(), site); + content::WebContents::CreateParams create_params(m_profileAdapter->profile(), site); create_params.initial_size = gfx::Size(kTestWindowWidth, kTestWindowHeight); create_params.context = reinterpret_cast<gfx::NativeView>(m_adapterClient); m_webContents.reset(content::WebContents::Create(create_params)); @@ -438,8 +438,8 @@ void WebContentsAdapter::initialize(content::SiteInstance *site) // Qt returns a flash time (the whole cycle) in ms, chromium expects just the interval in seconds const int qtCursorFlashTime = QGuiApplication::styleHints()->cursorFlashTime(); rendererPrefs->caret_blink_interval = base::TimeDelta::FromMillisecondsD(0.5 * static_cast<double>(qtCursorFlashTime)); - rendererPrefs->user_agent_override = m_browserContextAdapter->httpUserAgent().toStdString(); - rendererPrefs->accept_languages = m_browserContextAdapter->httpAcceptLanguageWithoutQualities().toStdString(); + rendererPrefs->user_agent_override = m_profileAdapter->httpUserAgent().toStdString(); + rendererPrefs->accept_languages = m_profileAdapter->httpAcceptLanguageWithoutQualities().toStdString(); #if QT_CONFIG(webengine_webrtc) base::CommandLine* commandLine = base::CommandLine::ForCurrentProcess(); if (commandLine->HasSwitch(switches::kForceWebRtcIPHandlingPolicy)) @@ -479,7 +479,7 @@ void WebContentsAdapter::initialize(content::SiteInstance *site) // content::NOTIFICATION_RENDERER_PROCESS_CREATED event. This event will // force to initialize visited links in VisitedLinkSlave. // It must be done before creating a RenderView. - m_browserContextAdapter->visitedLinksManager(); + m_profileAdapter->visitedLinksManager(); // Create a RenderView with the initial empty document content::RenderViewHost *rvh = m_webContents->GetRenderViewHost(); @@ -555,7 +555,7 @@ void WebContentsAdapter::load(const QWebEngineHttpRequest &request) GURL gurl = toGurl(request.url()); if (!isInitialized()) { scoped_refptr<content::SiteInstance> site = - content::SiteInstance::CreateForURL(m_browserContextAdapter->profile(), gurl); + content::SiteInstance::CreateForURL(m_profileAdapter->profile(), gurl); initialize(site.get()); } @@ -887,14 +887,14 @@ qreal WebContentsAdapter::currentZoomFactor() const ProfileQt* WebContentsAdapter::profile() { - return m_browserContextAdapter ? m_browserContextAdapter->profile() : m_webContents ? + return m_profileAdapter ? m_profileAdapter->profile() : m_webContents ? static_cast<ProfileQt*>(m_webContents->GetBrowserContext()) : nullptr; } -BrowserContextAdapter* WebContentsAdapter::browserContextAdapter() +ProfileAdapter* WebContentsAdapter::profileAdapter() { - return m_browserContextAdapter ? m_browserContextAdapter : m_webContents ? - static_cast<ProfileQt*>(m_webContents->GetBrowserContext())->adapter() : nullptr; + return m_profileAdapter ? m_profileAdapter : m_webContents ? + static_cast<ProfileQt*>(m_webContents->GetBrowserContext())->profileAdapter() : nullptr; } #ifndef QT_NO_ACCESSIBILITY @@ -1008,7 +1008,7 @@ void WebContentsAdapter::download(const QUrl &url, const QString &suggestedFileN CHECK_INITIALIZED(); content::BrowserContext *bctx = m_webContents->GetBrowserContext(); content::DownloadManager *dlm = content::BrowserContext::GetDownloadManager(bctx); - DownloadManagerDelegateQt *dlmd = m_browserContextAdapter->downloadManagerDelegate(); + DownloadManagerDelegateQt *dlmd = m_profileAdapter->downloadManagerDelegate(); if (!dlm) return; @@ -1220,16 +1220,16 @@ void WebContentsAdapter::grantMediaAccessPermission(const QUrl &securityOrigin, CHECK_INITIALIZED(); // Let the permission manager remember the reply. if (flags & WebContentsAdapterClient::MediaAudioCapture) - m_browserContextAdapter->permissionRequestReply(securityOrigin, BrowserContextAdapter::AudioCapturePermission, true); + m_profileAdapter->permissionRequestReply(securityOrigin, ProfileAdapter::AudioCapturePermission, true); if (flags & WebContentsAdapterClient::MediaVideoCapture) - m_browserContextAdapter->permissionRequestReply(securityOrigin, BrowserContextAdapter::VideoCapturePermission, true); + m_profileAdapter->permissionRequestReply(securityOrigin, ProfileAdapter::VideoCapturePermission, true); MediaCaptureDevicesDispatcher::GetInstance()->handleMediaAccessPermissionResponse(m_webContents.get(), securityOrigin, flags); } void WebContentsAdapter::runGeolocationRequestCallback(const QUrl &securityOrigin, bool allowed) { CHECK_INITIALIZED(); - m_browserContextAdapter->permissionRequestReply(securityOrigin, BrowserContextAdapter::GeolocationPermission, allowed); + m_profileAdapter->permissionRequestReply(securityOrigin, ProfileAdapter::GeolocationPermission, allowed); } void WebContentsAdapter::grantMouseLockPermission(bool granted) diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h index a5ed1f471..b367c9fcb 100644 --- a/src/core/web_contents_adapter.h +++ b/src/core/web_contents_adapter.h @@ -189,7 +189,7 @@ public: void backgroundColorChanged(); QAccessibleInterface *browserAccessible(); ProfileQt* profile(); - BrowserContextAdapter* browserContextAdapter(); + ProfileAdapter* profileAdapter(); QWebChannel *webChannel() const; void setWebChannel(QWebChannel *, uint worldId); FaviconManager *faviconManager(); @@ -226,7 +226,7 @@ private: void waitForUpdateDragActionCalled(); bool handleDropDataFileContents(const content::DropData &dropData, QMimeData *mimeData); - BrowserContextAdapter *m_browserContextAdapter; + ProfileAdapter *m_profileAdapter; std::unique_ptr<content::WebContents> m_webContents; std::unique_ptr<WebContentsDelegateQt> m_webContentsDelegate; std::unique_ptr<RenderViewObserverHostQt> m_renderViewObserverHost; diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h index c539bfa66..2419a1259 100644 --- a/src/core/web_contents_adapter_client.h +++ b/src/core/web_contents_adapter_client.h @@ -74,7 +74,7 @@ struct DropData; namespace QtWebEngineCore { class AuthenticationDialogController; -class BrowserContextAdapter; +class ProfileAdapter; class ColorChooserController; class FilePickerController; class JavaScriptDialogController; @@ -467,7 +467,7 @@ public: virtual const QObject *holdingQObject() const = 0; virtual void setToolTip(const QString& toolTipText) = 0; - virtual BrowserContextAdapter *browserContextAdapter() = 0; + virtual ProfileAdapter *profileAdapter() = 0; virtual WebContentsAdapter* webContentsAdapter() = 0; }; diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 8abe2263d..7f1604162 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -43,7 +43,7 @@ #include "web_contents_delegate_qt.h" -#include "browser_context_adapter.h" +#include "profile_adapter.h" #include "color_chooser_controller.h" #include "color_chooser_qt.h" #include "favicon_manager.h" @@ -295,11 +295,11 @@ void WebContentsDelegateQt::DidFinishNavigation(content::NavigationHandle *navig return; if (navigation_handle->HasCommitted() && !navigation_handle->IsErrorPage()) { - BrowserContextAdapter *browserContextAdapter = m_viewClient->browserContextAdapter(); + ProfileAdapter *profileAdapter = m_viewClient->profileAdapter(); // VisistedLinksMaster asserts !IsOffTheRecord(). - if (navigation_handle->ShouldUpdateHistory() && browserContextAdapter->trackVisitedLinks()) { + if (navigation_handle->ShouldUpdateHistory() && profileAdapter->trackVisitedLinks()) { for (const GURL &url : navigation_handle->GetRedirectChain()) - browserContextAdapter->visitedLinksManager()->addUrl(url); + profileAdapter->visitedLinksManager()->addUrl(url); } // Make sure that we don't set the findNext WebFindOptions on a new frame. @@ -628,9 +628,9 @@ bool WebContentsDelegateQt::CheckMediaAccessPermission(content::RenderFrameHost { switch (type) { case content::MEDIA_DEVICE_AUDIO_CAPTURE: - return m_viewClient->browserContextAdapter()->checkPermission(toQt(security_origin), BrowserContextAdapter::AudioCapturePermission); + return m_viewClient->profileAdapter()->checkPermission(toQt(security_origin), ProfileAdapter::AudioCapturePermission); case content::MEDIA_DEVICE_VIDEO_CAPTURE: - return m_viewClient->browserContextAdapter()->checkPermission(toQt(security_origin), BrowserContextAdapter::VideoCapturePermission); + return m_viewClient->profileAdapter()->checkPermission(toQt(security_origin), ProfileAdapter::VideoCapturePermission); default: LOG(INFO) << "WebContentsDelegateQt::CheckMediaAccessPermission: " << "Unsupported media stream type checked" << type; diff --git a/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp index a60454fa8..c71dde724 100644 --- a/src/core/web_contents_view_qt.cpp +++ b/src/core/web_contents_view_qt.cpp @@ -39,7 +39,7 @@ #include "web_contents_view_qt.h" -#include "browser_context_adapter.h" +#include "profile_adapter.h" #include "content_browser_client_qt.h" #include "render_widget_host_view_qt_delegate.h" #include "type_conversion.h" @@ -205,7 +205,7 @@ void WebContentsViewQt::ShowContextMenu(content::RenderFrameHost *, const conten // must be initialized to true due to the way how the initialization sequence // in SpellCheck works ie. typing the first word triggers the creation // of the SpellcheckService. Use user preference store instead. - contextMenuData.setIsSpellCheckerEnabled(m_client->browserContextAdapter()->isSpellCheckEnabled()); + contextMenuData.setIsSpellCheckerEnabled(m_client->profileAdapter()->isSpellCheckEnabled()); #endif m_client->contextMenuRequested(contextMenuData); } diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index fce5e9859..4eb689d93 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -83,7 +83,7 @@ #include "content/public/app/sandbox_helper_win.h" #endif // OS_WIN -#include "browser_context_adapter.h" +#include "profile_adapter.h" #include "content_browser_client_qt.h" #include "content_client_qt.h" #include "content_main_delegate_qt.h" @@ -185,29 +185,29 @@ bool WebEngineContext::m_destroyed = false; void WebEngineContext::destroyBrowserContext() { - if (m_defaultBrowserContext) + if (m_defaultProfileAdapter) qWarning("PostMainMessageLoopRun is done, but global profile still exists !"); } -void WebEngineContext::addBrowserContext(BrowserContextAdapter *contextAdapter) +void WebEngineContext::addBrowserContext(ProfileAdapter *profileAdapter) { - Q_ASSERT(!m_browserContextAdapters.contains(contextAdapter)); - const QString path = contextAdapter->dataPath(); + Q_ASSERT(!m_profileAdapters.contains(profileAdapter)); + const QString path = profileAdapter->dataPath(); if (!path.isEmpty()) { - for (auto browserContextAdapter : m_browserContextAdapters) { - if (browserContextAdapter->dataPath() == path) { + for (auto profileAdapter : m_profileAdapters) { + if (profileAdapter->dataPath() == path) { // QTBUG-66068 qWarning("Using the same data path for profile, may corrupt the data."); break; } } } - m_browserContextAdapters.append(contextAdapter); + m_profileAdapters.append(profileAdapter); } -void WebEngineContext::removeBrowserContext(BrowserContextAdapter *contextAdapter) +void WebEngineContext::removeBrowserContext(ProfileAdapter *profileAdapter) { - m_browserContextAdapters.removeAll(contextAdapter); + m_profileAdapters.removeAll(profileAdapter); } void WebEngineContext::destroy() @@ -220,10 +220,10 @@ void WebEngineContext::destroy() while (delegate->DoWork()) { } // Delete the global object and thus custom profiles - m_defaultBrowserContext.reset(); + m_defaultProfileAdapter.reset(); m_globalQObject.reset(); - while (m_browserContextAdapters.count()) - delete m_browserContextAdapters.first(); + while (m_profileAdapters.count()) + delete m_profileAdapters.first(); // Handle any events posted by browser-context shutdown. while (delegate->DoWork()) { } @@ -247,7 +247,7 @@ WebEngineContext::~WebEngineContext() Q_ASSERT(!m_globalQObject); Q_ASSERT(!m_devtoolsServer); Q_ASSERT(!m_browserRunner); - Q_ASSERT(m_browserContextAdapters.isEmpty()); + Q_ASSERT(m_profileAdapters.isEmpty()); } WebEngineContext *WebEngineContext::current() @@ -264,12 +264,12 @@ WebEngineContext *WebEngineContext::current() return m_handle.get(); } -BrowserContextAdapter *WebEngineContext::defaultBrowserContext() +ProfileAdapter *WebEngineContext::defaultProfileAdapter() { Q_ASSERT(!m_destroyed); - if (!m_defaultBrowserContext) - m_defaultBrowserContext.reset(new BrowserContextAdapter(QStringLiteral("Default"))); - return m_defaultBrowserContext.get(); + if (!m_defaultProfileAdapter) + m_defaultProfileAdapter.reset(new ProfileAdapter(QStringLiteral("Default"))); + return m_defaultProfileAdapter.get(); } QObject *WebEngineContext::globalQObject() diff --git a/src/core/web_engine_context.h b/src/core/web_engine_context.h index 0729144a0..678ad713d 100644 --- a/src/core/web_engine_context.h +++ b/src/core/web_engine_context.h @@ -64,7 +64,7 @@ QT_FORWARD_DECLARE_CLASS(QObject) namespace QtWebEngineCore { -class BrowserContextAdapter; +class ProfileAdapter; class ContentMainDelegateQt; class DevToolsServerQt; class SurfaceFactoryQt; @@ -76,20 +76,20 @@ public: static WebEngineContext *current(); static void destroyContextPostRoutine(); - BrowserContextAdapter *defaultBrowserContext(); + ProfileAdapter *defaultProfileAdapter(); QObject *globalQObject(); #if QT_CONFIG(webengine_printing_and_pdf) printing::PrintJobManager* getPrintJobManager(); #endif void destroyBrowserContext(); - void addBrowserContext(BrowserContextAdapter*); - void removeBrowserContext(BrowserContextAdapter*); + void addBrowserContext(ProfileAdapter *profileAdapter); + void removeBrowserContext(ProfileAdapter *profileAdapter); void destroy(); private: friend class base::RefCounted<WebEngineContext>; - friend class BrowserContextAdapter; + friend class ProfileAdapter; WebEngineContext(); ~WebEngineContext(); @@ -98,9 +98,9 @@ private: std::unique_ptr<content::ContentMainRunner> m_contentRunner; std::unique_ptr<content::BrowserMainRunner> m_browserRunner; std::unique_ptr<QObject> m_globalQObject; - std::unique_ptr<BrowserContextAdapter> m_defaultBrowserContext; + std::unique_ptr<ProfileAdapter> m_defaultProfileAdapter; std::unique_ptr<DevToolsServerQt> m_devtoolsServer; - QVector<BrowserContextAdapter*> m_browserContextAdapters; + QVector<ProfileAdapter*> m_profileAdapters; #if QT_CONFIG(webengine_printing_and_pdf) std::unique_ptr<printing::PrintJobManager> m_printJobManager; |