Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 #include "net/spdy/spdy_session.h" | 80 #include "net/spdy/spdy_session.h" |
| 81 #include "net/ssl/channel_id_service.h" | 81 #include "net/ssl/channel_id_service.h" |
| 82 #include "net/ssl/default_channel_id_store.h" | 82 #include "net/ssl/default_channel_id_store.h" |
| 83 #include "net/url_request/data_protocol_handler.h" | 83 #include "net/url_request/data_protocol_handler.h" |
| 84 #include "net/url_request/file_protocol_handler.h" | 84 #include "net/url_request/file_protocol_handler.h" |
| 85 #include "net/url_request/ftp_protocol_handler.h" | 85 #include "net/url_request/ftp_protocol_handler.h" |
| 86 #include "net/url_request/static_http_user_agent_settings.h" | 86 #include "net/url_request/static_http_user_agent_settings.h" |
| 87 #include "net/url_request/url_fetcher.h" | 87 #include "net/url_request/url_fetcher.h" |
| 88 #include "net/url_request/url_request_backoff_manager.h" | 88 #include "net/url_request/url_request_backoff_manager.h" |
| 89 #include "net/url_request/url_request_context.h" | 89 #include "net/url_request/url_request_context.h" |
| 90 #include "net/url_request/url_request_context_builder.h" | |
| 90 #include "net/url_request/url_request_context_getter.h" | 91 #include "net/url_request/url_request_context_getter.h" |
| 91 #include "net/url_request/url_request_job_factory_impl.h" | 92 #include "net/url_request/url_request_job_factory_impl.h" |
| 92 #include "url/url_constants.h" | 93 #include "url/url_constants.h" |
| 93 | 94 |
| 94 #if defined(ENABLE_CONFIGURATION_POLICY) | 95 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 95 #include "policy/policy_constants.h" | 96 #include "policy/policy_constants.h" |
| 96 #endif | 97 #endif |
| 97 | 98 |
| 98 #if defined(ENABLE_EXTENSIONS) | 99 #if defined(ENABLE_EXTENSIONS) |
| 99 #include "chrome/browser/extensions/event_router_forwarder.h" | 100 #include "chrome/browser/extensions/event_router_forwarder.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 if (!command_line.HasSwitch(switches::kHostResolverRules)) | 208 if (!command_line.HasSwitch(switches::kHostResolverRules)) |
| 208 return global_host_resolver.Pass(); | 209 return global_host_resolver.Pass(); |
| 209 | 210 |
| 210 scoped_ptr<net::MappedHostResolver> remapped_resolver( | 211 scoped_ptr<net::MappedHostResolver> remapped_resolver( |
| 211 new net::MappedHostResolver(global_host_resolver.Pass())); | 212 new net::MappedHostResolver(global_host_resolver.Pass())); |
| 212 remapped_resolver->SetRulesFromString( | 213 remapped_resolver->SetRulesFromString( |
| 213 command_line.GetSwitchValueASCII(switches::kHostResolverRules)); | 214 command_line.GetSwitchValueASCII(switches::kHostResolverRules)); |
| 214 return remapped_resolver.Pass(); | 215 return remapped_resolver.Pass(); |
| 215 } | 216 } |
| 216 | 217 |
| 217 // TODO(willchan): Remove proxy script fetcher context since it's not necessary | |
| 218 // now that I got rid of refcounting URLRequestContexts. | |
| 219 // See IOThread::Globals for details. | |
| 220 net::URLRequestContext* | |
| 221 ConstructProxyScriptFetcherContext(IOThread::Globals* globals, | |
| 222 net::NetLog* net_log) { | |
| 223 net::URLRequestContext* context = new net::URLRequestContext; | |
| 224 context->set_net_log(net_log); | |
| 225 context->set_host_resolver(globals->host_resolver.get()); | |
| 226 context->set_cert_verifier(globals->cert_verifier.get()); | |
| 227 context->set_transport_security_state( | |
| 228 globals->transport_security_state.get()); | |
| 229 context->set_cert_transparency_verifier( | |
| 230 globals->cert_transparency_verifier.get()); | |
| 231 context->set_http_auth_handler_factory( | |
| 232 globals->http_auth_handler_factory.get()); | |
| 233 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); | |
| 234 context->set_http_transaction_factory( | |
| 235 globals->proxy_script_fetcher_http_transaction_factory.get()); | |
| 236 context->set_job_factory( | |
| 237 globals->proxy_script_fetcher_url_request_job_factory.get()); | |
| 238 context->set_cookie_store(globals->system_cookie_store.get()); | |
| 239 context->set_channel_id_service( | |
| 240 globals->system_channel_id_service.get()); | |
| 241 context->set_network_delegate(globals->system_network_delegate.get()); | |
| 242 context->set_http_user_agent_settings( | |
| 243 globals->http_user_agent_settings.get()); | |
| 244 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | |
| 245 // system URLRequestContext too. There's no reason this should be tied to a | |
| 246 // profile. | |
| 247 return context; | |
| 248 } | |
| 249 | |
| 250 net::URLRequestContext* | |
| 251 ConstructSystemRequestContext(IOThread::Globals* globals, | |
| 252 net::NetLog* net_log) { | |
| 253 net::URLRequestContext* context = new SystemURLRequestContext; | |
| 254 context->set_net_log(net_log); | |
| 255 context->set_host_resolver(globals->host_resolver.get()); | |
| 256 context->set_cert_verifier(globals->cert_verifier.get()); | |
| 257 context->set_transport_security_state( | |
| 258 globals->transport_security_state.get()); | |
| 259 context->set_cert_transparency_verifier( | |
| 260 globals->cert_transparency_verifier.get()); | |
| 261 context->set_http_auth_handler_factory( | |
| 262 globals->http_auth_handler_factory.get()); | |
| 263 context->set_proxy_service(globals->system_proxy_service.get()); | |
| 264 context->set_http_transaction_factory( | |
| 265 globals->system_http_transaction_factory.get()); | |
| 266 context->set_job_factory(globals->system_url_request_job_factory.get()); | |
| 267 context->set_cookie_store(globals->system_cookie_store.get()); | |
| 268 context->set_channel_id_service( | |
| 269 globals->system_channel_id_service.get()); | |
| 270 context->set_network_delegate(globals->system_network_delegate.get()); | |
| 271 context->set_http_user_agent_settings( | |
| 272 globals->http_user_agent_settings.get()); | |
| 273 context->set_network_quality_estimator( | |
| 274 globals->network_quality_estimator.get()); | |
| 275 context->set_backoff_manager(globals->url_request_backoff_manager.get()); | |
| 276 return context; | |
| 277 } | |
| 278 | |
| 279 int GetSwitchValueAsInt(const base::CommandLine& command_line, | 218 int GetSwitchValueAsInt(const base::CommandLine& command_line, |
| 280 const std::string& switch_name) { | 219 const std::string& switch_name) { |
| 281 int value; | 220 int value; |
| 282 if (!base::StringToInt(command_line.GetSwitchValueASCII(switch_name), | 221 if (!base::StringToInt(command_line.GetSwitchValueASCII(switch_name), |
| 283 &value)) { | 222 &value)) { |
| 284 return 0; | 223 return 0; |
| 285 } | 224 } |
| 286 return value; | 225 return value; |
| 287 } | 226 } |
| 288 | 227 |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 809 switches::kEnableUserAlternateProtocolPorts)) { | 748 switches::kEnableUserAlternateProtocolPorts)) { |
| 810 globals_->enable_user_alternate_protocol_ports = true; | 749 globals_->enable_user_alternate_protocol_ports = true; |
| 811 } | 750 } |
| 812 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 751 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
| 813 // is fixed. | 752 // is fixed. |
| 814 tracked_objects::ScopedTracker tracking_profile13( | 753 tracked_objects::ScopedTracker tracking_profile13( |
| 815 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 754 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 816 "466432 IOThread::InitAsync::InitializeNetworkOptions")); | 755 "466432 IOThread::InitAsync::InitializeNetworkOptions")); |
| 817 InitializeNetworkOptions(command_line); | 756 InitializeNetworkOptions(command_line); |
| 818 | 757 |
| 819 net::HttpNetworkSession::Params session_params; | |
| 820 InitializeNetworkSessionParams(&session_params); | |
| 821 session_params.net_log = net_log_; | |
| 822 session_params.proxy_service = | |
| 823 globals_->proxy_script_fetcher_proxy_service.get(); | |
| 824 | |
| 825 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | |
| 826 // is fixed. | |
| 827 tracked_objects::ScopedTracker tracking_profile14( | |
| 828 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
| 829 "466432 IOThread::InitAsync::HttpNetorkSession::Start")); | |
| 830 TRACE_EVENT_BEGIN0("startup", "IOThread::InitAsync:HttpNetworkSession"); | |
| 831 scoped_refptr<net::HttpNetworkSession> network_session( | |
| 832 new net::HttpNetworkSession(session_params)); | |
| 833 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | |
| 834 // is fixed. | |
| 835 tracked_objects::ScopedTracker tracking_profile15( | |
| 836 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
| 837 "466432 IOThread::InitAsync::HttpNetorkSession::End")); | |
| 838 globals_->proxy_script_fetcher_http_transaction_factory | |
| 839 .reset(new net::HttpNetworkLayer(network_session.get())); | |
| 840 TRACE_EVENT_END0("startup", "IOThread::InitAsync:HttpNetworkSession"); | |
| 841 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( | |
| 842 new net::URLRequestJobFactoryImpl()); | |
| 843 | |
| 844 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | |
| 845 // is fixed. | |
| 846 tracked_objects::ScopedTracker tracking_profile16( | |
| 847 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
| 848 "466432 IOThread::InitAsync::SetProtocolHandler")); | |
| 849 job_factory->SetProtocolHandler(url::kDataScheme, | |
| 850 new net::DataProtocolHandler()); | |
| 851 job_factory->SetProtocolHandler( | |
| 852 url::kFileScheme, | |
| 853 new net::FileProtocolHandler( | |
| 854 content::BrowserThread::GetBlockingPool()-> | |
| 855 GetTaskRunnerWithShutdownBehavior( | |
| 856 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); | |
| 857 #if !defined(DISABLE_FTP_SUPPORT) | |
| 858 globals_->proxy_script_fetcher_ftp_transaction_factory.reset( | |
| 859 new net::FtpNetworkLayer(globals_->host_resolver.get())); | |
| 860 job_factory->SetProtocolHandler( | |
| 861 url::kFtpScheme, | |
| 862 new net::FtpProtocolHandler( | |
| 863 globals_->proxy_script_fetcher_ftp_transaction_factory.get())); | |
| 864 #endif | |
| 865 globals_->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); | |
| 866 | |
| 867 globals_->proxy_script_fetcher_context.reset( | 758 globals_->proxy_script_fetcher_context.reset( |
| 868 ConstructProxyScriptFetcherContext(globals_, net_log_)); | 759 ConstructProxyScriptFetcherContext(globals_, net_log_)); |
| 869 | 760 |
| 870 const version_info::Channel channel = chrome::GetChannel(); | 761 const version_info::Channel channel = chrome::GetChannel(); |
| 871 if (channel == version_info::Channel::UNKNOWN || | 762 if (channel == version_info::Channel::UNKNOWN || |
| 872 channel == version_info::Channel::CANARY || | 763 channel == version_info::Channel::CANARY || |
| 873 channel == version_info::Channel::DEV) { | 764 channel == version_info::Channel::DEV) { |
| 874 globals_->url_request_backoff_manager.reset( | 765 globals_->url_request_backoff_manager.reset( |
| 875 new net::URLRequestBackoffManager()); | 766 new net::URLRequestBackoffManager()); |
| 876 } | 767 } |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1093 | 984 |
| 1094 void IOThread::InitializeNetworkSessionParams( | 985 void IOThread::InitializeNetworkSessionParams( |
| 1095 net::HttpNetworkSession::Params* params) { | 986 net::HttpNetworkSession::Params* params) { |
| 1096 InitializeNetworkSessionParamsFromGlobals(*globals_, params); | 987 InitializeNetworkSessionParamsFromGlobals(*globals_, params); |
| 1097 } | 988 } |
| 1098 | 989 |
| 1099 // static | 990 // static |
| 1100 void IOThread::InitializeNetworkSessionParamsFromGlobals( | 991 void IOThread::InitializeNetworkSessionParamsFromGlobals( |
| 1101 const IOThread::Globals& globals, | 992 const IOThread::Globals& globals, |
| 1102 net::HttpNetworkSession::Params* params) { | 993 net::HttpNetworkSession::Params* params) { |
| 1103 params->host_resolver = globals.host_resolver.get(); | 994 // TODO(wjmaclean): The next two properties of the params don't seem to be |
| 1104 params->cert_verifier = globals.cert_verifier.get(); | 995 // elements of URLRequestContext, so they must be set here. |
| 996 // Is it OK that they are shared? | |
| 1105 params->cert_policy_enforcer = globals.cert_policy_enforcer.get(); | 997 params->cert_policy_enforcer = globals.cert_policy_enforcer.get(); |
| 1106 params->channel_id_service = globals.system_channel_id_service.get(); | |
| 1107 params->transport_security_state = globals.transport_security_state.get(); | |
| 1108 params->ssl_config_service = globals.ssl_config_service.get(); | |
| 1109 params->http_auth_handler_factory = globals.http_auth_handler_factory.get(); | |
| 1110 params->http_server_properties = | |
| 1111 globals.http_server_properties->GetWeakPtr(); | |
| 1112 params->network_delegate = globals.system_network_delegate.get(); | |
| 1113 params->host_mapping_rules = globals.host_mapping_rules.get(); | 998 params->host_mapping_rules = globals.host_mapping_rules.get(); |
| 999 | |
| 1114 params->ignore_certificate_errors = globals.ignore_certificate_errors; | 1000 params->ignore_certificate_errors = globals.ignore_certificate_errors; |
| 1115 params->testing_fixed_http_port = globals.testing_fixed_http_port; | 1001 params->testing_fixed_http_port = globals.testing_fixed_http_port; |
| 1116 params->testing_fixed_https_port = globals.testing_fixed_https_port; | 1002 params->testing_fixed_https_port = globals.testing_fixed_https_port; |
| 1117 globals.enable_tcp_fast_open_for_ssl.CopyToIfSet( | 1003 globals.enable_tcp_fast_open_for_ssl.CopyToIfSet( |
| 1118 ¶ms->enable_tcp_fast_open_for_ssl); | 1004 ¶ms->enable_tcp_fast_open_for_ssl); |
| 1119 | 1005 |
| 1120 globals.initial_max_spdy_concurrent_streams.CopyToIfSet( | 1006 globals.initial_max_spdy_concurrent_streams.CopyToIfSet( |
| 1121 ¶ms->spdy_initial_max_concurrent_streams); | 1007 ¶ms->spdy_initial_max_concurrent_streams); |
| 1122 globals.enable_spdy_compression.CopyToIfSet( | 1008 globals.enable_spdy_compression.CopyToIfSet( |
| 1123 ¶ms->enable_spdy_compression); | 1009 ¶ms->enable_spdy_compression); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1214 *base::CommandLine::ForCurrentProcess(); | 1100 *base::CommandLine::ForCurrentProcess(); |
| 1215 globals_->system_proxy_service.reset( | 1101 globals_->system_proxy_service.reset( |
| 1216 ProxyServiceFactory::CreateProxyService( | 1102 ProxyServiceFactory::CreateProxyService( |
| 1217 net_log_, | 1103 net_log_, |
| 1218 globals_->proxy_script_fetcher_context.get(), | 1104 globals_->proxy_script_fetcher_context.get(), |
| 1219 globals_->system_network_delegate.get(), | 1105 globals_->system_network_delegate.get(), |
| 1220 system_proxy_config_service_.release(), | 1106 system_proxy_config_service_.release(), |
| 1221 command_line, | 1107 command_line, |
| 1222 quick_check_enabled_.GetValue())); | 1108 quick_check_enabled_.GetValue())); |
| 1223 | 1109 |
| 1224 net::HttpNetworkSession::Params system_params; | |
| 1225 InitializeNetworkSessionParams(&system_params); | |
| 1226 system_params.net_log = net_log_; | |
| 1227 system_params.proxy_service = globals_->system_proxy_service.get(); | |
| 1228 | |
| 1229 globals_->system_http_transaction_factory.reset( | |
| 1230 new net::HttpNetworkLayer( | |
| 1231 new net::HttpNetworkSession(system_params))); | |
| 1232 globals_->system_url_request_job_factory.reset( | |
| 1233 new net::URLRequestJobFactoryImpl()); | |
| 1234 globals_->system_request_context.reset( | 1110 globals_->system_request_context.reset( |
| 1235 ConstructSystemRequestContext(globals_, net_log_)); | 1111 ConstructSystemRequestContext(globals_, net_log_)); |
| 1236 globals_->system_request_context->set_ssl_config_service( | |
| 1237 globals_->ssl_config_service.get()); | |
| 1238 globals_->system_request_context->set_http_server_properties( | |
| 1239 globals_->http_server_properties->GetWeakPtr()); | |
| 1240 } | 1112 } |
| 1241 | 1113 |
| 1242 void IOThread::UpdateDnsClientEnabled() { | 1114 void IOThread::UpdateDnsClientEnabled() { |
| 1243 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); | 1115 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); |
| 1244 } | 1116 } |
| 1245 | 1117 |
| 1246 void IOThread::ConfigureQuic(const base::CommandLine& command_line) { | 1118 void IOThread::ConfigureQuic(const base::CommandLine& command_line) { |
| 1247 // Always fetch the field trial group to ensure it is reported correctly. | 1119 // Always fetch the field trial group to ensure it is reported correctly. |
| 1248 // The command line flags will be associated with a group that is reported | 1120 // The command line flags will be associated with a group that is reported |
| 1249 // so long as trial is actually queried. | 1121 // so long as trial is actually queried. |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1593 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1465 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
| 1594 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1466 for (size_t i = 0; i < supported_versions.size(); ++i) { |
| 1595 net::QuicVersion version = supported_versions[i]; | 1467 net::QuicVersion version = supported_versions[i]; |
| 1596 if (net::QuicVersionToString(version) == quic_version) { | 1468 if (net::QuicVersionToString(version) == quic_version) { |
| 1597 return version; | 1469 return version; |
| 1598 } | 1470 } |
| 1599 } | 1471 } |
| 1600 | 1472 |
| 1601 return net::QUIC_VERSION_UNSUPPORTED; | 1473 return net::QUIC_VERSION_UNSUPPORTED; |
| 1602 } | 1474 } |
| 1475 | |
| 1476 // static | |
| 1477 net::URLRequestContext* | |
| 1478 IOThread::ConstructSystemRequestContext(IOThread::Globals* globals, | |
| 1479 net::NetLog* net_log) { | |
| 1480 net::URLRequestContext* context = new SystemURLRequestContext; | |
| 1481 context->set_net_log(net_log); | |
| 1482 context->set_host_resolver(globals->host_resolver.get()); | |
| 1483 context->set_cert_verifier(globals->cert_verifier.get()); | |
| 1484 context->set_transport_security_state( | |
| 1485 globals->transport_security_state.get()); | |
| 1486 context->set_cert_transparency_verifier( | |
| 1487 globals->cert_transparency_verifier.get()); | |
| 1488 context->set_ssl_config_service(globals->ssl_config_service.get()); | |
| 1489 context->set_http_auth_handler_factory( | |
| 1490 globals->http_auth_handler_factory.get()); | |
| 1491 context->set_proxy_service(globals->system_proxy_service.get()); | |
| 1492 | |
| 1493 globals->system_url_request_job_factory.reset( | |
| 1494 new net::URLRequestJobFactoryImpl()); | |
| 1495 context->set_job_factory(globals->system_url_request_job_factory.get()); | |
| 1496 | |
| 1497 context->set_cookie_store(globals->system_cookie_store.get()); | |
| 1498 context->set_channel_id_service( | |
| 1499 globals->system_channel_id_service.get()); | |
| 1500 context->set_network_delegate(globals->system_network_delegate.get()); | |
| 1501 context->set_http_user_agent_settings( | |
| 1502 globals->http_user_agent_settings.get()); | |
| 1503 context->set_network_quality_estimator( | |
| 1504 globals->network_quality_estimator.get()); | |
| 1505 context->set_backoff_manager(globals->url_request_backoff_manager.get()); | |
| 1506 | |
| 1507 context->set_ssl_config_service( | |
| 1508 globals->ssl_config_service.get()); | |
| 1509 context->set_http_server_properties( | |
| 1510 globals->http_server_properties->GetWeakPtr()); | |
| 1511 | |
| 1512 net::HttpNetworkSession::Params system_params; | |
| 1513 InitializeNetworkSessionParamsFromGlobals(*globals, &system_params); | |
| 1514 net::URLRequestContextBuilder::SetHttpNetworkSessionComponents(&system_params, | |
| 1515 context); | |
| 1516 | |
| 1517 globals->system_http_transaction_factory.reset( | |
| 1518 new net::HttpNetworkLayer(new net::HttpNetworkSession(system_params))); | |
| 1519 context->set_http_transaction_factory( | |
| 1520 globals->system_http_transaction_factory.get()); | |
| 1521 | |
| 1522 return context; | |
| 1523 } | |
| 1524 | |
| 1525 // TODO(willchan): Remove proxy script fetcher context since it's not necessary | |
| 1526 // now that I got rid of refcounting URLRequestContexts. | |
|
mmenke
2015/08/17 20:13:04
Hrm...Wonder how doable this is. Not suggesting y
wjmaclean
2015/08/18 14:17:23
Acknowledged.
| |
| 1527 // See IOThread::Globals for details. | |
| 1528 // static | |
| 1529 net::URLRequestContext* IOThread::ConstructProxyScriptFetcherContext( | |
| 1530 IOThread::Globals* globals, | |
| 1531 net::NetLog* net_log) { | |
| 1532 net::URLRequestContext* context = new net::URLRequestContext; | |
| 1533 context->set_net_log(net_log); | |
| 1534 context->set_host_resolver(globals->host_resolver.get()); | |
| 1535 context->set_cert_verifier(globals->cert_verifier.get()); | |
| 1536 context->set_transport_security_state( | |
| 1537 globals->transport_security_state.get()); | |
| 1538 context->set_cert_transparency_verifier( | |
| 1539 globals->cert_transparency_verifier.get()); | |
| 1540 context->set_ssl_config_service(globals->ssl_config_service.get()); | |
| 1541 context->set_http_auth_handler_factory( | |
| 1542 globals->http_auth_handler_factory.get()); | |
| 1543 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); | |
| 1544 | |
| 1545 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( | |
| 1546 new net::URLRequestJobFactoryImpl()); | |
| 1547 | |
| 1548 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | |
| 1549 // is fixed. | |
| 1550 tracked_objects::ScopedTracker tracking_profile16( | |
| 1551 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
| 1552 "466432 IOThread::InitAsync::SetProtocolHandler")); | |
|
mmenke
2015/08/17 20:13:04
This should be renamed "466432 IOThread::Construct
wjmaclean
2015/08/18 14:17:22
Done.
| |
| 1553 job_factory->SetProtocolHandler(url::kDataScheme, | |
| 1554 new net::DataProtocolHandler()); | |
| 1555 job_factory->SetProtocolHandler( | |
| 1556 url::kFileScheme, | |
| 1557 new net::FileProtocolHandler( | |
| 1558 content::BrowserThread::GetBlockingPool()-> | |
| 1559 GetTaskRunnerWithShutdownBehavior( | |
| 1560 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); | |
| 1561 #if !defined(DISABLE_FTP_SUPPORT) | |
| 1562 globals->proxy_script_fetcher_ftp_transaction_factory.reset( | |
| 1563 new net::FtpNetworkLayer(globals->host_resolver.get())); | |
| 1564 job_factory->SetProtocolHandler( | |
| 1565 url::kFtpScheme, | |
| 1566 new net::FtpProtocolHandler( | |
| 1567 globals->proxy_script_fetcher_ftp_transaction_factory.get())); | |
| 1568 #endif | |
| 1569 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); | |
| 1570 | |
| 1571 context->set_job_factory( | |
| 1572 globals->proxy_script_fetcher_url_request_job_factory.get()); | |
|
mmenke
2015/08/17 20:13:03
Suggest we put job factory initialization last, si
wjmaclean
2015/08/18 14:17:22
Done.
| |
| 1573 | |
| 1574 context->set_cookie_store(globals->system_cookie_store.get()); | |
| 1575 context->set_channel_id_service( | |
| 1576 globals->system_channel_id_service.get()); | |
| 1577 context->set_network_delegate(globals->system_network_delegate.get()); | |
| 1578 context->set_http_user_agent_settings( | |
| 1579 globals->http_user_agent_settings.get()); | |
| 1580 context->set_http_server_properties( | |
| 1581 globals->http_server_properties->GetWeakPtr()); | |
|
mmenke
2015/08/17 20:13:04
This last one wasn't being done on the proxy conte
wjmaclean
2015/08/18 14:17:22
Adding this was necessary because we need the http
mmenke
2015/08/18 18:30:32
Ahh...It was being set on the session, but not the
| |
| 1582 | |
| 1583 net::HttpNetworkSession::Params session_params; | |
| 1584 InitializeNetworkSessionParamsFromGlobals(*globals, &session_params); | |
| 1585 net::URLRequestContextBuilder::SetHttpNetworkSessionComponents( | |
| 1586 &session_params, context); | |
| 1587 | |
| 1588 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | |
| 1589 // is fixed. | |
| 1590 tracked_objects::ScopedTracker tracking_profile14( | |
| 1591 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
| 1592 "466432 IOThread::InitAsync::HttpNetorkSession::Start")); | |
|
mmenke
2015/08/17 20:13:04
"466432 IOThread::ConstructProxyScriptFetcherConte
wjmaclean
2015/08/18 14:17:23
Done.
| |
| 1593 TRACE_EVENT_BEGIN0("startup", "IOThread::InitAsync:HttpNetworkSession"); | |
|
mmenke
2015/08/17 20:13:04
These two TRACE_EVENTS are weird. Suggest moving
wjmaclean
2015/08/18 14:17:22
Done.
| |
| 1594 scoped_refptr<net::HttpNetworkSession> network_session( | |
| 1595 new net::HttpNetworkSession(session_params)); | |
| 1596 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | |
| 1597 // is fixed. | |
| 1598 tracked_objects::ScopedTracker tracking_profile15( | |
| 1599 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
| 1600 "466432 IOThread::InitAsync::HttpNetorkSession::End")); | |
| 1601 globals->proxy_script_fetcher_http_transaction_factory | |
| 1602 .reset(new net::HttpNetworkLayer(network_session.get())); | |
| 1603 context->set_http_transaction_factory( | |
| 1604 globals->proxy_script_fetcher_http_transaction_factory.get()); | |
| 1605 TRACE_EVENT_END0("startup", "IOThread::InitAsync:HttpNetworkSession"); | |
| 1606 | |
| 1607 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | |
| 1608 // system URLRequestContext too. There's no reason this should be tied to a | |
| 1609 // profile. | |
| 1610 return context; | |
| 1611 } | |
| OLD | NEW |