diff options
Diffstat (limited to 'src/core/profile_adapter.cpp')
-rw-r--r-- | src/core/profile_adapter.cpp | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp index bccdf1ada..85577ef52 100644 --- a/src/core/profile_adapter.cpp +++ b/src/core/profile_adapter.cpp @@ -47,9 +47,9 @@ #include "api/qwebengineurlscheme.h" #include "content_browser_client_qt.h" #include "download_manager_delegate_qt.h" -#include "net/url_request_context_getter_qt.h" #include "permission_manager_qt.h" #include "profile_adapter_client.h" +#include "profile_io_data_qt.h" #include "profile_qt.h" #include "renderer_host/user_resource_controller_host.h" #include "type_conversion.h" @@ -129,8 +129,7 @@ void ProfileAdapter::setStorageName(const QString &storageName) m_name = storageName; if (!m_offTheRecord) { m_profile->setupPrefService(); - if (m_profile->m_urlRequestContextGetter.get()) - m_profile->m_profileIOData->updateStorageSettings(); + m_profile->m_profileIOData->resetNetworkContext(); if (m_visitedLinksManager) resetVisitedLinksManager(); } @@ -142,8 +141,7 @@ void ProfileAdapter::setOffTheRecord(bool offTheRecord) return; m_offTheRecord = offTheRecord; m_profile->setupPrefService(); - if (m_profile->m_urlRequestContextGetter.get()) - m_profile->m_profileIOData->updateStorageSettings(); + m_profile->m_profileIOData->resetNetworkContext(); if (m_visitedLinksManager) resetVisitedLinksManager(); } @@ -193,8 +191,7 @@ void ProfileAdapter::setRequestInterceptor(QWebEngineUrlRequestInterceptor *inte Q_ASSERT(!m_profile->m_profileIOData->requestInterceptor()); }); - if (m_profile->m_urlRequestContextGetter.get()) - m_profile->m_profileIOData->updateRequestInterceptor(); + m_profile->m_profileIOData->updateRequestInterceptor(); } void ProfileAdapter::addClient(ProfileAdapterClient *adapterClient) @@ -210,16 +207,14 @@ void ProfileAdapter::removeClient(ProfileAdapterClient *adapterClient) void ProfileAdapter::addPageRequestInterceptor() { ++m_pageRequestInterceptors; - if (m_profile->m_urlRequestContextGetter.get()) - m_profile->m_profileIOData->updateRequestInterceptor(); + m_profile->m_profileIOData->updateRequestInterceptor(); } void ProfileAdapter::removePageRequestInterceptor() { Q_ASSERT(m_pageRequestInterceptors > 0); --m_pageRequestInterceptors; - if (m_profile->m_urlRequestContextGetter.get()) - m_profile->m_profileIOData->updateRequestInterceptor(); + m_profile->m_profileIOData->updateRequestInterceptor(); } @@ -277,8 +272,7 @@ void ProfileAdapter::setDataPath(const QString &path) m_dataPath = path; if (!m_offTheRecord) { m_profile->setupPrefService(); - if (m_profile->m_urlRequestContextGetter.get()) - m_profile->m_profileIOData->updateStorageSettings(); + m_profile->m_profileIOData->resetNetworkContext(); if (m_visitedLinksManager) resetVisitedLinksManager(); } @@ -305,8 +299,8 @@ void ProfileAdapter::setCachePath(const QString &path) if (m_cachePath == path) return; m_cachePath = path; - if (!m_offTheRecord && m_profile->m_urlRequestContextGetter.get()) - m_profile->m_profileIOData->updateHttpCache(); + if (!m_offTheRecord) + m_profile->m_profileIOData->resetNetworkContext(); } QString ProfileAdapter::cookiesPath() const @@ -352,8 +346,7 @@ void ProfileAdapter::setHttpUserAgent(const QString &userAgent) if (web_contents->GetBrowserContext() == m_profile.data()) web_contents->SetUserAgentOverride(m_httpUserAgent.toStdString(), true); - if (m_profile->m_urlRequestContextGetter.get()) - m_profile->m_profileIOData->updateUserAgent(); + m_profile->m_profileIOData->resetNetworkContext(); } ProfileAdapter::HttpCacheType ProfileAdapter::httpCacheType() const @@ -371,8 +364,11 @@ void ProfileAdapter::setHttpCacheType(ProfileAdapter::HttpCacheType newhttpCache m_httpCacheType = newhttpCacheType; if (oldCacheType == httpCacheType()) return; - if (!m_offTheRecord && m_profile->m_urlRequestContextGetter.get()) - m_profile->m_profileIOData->updateHttpCache(); + if (!m_offTheRecord) { + m_profile->m_profileIOData->resetNetworkContext(); + if (m_httpCacheType == NoCache) + clearHttpCache(); + } } ProfileAdapter::PersistentCookiesPolicy ProfileAdapter::persistentCookiesPolicy() const @@ -388,8 +384,8 @@ void ProfileAdapter::setPersistentCookiesPolicy(ProfileAdapter::PersistentCookie m_persistentCookiesPolicy = newPersistentCookiesPolicy; if (oldPolicy == persistentCookiesPolicy()) return; - if (!m_offTheRecord && m_profile->m_urlRequestContextGetter.get()) - m_profile->m_profileIOData->updateCookieStore(); + if (!m_offTheRecord) + m_profile->m_profileIOData->resetNetworkContext(); } ProfileAdapter::VisitedLinksPolicy ProfileAdapter::visitedLinksPolicy() const @@ -443,8 +439,8 @@ void ProfileAdapter::setHttpCacheMaxSize(int maxSize) if (m_httpCacheMaxSize == maxSize) return; m_httpCacheMaxSize = maxSize; - if (!m_offTheRecord && m_profile->m_urlRequestContextGetter.get()) - m_profile->m_profileIOData->updateHttpCache(); + if (!m_offTheRecord) + m_profile->m_profileIOData->resetNetworkContext(); } enum class SchemeType { Protected, Overridable, Custom, Unknown }; @@ -605,8 +601,7 @@ void ProfileAdapter::setHttpAcceptLanguage(const QString &httpAcceptLanguage) } } - if (m_profile->m_urlRequestContextGetter.get()) - m_profile->m_profileIOData->updateUserAgent(); + m_profile->m_profileIOData->resetNetworkContext(); } void ProfileAdapter::clearHttpCache() @@ -675,6 +670,7 @@ void ProfileAdapter::setUseForGlobalCertificateVerification(bool enable) if (enable) { if (profileForglobalCertificateVerification) { profileForglobalCertificateVerification->m_usedForGlobalCertificateVerification = false; + profileForglobalCertificateVerification->m_profile->m_profileIOData->resetNetworkContext(); for (auto *client : qAsConst(profileForglobalCertificateVerification->m_clients)) client->useForGlobalCertificateVerificationChanged(); } @@ -685,8 +681,7 @@ void ProfileAdapter::setUseForGlobalCertificateVerification(bool enable) profileForglobalCertificateVerification = nullptr; } - if (m_profile->m_urlRequestContextGetter.get()) - m_profile->m_profileIOData->updateUsedForGlobalCertificateVerification(); + m_profile->m_profileIOData->resetNetworkContext(); } bool ProfileAdapter::isUsedForGlobalCertificateVerification() const |