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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/profiles/profile_io_data.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/profiles/profile_io_data.h" 5 #include "chrome/browser/profiles/profile_io_data.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 #include "components/net_log/chrome_net_log.h" 69 #include "components/net_log/chrome_net_log.h"
70 #include "components/policy/core/browser/url_blacklist_manager.h" 70 #include "components/policy/core/browser/url_blacklist_manager.h"
71 #include "components/policy/core/common/cloud/policy_header_io_helper.h" 71 #include "components/policy/core/common/cloud/policy_header_io_helper.h"
72 #include "components/policy/core/common/cloud/policy_header_service.h" 72 #include "components/policy/core/common/cloud/policy_header_service.h"
73 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" 73 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
74 #include "components/prefs/pref_service.h" 74 #include "components/prefs/pref_service.h"
75 #include "components/previews/core/previews_io_data.h" 75 #include "components/previews/core/previews_io_data.h"
76 #include "components/signin/core/common/signin_pref_names.h" 76 #include "components/signin/core/common/signin_pref_names.h"
77 #include "components/url_formatter/url_fixer.h" 77 #include "components/url_formatter/url_fixer.h"
78 #include "content/public/browser/browser_thread.h" 78 #include "content/public/browser/browser_thread.h"
79 #include "content/public/browser/cookie_store_factory.h"
79 #include "content/public/browser/notification_service.h" 80 #include "content/public/browser/notification_service.h"
80 #include "content/public/browser/resource_context.h" 81 #include "content/public/browser/resource_context.h"
81 #include "content/public/common/content_switches.h" 82 #include "content/public/common/content_switches.h"
82 #include "extensions/features/features.h" 83 #include "extensions/features/features.h"
83 #include "net/cert/cert_verifier.h" 84 #include "net/cert/cert_verifier.h"
84 #include "net/cert/ct_log_verifier.h" 85 #include "net/cert/ct_log_verifier.h"
85 #include "net/cert/multi_log_ct_verifier.h" 86 #include "net/cert/multi_log_ct_verifier.h"
86 #include "net/cookies/canonical_cookie.h" 87 #include "net/cookies/canonical_cookie.h"
87 #include "net/http/http_network_session.h" 88 #include "net/http/http_network_session.h"
89 #include "net/http/http_server_properties_impl.h"
88 #include "net/http/http_transaction_factory.h" 90 #include "net/http/http_transaction_factory.h"
89 #include "net/http/http_util.h" 91 #include "net/http/http_util.h"
90 #include "net/http/transport_security_persister.h" 92 #include "net/http/transport_security_persister.h"
91 #include "net/net_features.h" 93 #include "net/net_features.h"
92 #include "net/nqe/network_quality_estimator.h" 94 #include "net/nqe/network_quality_estimator.h"
93 #include "net/proxy/proxy_config_service_fixed.h" 95 #include "net/proxy/proxy_config_service_fixed.h"
94 #include "net/proxy/proxy_script_fetcher_impl.h" 96 #include "net/proxy/proxy_script_fetcher_impl.h"
95 #include "net/proxy/proxy_service.h" 97 #include "net/proxy/proxy_service.h"
96 #include "net/reporting/reporting_service.h" 98 #include "net/reporting/reporting_service.h"
97 #include "net/ssl/channel_id_service.h" 99 #include "net/ssl/channel_id_service.h"
98 #include "net/ssl/client_cert_store.h" 100 #include "net/ssl/client_cert_store.h"
101 #include "net/ssl/default_channel_id_store.h"
99 #include "net/traffic_annotation/network_traffic_annotation.h" 102 #include "net/traffic_annotation/network_traffic_annotation.h"
100 #include "net/url_request/data_protocol_handler.h" 103 #include "net/url_request/data_protocol_handler.h"
101 #include "net/url_request/file_protocol_handler.h" 104 #include "net/url_request/file_protocol_handler.h"
102 #include "net/url_request/ftp_protocol_handler.h" 105 #include "net/url_request/ftp_protocol_handler.h"
103 #include "net/url_request/report_sender.h" 106 #include "net/url_request/report_sender.h"
104 #include "net/url_request/url_request.h" 107 #include "net/url_request/url_request.h"
105 #include "net/url_request/url_request_context.h" 108 #include "net/url_request/url_request_context.h"
106 #include "net/url_request/url_request_context_builder.h" 109 #include "net/url_request/url_request_context_builder.h"
107 #include "net/url_request/url_request_context_storage.h" 110 #include "net/url_request/url_request_context_storage.h"
108 #include "net/url_request/url_request_file_job.h" 111 #include "net/url_request/url_request_file_job.h"
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 std::unique_ptr<net::NetworkDelegate> network_delegate = 1040 std::unique_ptr<net::NetworkDelegate> network_delegate =
1038 ConfigureNetworkDelegate(profile_params_->io_thread, 1041 ConfigureNetworkDelegate(profile_params_->io_thread,
1039 std::move(chrome_network_delegate)); 1042 std::move(chrome_network_delegate));
1040 1043
1041 main_request_context_->set_host_resolver( 1044 main_request_context_->set_host_resolver(
1042 io_thread_globals->system_request_context->host_resolver()); 1045 io_thread_globals->system_request_context->host_resolver());
1043 1046
1044 main_request_context_->set_http_auth_handler_factory( 1047 main_request_context_->set_http_auth_handler_factory(
1045 io_thread_globals->system_request_context->http_auth_handler_factory()); 1048 io_thread_globals->system_request_context->http_auth_handler_factory());
1046 1049
1050 main_request_context_storage_->set_http_server_properties(
1051 GetHttpServerProperties());
1052
1053 std::unique_ptr<net::CookieStore> cookie_store;
1054 std::unique_ptr<net::ChannelIDService> channel_id_service;
1055 GetCookieAndChannelIDStores(&cookie_store, &channel_id_service);
1056 cookie_store->SetChannelIDServiceID(channel_id_service->GetUniqueID());
1057
1058 main_request_context_storage_->set_cookie_store(std::move(cookie_store));
1059 main_request_context_storage_->set_channel_id_service(
1060 std::move(channel_id_service));
1061
1047 main_request_context_storage_->set_proxy_service( 1062 main_request_context_storage_->set_proxy_service(
1048 ProxyServiceFactory::CreateProxyService( 1063 ProxyServiceFactory::CreateProxyService(
1049 io_thread->net_log(), main_request_context_.get(), 1064 io_thread->net_log(), main_request_context_.get(),
1050 network_delegate.get(), 1065 network_delegate.get(),
1051 std::move(profile_params_->proxy_config_service), command_line, 1066 std::move(profile_params_->proxy_config_service), command_line,
1052 io_thread->WpadQuickCheckEnabled(), 1067 io_thread->WpadQuickCheckEnabled(),
1053 io_thread->PacHttpsUrlStrippingEnabled())); 1068 io_thread->PacHttpsUrlStrippingEnabled()));
1054 1069
1055 main_request_context_storage_->set_network_delegate( 1070 main_request_context_storage_->set_network_delegate(
1056 std::move(network_delegate)); 1071 std::move(network_delegate));
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 std::move(ct_verifier)); 1187 std::move(ct_verifier));
1173 1188
1174 io_thread->RegisterSTHObserver(ct_tree_tracker_.get()); 1189 io_thread->RegisterSTHObserver(ct_tree_tracker_.get());
1175 ct_tree_tracker_unregistration_ = 1190 ct_tree_tracker_unregistration_ =
1176 base::Bind(&IOThread::UnregisterSTHObserver, base::Unretained(io_thread), 1191 base::Bind(&IOThread::UnregisterSTHObserver, base::Unretained(io_thread),
1177 ct_tree_tracker_.get()); 1192 ct_tree_tracker_.get());
1178 1193
1179 main_request_context_->set_ct_policy_enforcer( 1194 main_request_context_->set_ct_policy_enforcer(
1180 io_thread_globals->system_request_context->ct_policy_enforcer()); 1195 io_thread_globals->system_request_context->ct_policy_enforcer());
1181 1196
1197 if (UseNetworkQualityEstimator()) {
1198 main_request_context_->set_network_quality_estimator(
1199 io_thread_globals->network_quality_estimator.get());
1200 }
1201
1202 main_request_context_storage_->set_http_network_session(
1203 CreateHttpNetworkSession(*profile_params_));
1204
1205 main_request_context_storage_->set_http_transaction_factory(CreateMainHttpFact ory(
1206 main_request_context_storage_->http_network_session(), GetCacheBackendFact ory()));
1207
1208 std::unique_ptr<net::URLRequestJobFactoryImpl> main_job_factory(
1209 new net::URLRequestJobFactoryImpl());
1210 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers);
1211
1182 InitializeInternal(profile_params_.get(), protocol_handlers, 1212 InitializeInternal(profile_params_.get(), protocol_handlers,
1183 std::move(request_interceptors)); 1213 std::move(request_interceptors));
1184 1214
1185 profile_params_.reset(); 1215 profile_params_.reset();
1186 initialized_ = true; 1216 initialized_ = true;
1187 } 1217 }
1188 1218
1189 void ProfileIOData::ApplyProfileParamsToContext( 1219 void ProfileIOData::ApplyProfileParamsToContext(
1190 net::URLRequestContext* context) const { 1220 net::URLRequestContext* context) const {
1191 context->set_http_user_agent_settings( 1221 context->set_http_user_agent_settings(
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 std::move(backend), false /* is_main_cache */); 1381 std::move(backend), false /* is_main_cache */);
1352 } 1382 }
1353 1383
1354 std::unique_ptr<net::NetworkDelegate> ProfileIOData::ConfigureNetworkDelegate( 1384 std::unique_ptr<net::NetworkDelegate> ProfileIOData::ConfigureNetworkDelegate(
1355 IOThread* io_thread, 1385 IOThread* io_thread,
1356 std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate) const { 1386 std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate) const {
1357 return base::WrapUnique<net::NetworkDelegate>( 1387 return base::WrapUnique<net::NetworkDelegate>(
1358 chrome_network_delegate.release()); 1388 chrome_network_delegate.release());
1359 } 1389 }
1360 1390
1391 std::unique_ptr<net::HttpServerProperties>
1392 ProfileIOData::GetHttpServerProperties() const {
1393 return base::MakeUnique<net::HttpServerPropertiesImpl>();
1394 }
1395
1396 void ProfileIOData::GetCookieAndChannelIDStores(
1397 std::unique_ptr<net::CookieStore>* cookie_store,
1398 std::unique_ptr<net::ChannelIDService>* channel_id_service) const {
1399 *channel_id_service = base::MakeUnique<net::ChannelIDService>(
1400 new net::DefaultChannelIDStore(nullptr));
1401
1402 using content::CookieStoreConfig;
1403 *cookie_store = CreateCookieStore(CookieStoreConfig(
1404 base::FilePath(), CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, nullptr,
1405 profile_params_->cookie_monster_delegate.get()));
1406 }
1407
1408 bool ProfileIOData::UseNetworkQualityEstimator() const {
1409 return false;
1410 }
1411
1412 std::unique_ptr<net::HttpCache::BackendFactory> ProfileIOData::GetCacheBackendFa ctory() const {
1413 return net::HttpCache::DefaultBackend::InMemory(0);
1414 }
1415
1361 void ProfileIOData::SetCookieSettingsForTesting( 1416 void ProfileIOData::SetCookieSettingsForTesting(
1362 content_settings::CookieSettings* cookie_settings) { 1417 content_settings::CookieSettings* cookie_settings) {
1363 DCHECK(!cookie_settings_.get()); 1418 DCHECK(!cookie_settings_.get());
1364 cookie_settings_ = cookie_settings; 1419 cookie_settings_ = cookie_settings;
1365 } 1420 }
1366 1421
1367 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( 1422 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState(
1368 const GURL& url) const { 1423 const GURL& url) const {
1369 return url_blacklist_manager_->GetURLBlacklistState(url); 1424 return url_blacklist_manager_->GetURLBlacklistState(url);
1370 } 1425 }
OLDNEW
« 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