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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 #include "net/http/http_auth_filter.h" | 60 #include "net/http/http_auth_filter.h" |
| 61 #include "net/http/http_auth_handler_factory.h" | 61 #include "net/http/http_auth_handler_factory.h" |
| 62 #include "net/http/http_network_layer.h" | 62 #include "net/http/http_network_layer.h" |
| 63 #include "net/http/http_server_properties_impl.h" | 63 #include "net/http/http_server_properties_impl.h" |
| 64 #include "net/proxy/proxy_config_service.h" | 64 #include "net/proxy/proxy_config_service.h" |
| 65 #include "net/proxy/proxy_script_fetcher_impl.h" | 65 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 66 #include "net/proxy/proxy_service.h" | 66 #include "net/proxy/proxy_service.h" |
| 67 #include "net/quic/quic_protocol.h" | 67 #include "net/quic/quic_protocol.h" |
| 68 #include "net/socket/tcp_client_socket.h" | 68 #include "net/socket/tcp_client_socket.h" |
| 69 #include "net/spdy/spdy_session.h" | 69 #include "net/spdy/spdy_session.h" |
| 70 #include "net/ssl/default_server_bound_cert_store.h" | 70 #include "net/ssl/channel_id_service.h" |
| 71 #include "net/ssl/server_bound_cert_service.h" | 71 #include "net/ssl/default_channel_id_store.h" |
| 72 #include "net/url_request/data_protocol_handler.h" | 72 #include "net/url_request/data_protocol_handler.h" |
| 73 #include "net/url_request/file_protocol_handler.h" | 73 #include "net/url_request/file_protocol_handler.h" |
| 74 #include "net/url_request/ftp_protocol_handler.h" | 74 #include "net/url_request/ftp_protocol_handler.h" |
| 75 #include "net/url_request/static_http_user_agent_settings.h" | 75 #include "net/url_request/static_http_user_agent_settings.h" |
| 76 #include "net/url_request/url_fetcher.h" | 76 #include "net/url_request/url_fetcher.h" |
| 77 #include "net/url_request/url_request_job_factory_impl.h" | 77 #include "net/url_request/url_request_job_factory_impl.h" |
| 78 #include "net/url_request/url_request_throttler_manager.h" | 78 #include "net/url_request/url_request_throttler_manager.h" |
| 79 #include "url/url_constants.h" | 79 #include "url/url_constants.h" |
| 80 | 80 |
| 81 #if defined(ENABLE_CONFIGURATION_POLICY) | 81 #if defined(ENABLE_CONFIGURATION_POLICY) |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 context->set_cert_transparency_verifier( | 234 context->set_cert_transparency_verifier( |
| 235 globals->cert_transparency_verifier.get()); | 235 globals->cert_transparency_verifier.get()); |
| 236 context->set_http_auth_handler_factory( | 236 context->set_http_auth_handler_factory( |
| 237 globals->http_auth_handler_factory.get()); | 237 globals->http_auth_handler_factory.get()); |
| 238 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); | 238 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); |
| 239 context->set_http_transaction_factory( | 239 context->set_http_transaction_factory( |
| 240 globals->proxy_script_fetcher_http_transaction_factory.get()); | 240 globals->proxy_script_fetcher_http_transaction_factory.get()); |
| 241 context->set_job_factory( | 241 context->set_job_factory( |
| 242 globals->proxy_script_fetcher_url_request_job_factory.get()); | 242 globals->proxy_script_fetcher_url_request_job_factory.get()); |
| 243 context->set_cookie_store(globals->system_cookie_store.get()); | 243 context->set_cookie_store(globals->system_cookie_store.get()); |
| 244 context->set_server_bound_cert_service( | 244 context->set_channel_id_service( |
| 245 globals->system_server_bound_cert_service.get()); | 245 globals->system_channel_id_service.get()); |
| 246 context->set_network_delegate(globals->system_network_delegate.get()); | 246 context->set_network_delegate(globals->system_network_delegate.get()); |
| 247 context->set_http_user_agent_settings( | 247 context->set_http_user_agent_settings( |
| 248 globals->http_user_agent_settings.get()); | 248 globals->http_user_agent_settings.get()); |
| 249 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 249 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
| 250 // system URLRequestContext too. There's no reason this should be tied to a | 250 // system URLRequestContext too. There's no reason this should be tied to a |
| 251 // profile. | 251 // profile. |
| 252 return context; | 252 return context; |
| 253 } | 253 } |
| 254 | 254 |
| 255 net::URLRequestContext* | 255 net::URLRequestContext* |
| 256 ConstructSystemRequestContext(IOThread::Globals* globals, | 256 ConstructSystemRequestContext(IOThread::Globals* globals, |
| 257 net::NetLog* net_log) { | 257 net::NetLog* net_log) { |
| 258 net::URLRequestContext* context = new SystemURLRequestContext; | 258 net::URLRequestContext* context = new SystemURLRequestContext; |
| 259 context->set_net_log(net_log); | 259 context->set_net_log(net_log); |
| 260 context->set_host_resolver(globals->host_resolver.get()); | 260 context->set_host_resolver(globals->host_resolver.get()); |
| 261 context->set_cert_verifier(globals->cert_verifier.get()); | 261 context->set_cert_verifier(globals->cert_verifier.get()); |
| 262 context->set_transport_security_state( | 262 context->set_transport_security_state( |
| 263 globals->transport_security_state.get()); | 263 globals->transport_security_state.get()); |
| 264 context->set_cert_transparency_verifier( | 264 context->set_cert_transparency_verifier( |
| 265 globals->cert_transparency_verifier.get()); | 265 globals->cert_transparency_verifier.get()); |
| 266 context->set_http_auth_handler_factory( | 266 context->set_http_auth_handler_factory( |
| 267 globals->http_auth_handler_factory.get()); | 267 globals->http_auth_handler_factory.get()); |
| 268 context->set_proxy_service(globals->system_proxy_service.get()); | 268 context->set_proxy_service(globals->system_proxy_service.get()); |
| 269 context->set_http_transaction_factory( | 269 context->set_http_transaction_factory( |
| 270 globals->system_http_transaction_factory.get()); | 270 globals->system_http_transaction_factory.get()); |
| 271 context->set_job_factory(globals->system_url_request_job_factory.get()); | 271 context->set_job_factory(globals->system_url_request_job_factory.get()); |
| 272 context->set_cookie_store(globals->system_cookie_store.get()); | 272 context->set_cookie_store(globals->system_cookie_store.get()); |
| 273 context->set_server_bound_cert_service( | 273 context->set_channel_id_service( |
| 274 globals->system_server_bound_cert_service.get()); | 274 globals->system_channel_id_service.get()); |
| 275 context->set_throttler_manager(globals->throttler_manager.get()); | 275 context->set_throttler_manager(globals->throttler_manager.get()); |
| 276 context->set_network_delegate(globals->system_network_delegate.get()); | 276 context->set_network_delegate(globals->system_network_delegate.get()); |
| 277 context->set_http_user_agent_settings( | 277 context->set_http_user_agent_settings( |
| 278 globals->http_user_agent_settings.get()); | 278 globals->http_user_agent_settings.get()); |
| 279 return context; | 279 return context; |
| 280 } | 280 } |
| 281 | 281 |
| 282 int GetSwitchValueAsInt(const CommandLine& command_line, | 282 int GetSwitchValueAsInt(const CommandLine& command_line, |
| 283 const std::string& switch_name) { | 283 const std::string& switch_name) { |
| 284 int value; | 284 int value; |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 641 #endif // defined(OS_ANDROID) || defined(OS_IOS) | 641 #endif // defined(OS_ANDROID) || defined(OS_IOS) |
| 642 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( | 642 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( |
| 643 globals_->host_resolver.get())); | 643 globals_->host_resolver.get())); |
| 644 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl()); | 644 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl()); |
| 645 // For the ProxyScriptFetcher, we use a direct ProxyService. | 645 // For the ProxyScriptFetcher, we use a direct ProxyService. |
| 646 globals_->proxy_script_fetcher_proxy_service.reset( | 646 globals_->proxy_script_fetcher_proxy_service.reset( |
| 647 net::ProxyService::CreateDirectWithNetLog(net_log_)); | 647 net::ProxyService::CreateDirectWithNetLog(net_log_)); |
| 648 // In-memory cookie store. | 648 // In-memory cookie store. |
| 649 globals_->system_cookie_store = | 649 globals_->system_cookie_store = |
| 650 content::CreateCookieStore(content::CookieStoreConfig()); | 650 content::CreateCookieStore(content::CookieStoreConfig()); |
| 651 // In-memory server bound cert store. | 651 // In-memory server bound cert store. |
|
wtc
2014/07/01 19:50:50
server bound cert => channel ID
Ryan Hamilton
2014/07/21 19:12:06
Done.
| |
| 652 globals_->system_server_bound_cert_service.reset( | 652 globals_->system_channel_id_service.reset( |
| 653 new net::ServerBoundCertService( | 653 new net::ChannelIDService( |
| 654 new net::DefaultServerBoundCertStore(NULL), | 654 new net::DefaultChannelIDStore(NULL), |
| 655 base::WorkerPool::GetTaskRunner(true))); | 655 base::WorkerPool::GetTaskRunner(true))); |
| 656 globals_->dns_probe_service.reset(new chrome_browser_net::DnsProbeService()); | 656 globals_->dns_probe_service.reset(new chrome_browser_net::DnsProbeService()); |
| 657 globals_->host_mapping_rules.reset(new net::HostMappingRules()); | 657 globals_->host_mapping_rules.reset(new net::HostMappingRules()); |
| 658 globals_->http_user_agent_settings.reset( | 658 globals_->http_user_agent_settings.reset( |
| 659 new net::StaticHttpUserAgentSettings(std::string(), GetUserAgent())); | 659 new net::StaticHttpUserAgentSettings(std::string(), GetUserAgent())); |
| 660 if (command_line.HasSwitch(switches::kHostRules)) { | 660 if (command_line.HasSwitch(switches::kHostRules)) { |
| 661 TRACE_EVENT_BEGIN0("startup", "IOThread::InitAsync:SetRulesFromString"); | 661 TRACE_EVENT_BEGIN0("startup", "IOThread::InitAsync:SetRulesFromString"); |
| 662 globals_->host_mapping_rules->SetRulesFromString( | 662 globals_->host_mapping_rules->SetRulesFromString( |
| 663 command_line.GetSwitchValueASCII(switches::kHostRules)); | 663 command_line.GetSwitchValueASCII(switches::kHostRules)); |
| 664 TRACE_EVENT_END0("startup", "IOThread::InitAsync:SetRulesFromString"); | 664 TRACE_EVENT_END0("startup", "IOThread::InitAsync:SetRulesFromString"); |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 947 net::HttpNetworkSession::Params* params) { | 947 net::HttpNetworkSession::Params* params) { |
| 948 InitializeNetworkSessionParamsFromGlobals(*globals_, params); | 948 InitializeNetworkSessionParamsFromGlobals(*globals_, params); |
| 949 } | 949 } |
| 950 | 950 |
| 951 // static | 951 // static |
| 952 void IOThread::InitializeNetworkSessionParamsFromGlobals( | 952 void IOThread::InitializeNetworkSessionParamsFromGlobals( |
| 953 const IOThread::Globals& globals, | 953 const IOThread::Globals& globals, |
| 954 net::HttpNetworkSession::Params* params) { | 954 net::HttpNetworkSession::Params* params) { |
| 955 params->host_resolver = globals.host_resolver.get(); | 955 params->host_resolver = globals.host_resolver.get(); |
| 956 params->cert_verifier = globals.cert_verifier.get(); | 956 params->cert_verifier = globals.cert_verifier.get(); |
| 957 params->server_bound_cert_service = | 957 params->channel_id_service = |
| 958 globals.system_server_bound_cert_service.get(); | 958 globals.system_channel_id_service.get(); |
|
wtc
2014/07/01 19:50:50
This may fit on the previous line now.
Ryan Hamilton
2014/07/21 19:12:06
Done.
| |
| 959 params->transport_security_state = globals.transport_security_state.get(); | 959 params->transport_security_state = globals.transport_security_state.get(); |
| 960 params->ssl_config_service = globals.ssl_config_service.get(); | 960 params->ssl_config_service = globals.ssl_config_service.get(); |
| 961 params->http_auth_handler_factory = globals.http_auth_handler_factory.get(); | 961 params->http_auth_handler_factory = globals.http_auth_handler_factory.get(); |
| 962 params->http_server_properties = | 962 params->http_server_properties = |
| 963 globals.http_server_properties->GetWeakPtr(); | 963 globals.http_server_properties->GetWeakPtr(); |
| 964 params->network_delegate = globals.system_network_delegate.get(); | 964 params->network_delegate = globals.system_network_delegate.get(); |
| 965 params->host_mapping_rules = globals.host_mapping_rules.get(); | 965 params->host_mapping_rules = globals.host_mapping_rules.get(); |
| 966 params->ignore_certificate_errors = globals.ignore_certificate_errors; | 966 params->ignore_certificate_errors = globals.ignore_certificate_errors; |
| 967 params->testing_fixed_http_port = globals.testing_fixed_http_port; | 967 params->testing_fixed_http_port = globals.testing_fixed_http_port; |
| 968 params->testing_fixed_https_port = globals.testing_fixed_https_port; | 968 params->testing_fixed_https_port = globals.testing_fixed_https_port; |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1296 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1296 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
| 1297 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1297 for (size_t i = 0; i < supported_versions.size(); ++i) { |
| 1298 net::QuicVersion version = supported_versions[i]; | 1298 net::QuicVersion version = supported_versions[i]; |
| 1299 if (net::QuicVersionToString(version) == quic_version) { | 1299 if (net::QuicVersionToString(version) == quic_version) { |
| 1300 return version; | 1300 return version; |
| 1301 } | 1301 } |
| 1302 } | 1302 } |
| 1303 | 1303 |
| 1304 return net::QUIC_VERSION_UNSUPPORTED; | 1304 return net::QUIC_VERSION_UNSUPPORTED; |
| 1305 } | 1305 } |
| OLD | NEW |