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

Unified Diff: chrome/browser/profiles/profile_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_io_data.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_io_data.cc
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index a47242db697abe6b8cba0328ca32e3683c6fce56..d5f5ba6261ab6774dc73c26d03a245a7e0dbf5f1 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -76,6 +76,7 @@
#include "components/signin/core/common/signin_pref_names.h"
#include "components/url_formatter/url_fixer.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/cookie_store_factory.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/resource_context.h"
#include "content/public/common/content_switches.h"
@@ -85,6 +86,7 @@
#include "net/cert/multi_log_ct_verifier.h"
#include "net/cookies/canonical_cookie.h"
#include "net/http/http_network_session.h"
+#include "net/http/http_server_properties_impl.h"
#include "net/http/http_transaction_factory.h"
#include "net/http/http_util.h"
#include "net/http/transport_security_persister.h"
@@ -96,6 +98,7 @@
#include "net/reporting/reporting_service.h"
#include "net/ssl/channel_id_service.h"
#include "net/ssl/client_cert_store.h"
+#include "net/ssl/default_channel_id_store.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/url_request/data_protocol_handler.h"
#include "net/url_request/file_protocol_handler.h"
@@ -1044,6 +1047,18 @@ void ProfileIOData::Init(
main_request_context_->set_http_auth_handler_factory(
io_thread_globals->system_request_context->http_auth_handler_factory());
+ main_request_context_storage_->set_http_server_properties(
+ GetHttpServerProperties());
+
+ std::unique_ptr<net::CookieStore> cookie_store;
+ std::unique_ptr<net::ChannelIDService> channel_id_service;
+ GetCookieAndChannelIDStores(&cookie_store, &channel_id_service);
+ cookie_store->SetChannelIDServiceID(channel_id_service->GetUniqueID());
+
+ main_request_context_storage_->set_cookie_store(std::move(cookie_store));
+ main_request_context_storage_->set_channel_id_service(
+ std::move(channel_id_service));
+
main_request_context_storage_->set_proxy_service(
ProxyServiceFactory::CreateProxyService(
io_thread->net_log(), main_request_context_.get(),
@@ -1179,6 +1194,21 @@ void ProfileIOData::Init(
main_request_context_->set_ct_policy_enforcer(
io_thread_globals->system_request_context->ct_policy_enforcer());
+ if (UseNetworkQualityEstimator()) {
+ main_request_context_->set_network_quality_estimator(
+ io_thread_globals->network_quality_estimator.get());
+ }
+
+ main_request_context_storage_->set_http_network_session(
+ CreateHttpNetworkSession(*profile_params_));
+
+ main_request_context_storage_->set_http_transaction_factory(CreateMainHttpFactory(
+ main_request_context_storage_->http_network_session(), GetCacheBackendFactory()));
+
+ std::unique_ptr<net::URLRequestJobFactoryImpl> main_job_factory(
+ new net::URLRequestJobFactoryImpl());
+ InstallProtocolHandlers(main_job_factory.get(), protocol_handlers);
+
InitializeInternal(profile_params_.get(), protocol_handlers,
std::move(request_interceptors));
@@ -1358,6 +1388,31 @@ std::unique_ptr<net::NetworkDelegate> ProfileIOData::ConfigureNetworkDelegate(
chrome_network_delegate.release());
}
+std::unique_ptr<net::HttpServerProperties>
+ProfileIOData::GetHttpServerProperties() const {
+ return base::MakeUnique<net::HttpServerPropertiesImpl>();
+}
+
+void ProfileIOData::GetCookieAndChannelIDStores(
+ std::unique_ptr<net::CookieStore>* cookie_store,
+ std::unique_ptr<net::ChannelIDService>* channel_id_service) const {
+ *channel_id_service = base::MakeUnique<net::ChannelIDService>(
+ new net::DefaultChannelIDStore(nullptr));
+
+ using content::CookieStoreConfig;
+ *cookie_store = CreateCookieStore(CookieStoreConfig(
+ base::FilePath(), CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, nullptr,
+ profile_params_->cookie_monster_delegate.get()));
+}
+
+bool ProfileIOData::UseNetworkQualityEstimator() const {
+ return false;
+}
+
+std::unique_ptr<net::HttpCache::BackendFactory> ProfileIOData::GetCacheBackendFactory() const {
+ return net::HttpCache::DefaultBackend::InMemory(0);
+}
+
void ProfileIOData::SetCookieSettingsForTesting(
content_settings::CookieSettings* cookie_settings) {
DCHECK(!cookie_settings_.get());
« no previous file with comments | « chrome/browser/profiles/profile_io_data.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698