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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 context->set_cert_transparency_verifier( | 244 context->set_cert_transparency_verifier( |
245 globals->cert_transparency_verifier.get()); | 245 globals->cert_transparency_verifier.get()); |
246 context->set_http_auth_handler_factory( | 246 context->set_http_auth_handler_factory( |
247 globals->http_auth_handler_factory.get()); | 247 globals->http_auth_handler_factory.get()); |
248 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); | 248 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); |
249 context->set_http_transaction_factory( | 249 context->set_http_transaction_factory( |
250 globals->proxy_script_fetcher_http_transaction_factory.get()); | 250 globals->proxy_script_fetcher_http_transaction_factory.get()); |
251 context->set_job_factory( | 251 context->set_job_factory( |
252 globals->proxy_script_fetcher_url_request_job_factory.get()); | 252 globals->proxy_script_fetcher_url_request_job_factory.get()); |
253 context->set_cookie_store(globals->system_cookie_store.get()); | 253 context->set_cookie_store(globals->system_cookie_store.get()); |
254 context->set_server_bound_cert_service( | 254 context->set_channel_id_service( |
255 globals->system_server_bound_cert_service.get()); | 255 globals->system_channel_id_service.get()); |
256 context->set_network_delegate(globals->system_network_delegate.get()); | 256 context->set_network_delegate(globals->system_network_delegate.get()); |
257 context->set_http_user_agent_settings( | 257 context->set_http_user_agent_settings( |
258 globals->http_user_agent_settings.get()); | 258 globals->http_user_agent_settings.get()); |
259 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 259 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
260 // system URLRequestContext too. There's no reason this should be tied to a | 260 // system URLRequestContext too. There's no reason this should be tied to a |
261 // profile. | 261 // profile. |
262 return context; | 262 return context; |
263 } | 263 } |
264 | 264 |
265 net::URLRequestContext* | 265 net::URLRequestContext* |
266 ConstructSystemRequestContext(IOThread::Globals* globals, | 266 ConstructSystemRequestContext(IOThread::Globals* globals, |
267 net::NetLog* net_log) { | 267 net::NetLog* net_log) { |
268 net::URLRequestContext* context = new SystemURLRequestContext; | 268 net::URLRequestContext* context = new SystemURLRequestContext; |
269 context->set_net_log(net_log); | 269 context->set_net_log(net_log); |
270 context->set_host_resolver(globals->host_resolver.get()); | 270 context->set_host_resolver(globals->host_resolver.get()); |
271 context->set_cert_verifier(globals->cert_verifier.get()); | 271 context->set_cert_verifier(globals->cert_verifier.get()); |
272 context->set_transport_security_state( | 272 context->set_transport_security_state( |
273 globals->transport_security_state.get()); | 273 globals->transport_security_state.get()); |
274 context->set_cert_transparency_verifier( | 274 context->set_cert_transparency_verifier( |
275 globals->cert_transparency_verifier.get()); | 275 globals->cert_transparency_verifier.get()); |
276 context->set_http_auth_handler_factory( | 276 context->set_http_auth_handler_factory( |
277 globals->http_auth_handler_factory.get()); | 277 globals->http_auth_handler_factory.get()); |
278 context->set_proxy_service(globals->system_proxy_service.get()); | 278 context->set_proxy_service(globals->system_proxy_service.get()); |
279 context->set_http_transaction_factory( | 279 context->set_http_transaction_factory( |
280 globals->system_http_transaction_factory.get()); | 280 globals->system_http_transaction_factory.get()); |
281 context->set_job_factory(globals->system_url_request_job_factory.get()); | 281 context->set_job_factory(globals->system_url_request_job_factory.get()); |
282 context->set_cookie_store(globals->system_cookie_store.get()); | 282 context->set_cookie_store(globals->system_cookie_store.get()); |
283 context->set_server_bound_cert_service( | 283 context->set_channel_id_service( |
284 globals->system_server_bound_cert_service.get()); | 284 globals->system_channel_id_service.get()); |
285 context->set_throttler_manager(globals->throttler_manager.get()); | 285 context->set_throttler_manager(globals->throttler_manager.get()); |
286 context->set_network_delegate(globals->system_network_delegate.get()); | 286 context->set_network_delegate(globals->system_network_delegate.get()); |
287 context->set_http_user_agent_settings( | 287 context->set_http_user_agent_settings( |
288 globals->http_user_agent_settings.get()); | 288 globals->http_user_agent_settings.get()); |
289 return context; | 289 return context; |
290 } | 290 } |
291 | 291 |
292 int GetSwitchValueAsInt(const CommandLine& command_line, | 292 int GetSwitchValueAsInt(const CommandLine& command_line, |
293 const std::string& switch_name) { | 293 const std::string& switch_name) { |
294 int value; | 294 int value; |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 #endif // defined(OS_ANDROID) || defined(OS_IOS) | 651 #endif // defined(OS_ANDROID) || defined(OS_IOS) |
652 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( | 652 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( |
653 globals_->host_resolver.get())); | 653 globals_->host_resolver.get())); |
654 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl()); | 654 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl()); |
655 // For the ProxyScriptFetcher, we use a direct ProxyService. | 655 // For the ProxyScriptFetcher, we use a direct ProxyService. |
656 globals_->proxy_script_fetcher_proxy_service.reset( | 656 globals_->proxy_script_fetcher_proxy_service.reset( |
657 net::ProxyService::CreateDirectWithNetLog(net_log_)); | 657 net::ProxyService::CreateDirectWithNetLog(net_log_)); |
658 // In-memory cookie store. | 658 // In-memory cookie store. |
659 globals_->system_cookie_store = | 659 globals_->system_cookie_store = |
660 content::CreateCookieStore(content::CookieStoreConfig()); | 660 content::CreateCookieStore(content::CookieStoreConfig()); |
661 // In-memory server bound cert store. | 661 // In-memory channel ID store. |
662 globals_->system_server_bound_cert_service.reset( | 662 globals_->system_channel_id_service.reset( |
663 new net::ServerBoundCertService( | 663 new net::ChannelIDService( |
664 new net::DefaultServerBoundCertStore(NULL), | 664 new net::DefaultChannelIDStore(NULL), |
665 base::WorkerPool::GetTaskRunner(true))); | 665 base::WorkerPool::GetTaskRunner(true))); |
666 globals_->dns_probe_service.reset(new chrome_browser_net::DnsProbeService()); | 666 globals_->dns_probe_service.reset(new chrome_browser_net::DnsProbeService()); |
667 globals_->host_mapping_rules.reset(new net::HostMappingRules()); | 667 globals_->host_mapping_rules.reset(new net::HostMappingRules()); |
668 globals_->http_user_agent_settings.reset( | 668 globals_->http_user_agent_settings.reset( |
669 new net::StaticHttpUserAgentSettings(std::string(), GetUserAgent())); | 669 new net::StaticHttpUserAgentSettings(std::string(), GetUserAgent())); |
670 if (command_line.HasSwitch(switches::kHostRules)) { | 670 if (command_line.HasSwitch(switches::kHostRules)) { |
671 TRACE_EVENT_BEGIN0("startup", "IOThread::InitAsync:SetRulesFromString"); | 671 TRACE_EVENT_BEGIN0("startup", "IOThread::InitAsync:SetRulesFromString"); |
672 globals_->host_mapping_rules->SetRulesFromString( | 672 globals_->host_mapping_rules->SetRulesFromString( |
673 command_line.GetSwitchValueASCII(switches::kHostRules)); | 673 command_line.GetSwitchValueASCII(switches::kHostRules)); |
674 TRACE_EVENT_END0("startup", "IOThread::InitAsync:SetRulesFromString"); | 674 TRACE_EVENT_END0("startup", "IOThread::InitAsync:SetRulesFromString"); |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 net::HttpNetworkSession::Params* params) { | 976 net::HttpNetworkSession::Params* params) { |
977 InitializeNetworkSessionParamsFromGlobals(*globals_, params); | 977 InitializeNetworkSessionParamsFromGlobals(*globals_, params); |
978 } | 978 } |
979 | 979 |
980 // static | 980 // static |
981 void IOThread::InitializeNetworkSessionParamsFromGlobals( | 981 void IOThread::InitializeNetworkSessionParamsFromGlobals( |
982 const IOThread::Globals& globals, | 982 const IOThread::Globals& globals, |
983 net::HttpNetworkSession::Params* params) { | 983 net::HttpNetworkSession::Params* params) { |
984 params->host_resolver = globals.host_resolver.get(); | 984 params->host_resolver = globals.host_resolver.get(); |
985 params->cert_verifier = globals.cert_verifier.get(); | 985 params->cert_verifier = globals.cert_verifier.get(); |
986 params->server_bound_cert_service = | 986 params->channel_id_service = globals.system_channel_id_service.get(); |
987 globals.system_server_bound_cert_service.get(); | |
988 params->transport_security_state = globals.transport_security_state.get(); | 987 params->transport_security_state = globals.transport_security_state.get(); |
989 params->ssl_config_service = globals.ssl_config_service.get(); | 988 params->ssl_config_service = globals.ssl_config_service.get(); |
990 params->http_auth_handler_factory = globals.http_auth_handler_factory.get(); | 989 params->http_auth_handler_factory = globals.http_auth_handler_factory.get(); |
991 params->http_server_properties = | 990 params->http_server_properties = |
992 globals.http_server_properties->GetWeakPtr(); | 991 globals.http_server_properties->GetWeakPtr(); |
993 params->network_delegate = globals.system_network_delegate.get(); | 992 params->network_delegate = globals.system_network_delegate.get(); |
994 params->host_mapping_rules = globals.host_mapping_rules.get(); | 993 params->host_mapping_rules = globals.host_mapping_rules.get(); |
995 params->ignore_certificate_errors = globals.ignore_certificate_errors; | 994 params->ignore_certificate_errors = globals.ignore_certificate_errors; |
996 params->testing_fixed_http_port = globals.testing_fixed_http_port; | 995 params->testing_fixed_http_port = globals.testing_fixed_http_port; |
997 params->testing_fixed_https_port = globals.testing_fixed_https_port; | 996 params->testing_fixed_https_port = globals.testing_fixed_https_port; |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1325 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1324 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
1326 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1325 for (size_t i = 0; i < supported_versions.size(); ++i) { |
1327 net::QuicVersion version = supported_versions[i]; | 1326 net::QuicVersion version = supported_versions[i]; |
1328 if (net::QuicVersionToString(version) == quic_version) { | 1327 if (net::QuicVersionToString(version) == quic_version) { |
1329 return version; | 1328 return version; |
1330 } | 1329 } |
1331 } | 1330 } |
1332 | 1331 |
1333 return net::QUIC_VERSION_UNSUPPORTED; | 1332 return net::QUIC_VERSION_UNSUPPORTED; |
1334 } | 1333 } |
OLD | NEW |