diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-08-21 14:28:27 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-10-11 10:15:17 +0200 |
commit | 5f9e2f01e4eae22d9d40bb6b7767cde4cb94766e (patch) | |
tree | 58ade0563aef01b2fdba98c237d634559a1c1889 /src/core/profile_io_data_qt.cpp | |
parent | 687671d249613bb2b00570f93df35fcaa0eacdd3 (diff) |
Adaptations for Chromium 77
Fixes: QTBUG-77267
Change-Id: I181e24cf80ebee6991b95dde6c636f0d169b40a4
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'src/core/profile_io_data_qt.cpp')
-rw-r--r-- | src/core/profile_io_data_qt.cpp | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp index 90016c5a3..2e0e378ac 100644 --- a/src/core/profile_io_data_qt.cpp +++ b/src/core/profile_io_data_qt.cpp @@ -56,6 +56,7 @@ #include "net/cert/ct_policy_enforcer.h" #include "net/cert/multi_log_ct_verifier.h" #include "net/cert_net/cert_net_fetcher_impl.h" +#include "net/ftp/ftp_auth_cache.h" #include "net/dns/host_resolver_manager.h" #include "net/http/http_auth_handler_factory.h" #include "net/http/http_auth_scheme.h" @@ -78,6 +79,7 @@ #include "net/url_request/url_request_intercepting_job_factory.h" #include "services/file/user_id_map.h" #include "services/network/proxy_service_mojo.h" +#include "services/network/restricted_cookie_manager.h" #include "net/client_cert_override.h" #include "net/client_cert_store_data.h" @@ -85,6 +87,7 @@ #include "net/custom_protocol_handler.h" #include "net/network_delegate_qt.h" #include "net/proxy_config_service_qt.h" +#include "net/restricted_cookie_manager_qt.h" #include "net/url_request_context_getter_qt.h" #include "profile_qt.h" #include "resource_context_qt.h" @@ -189,8 +192,12 @@ ProfileIODataQt::~ProfileIODataQt() } } - if (m_urlRequestContext && m_urlRequestContext->proxy_resolution_service()) - m_urlRequestContext->proxy_resolution_service()->OnShutdown(); + if (m_urlRequestContext) { + if (m_urlRequestContext->proxy_resolution_service()) + m_urlRequestContext->proxy_resolution_service()->OnShutdown(); + m_restrictedCookieManagerBindings.CloseAllBindings(); + cancelAllUrlRequests(); + } m_resourceContext.reset(); if (m_cookieDelegate) @@ -238,6 +245,12 @@ extensions::ExtensionSystemQt* ProfileIODataQt::GetExtensionSystem() } #endif // BUILDFLAG(ENABLE_EXTENSIONS) +base::WeakPtr<ProfileIODataQt> ProfileIODataQt::getWeakPtrOnUIThread() +{ + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + return m_weakPtr; +} + void ProfileIODataQt::initializeOnIOThread() { m_networkDelegate.reset(new NetworkDelegateQt(this)); @@ -304,6 +317,7 @@ void ProfileIODataQt::generateStorage() // We must stop all requests before deleting their backends. if (m_storage) { m_urlRequestContext->proxy_resolution_service()->OnShutdown(); + m_restrictedCookieManagerBindings.CloseAllBindings(); m_cookieDelegate->setCookieMonster(nullptr); m_storage->set_cookie_store(nullptr); cancelAllUrlRequests(); @@ -380,6 +394,8 @@ void ProfileIODataQt::generateStorage() m_urlRequestContext->host_resolver(), nullptr /* NetLog */, m_urlRequestContext->network_delegate())); + + m_storage->set_ftp_auth_cache(std::make_unique<net::FtpAuthCache>()); } @@ -390,7 +406,7 @@ void ProfileIODataQt::generateCookieStore() const std::lock_guard<QRecursiveMutex> lock(m_mutex); -// // FIXME: Add code to remove the old channel-id database. + // FIXME: Add code to remove the old channel-id database. std::unique_ptr<net::CookieStore> cookieStore; switch (m_persistentCookiesPolicy) { @@ -486,7 +502,6 @@ void ProfileIODataQt::generateHttpCache() if (!m_httpNetworkSession || !doNetworkSessionParamsMatch(network_session_params, m_httpNetworkSession->params()) || !doNetworkSessionContextMatch(network_session_context, m_httpNetworkSession->context())) { - cancelAllUrlRequests(); m_httpNetworkSession.reset(new net::HttpNetworkSession(network_session_params, network_session_context)); } @@ -520,7 +535,7 @@ void ProfileIODataQt::generateJobFactory() jobFactory->SetProtocolHandler(url::kFileScheme, std::make_unique<net::FileProtocolHandler>(taskRunner)); jobFactory->SetProtocolHandler(url::kFtpScheme, - net::FtpProtocolHandler::Create(m_urlRequestContext->host_resolver())); + net::FtpProtocolHandler::Create(m_urlRequestContext->host_resolver(), m_urlRequestContext->ftp_auth_cache())); m_installedCustomSchemes = m_customUrlSchemes; for (const QByteArray &scheme : qAsConst(m_installedCustomSchemes)) { @@ -640,7 +655,7 @@ void ProfileIODataQt::createProxyConfig() base::CreateSingleThreadTaskRunnerWithTraits({content::BrowserThread::IO})), initialConfig, initialConfigState); //pass interface to io thread - m_proxyResolverFactoryInterface = ChromeMojoProxyResolverFactory::CreateWithStrongBinding().PassInterface(); + m_proxyResolverFactoryInterface = ChromeMojoProxyResolverFactory::CreateWithSelfOwnedReceiver(); } void ProfileIODataQt::updateStorageSettings() @@ -788,9 +803,34 @@ std::unique_ptr<net::ClientCertStore> ProfileIODataQt::CreateClientCertStore() #endif } +void ProfileIODataQt::CreateRestrictedCookieManager(network::mojom::RestrictedCookieManagerRequest request, + network::mojom::RestrictedCookieManagerRole role, + const url::Origin &origin, + bool is_service_worker, + int32_t process_id, + int32_t routing_id) +{ + Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); + m_restrictedCookieManagerBindings.AddBinding( + std::make_unique<RestrictedCookieManagerQt>( + m_weakPtr, + role, urlRequestContext()->cookie_store(), + &m_cookieSettings, origin, + is_service_worker, process_id, routing_id), + std::move(request)); +} + +// static +ProfileIODataQt *ProfileIODataQt::FromBrowserContext(content::BrowserContext *browser_context) +{ + Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + return static_cast<ProfileQt *>(browser_context)->m_profileIOData.get(); +} + // static ProfileIODataQt *ProfileIODataQt::FromResourceContext(content::ResourceContext *resource_context) { + Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); return static_cast<ResourceContextQt *>(resource_context)->m_io_data; } |