Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 2934153002: Add virtual ProfileIOData methods related to URLRequestContext creation. (Closed)
Patch Set: . Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.h ('k') | chrome/browser/profiles/profile_io_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_impl_io_data.cc
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index 9abcebf426ac0efbf1312dc1c49c198a3edca1b8..428fb037a8c13084abfa8b316c25204db79c4787 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -469,61 +469,6 @@ void ProfileImplIOData::InitializeInternal(
IOThread* const io_thread = profile_params->io_thread;
IOThread::Globals* const io_thread_globals = io_thread->globals();
- if (lazy_params_->http_server_properties_manager) {
- lazy_params_->http_server_properties_manager->InitializeOnNetworkSequence();
- main_context_storage->set_http_server_properties(
- std::move(lazy_params_->http_server_properties_manager));
- }
-
- main_context->set_network_quality_estimator(
- io_thread_globals->network_quality_estimator.get());
-
- // Create a single task runner to use with the CookieStore and ChannelIDStore.
- scoped_refptr<base::SequencedTaskRunner> cookie_background_task_runner =
- base::CreateSequencedTaskRunnerWithTraits(
- {base::MayBlock(), base::TaskPriority::BACKGROUND,
- base::TaskShutdownBehavior::BLOCK_SHUTDOWN});
-
- // Set up server bound cert service.
- DCHECK(!lazy_params_->channel_id_path.empty());
- scoped_refptr<QuotaPolicyChannelIDStore> channel_id_db =
- new QuotaPolicyChannelIDStore(lazy_params_->channel_id_path,
- cookie_background_task_runner,
- lazy_params_->special_storage_policy.get());
- main_context_storage->set_channel_id_service(
- base::MakeUnique<net::ChannelIDService>(
- new net::DefaultChannelIDStore(channel_id_db.get())));
-
- // Set up cookie store.
- DCHECK(!lazy_params_->cookie_path.empty());
-
- content::CookieStoreConfig cookie_config(
- lazy_params_->cookie_path, lazy_params_->session_cookie_mode,
- lazy_params_->special_storage_policy.get(),
- profile_params->cookie_monster_delegate.get());
- cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate();
- cookie_config.channel_id_service = main_context->channel_id_service();
- cookie_config.background_task_runner = cookie_background_task_runner;
- main_context_storage->set_cookie_store(
- content::CreateCookieStore(cookie_config));
-
- main_context->cookie_store()->SetChannelIDServiceID(
- main_context->channel_id_service()->GetUniqueID());
-
- std::unique_ptr<net::HttpCache::BackendFactory> main_backend(
- new net::HttpCache::DefaultBackend(
- net::DISK_CACHE, ChooseCacheBackendType(), lazy_params_->cache_path,
- lazy_params_->cache_max_size,
- BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE)));
- main_context_storage->set_http_network_session(
- CreateHttpNetworkSession(*profile_params));
- main_context_storage->set_http_transaction_factory(CreateMainHttpFactory(
- main_context_storage->http_network_session(), std::move(main_backend)));
-
- std::unique_ptr<net::URLRequestJobFactoryImpl> main_job_factory(
- new net::URLRequestJobFactoryImpl());
- InstallProtocolHandlers(main_job_factory.get(), protocol_handlers);
-
// Install the Offline Page Interceptor.
#if defined(OS_ANDROID)
request_interceptors.push_back(
@@ -755,6 +700,56 @@ net::URLRequestContext* ProfileImplIOData::AcquireIsolatedAppRequestContext(
return app_request_context;
}
+std::unique_ptr<net::HttpServerProperties>
+ProfileImplIOData::GetHttpServerProperties() const {
+ if (!lazy_params_->http_server_properties_manager)
+ return base::MakeUnique<net::HttpServerPropertiesImpl>();
+ lazy_params_->http_server_properties_manager->InitializeOnNetworkSequence();
+ return std::move(lazy_params_->http_server_properties_manager);
+}
+
+void ProfileImplIOData::GetCookieAndChannelIDStores(
+ std::unique_ptr<net::CookieStore>* cookie_store,
+ std::unique_ptr<net::ChannelIDService>* channel_id_service) const {
+ // Create a single task runner to use with the CookieStore and ChannelIDStore.
+ scoped_refptr<base::SequencedTaskRunner> cookie_background_task_runner =
+ base::CreateSequencedTaskRunnerWithTraits(
+ {base::MayBlock(), base::TaskPriority::BACKGROUND,
+ base::TaskShutdownBehavior::BLOCK_SHUTDOWN});
+
+ // Set up server bound cert service.
+ DCHECK(!lazy_params_->channel_id_path.empty());
+ scoped_refptr<QuotaPolicyChannelIDStore> channel_id_db =
+ new QuotaPolicyChannelIDStore(lazy_params_->channel_id_path,
+ cookie_background_task_runner,
+ lazy_params_->special_storage_policy.get());
+ *channel_id_service = base::MakeUnique<net::ChannelIDService>(
+ new net::DefaultChannelIDStore(channel_id_db.get()));
+
+ // Set up cookie store.
+ DCHECK(!lazy_params_->cookie_path.empty());
+
+ content::CookieStoreConfig cookie_config(
+ lazy_params_->cookie_path, lazy_params_->session_cookie_mode,
+ lazy_params_->special_storage_policy.get(),
+ profile_params()->cookie_monster_delegate.get());
+ cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate();
+ cookie_config.channel_id_service = channel_id_service->get();
+ cookie_config.background_task_runner = cookie_background_task_runner;
+ *cookie_store = content::CreateCookieStore(cookie_config);
+}
+
+bool ProfileImplIOData::UseNetworkQualityEstimator() const {
+ return true;
+}
+
+std::unique_ptr<net::HttpCache::BackendFactory> ProfileImplIOData::GetCacheBackendFactory() const {
+ return base::MakeUnique<net::HttpCache::DefaultBackend>(
+ net::DISK_CACHE, ChooseCacheBackendType(), lazy_params_->cache_path,
+ lazy_params_->cache_max_size,
+ BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE));
+}
+
net::URLRequestContext*
ProfileImplIOData::AcquireIsolatedMediaRequestContext(
net::URLRequestContext* app_context,
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.h ('k') | chrome/browser/profiles/profile_io_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698