OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/leak_tracker.h" | 10 #include "base/debug/leak_tracker.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "chrome/browser/net/proxy_service_factory.h" | 29 #include "chrome/browser/net/proxy_service_factory.h" |
30 #include "chrome/browser/prefs/pref_service.h" | 30 #include "chrome/browser/prefs/pref_service.h" |
31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
33 #include "content/browser/browser_thread.h" | 33 #include "content/browser/browser_thread.h" |
34 #include "content/browser/gpu/gpu_process_host.h" | 34 #include "content/browser/gpu/gpu_process_host.h" |
35 #include "content/browser/in_process_webkit/indexed_db_key_utility_client.h" | 35 #include "content/browser/in_process_webkit/indexed_db_key_utility_client.h" |
36 #include "content/common/url_fetcher.h" | 36 #include "content/common/url_fetcher.h" |
37 #include "net/base/cert_verifier.h" | 37 #include "net/base/cert_verifier.h" |
38 #include "net/base/cookie_monster.h" | 38 #include "net/base/cookie_monster.h" |
| 39 #include "net/base/default_origin_bound_cert_store.h" |
39 #include "net/base/dnsrr_resolver.h" | 40 #include "net/base/dnsrr_resolver.h" |
40 #include "net/base/host_cache.h" | 41 #include "net/base/host_cache.h" |
41 #include "net/base/host_resolver.h" | 42 #include "net/base/host_resolver.h" |
42 #include "net/base/host_resolver_impl.h" | 43 #include "net/base/host_resolver_impl.h" |
43 #include "net/base/mapped_host_resolver.h" | 44 #include "net/base/mapped_host_resolver.h" |
44 #include "net/base/net_util.h" | 45 #include "net/base/net_util.h" |
| 46 #include "net/base/origin_bound_cert_service.h" |
45 #include "net/dns/async_host_resolver.h" | 47 #include "net/dns/async_host_resolver.h" |
46 #include "net/ftp/ftp_network_layer.h" | 48 #include "net/ftp/ftp_network_layer.h" |
47 #include "net/http/http_auth_filter.h" | 49 #include "net/http/http_auth_filter.h" |
48 #include "net/http/http_auth_handler_factory.h" | 50 #include "net/http/http_auth_handler_factory.h" |
49 #include "net/http/http_network_layer.h" | 51 #include "net/http/http_network_layer.h" |
50 #include "net/http/http_network_session.h" | 52 #include "net/http/http_network_session.h" |
51 #include "net/proxy/proxy_config_service.h" | 53 #include "net/proxy/proxy_config_service.h" |
52 #include "net/proxy/proxy_script_fetcher_impl.h" | 54 #include "net/proxy/proxy_script_fetcher_impl.h" |
53 #include "net/proxy/proxy_service.h" | 55 #include "net/proxy/proxy_service.h" |
54 #include "net/socket/dns_cert_provenance_checker.h" | 56 #include "net/socket/dns_cert_provenance_checker.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 context->set_host_resolver(globals->host_resolver.get()); | 248 context->set_host_resolver(globals->host_resolver.get()); |
247 context->set_cert_verifier(globals->cert_verifier.get()); | 249 context->set_cert_verifier(globals->cert_verifier.get()); |
248 context->set_dnsrr_resolver(globals->dnsrr_resolver.get()); | 250 context->set_dnsrr_resolver(globals->dnsrr_resolver.get()); |
249 context->set_http_auth_handler_factory( | 251 context->set_http_auth_handler_factory( |
250 globals->http_auth_handler_factory.get()); | 252 globals->http_auth_handler_factory.get()); |
251 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); | 253 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); |
252 context->set_http_transaction_factory( | 254 context->set_http_transaction_factory( |
253 globals->proxy_script_fetcher_http_transaction_factory.get()); | 255 globals->proxy_script_fetcher_http_transaction_factory.get()); |
254 context->set_ftp_transaction_factory( | 256 context->set_ftp_transaction_factory( |
255 globals->proxy_script_fetcher_ftp_transaction_factory.get()); | 257 globals->proxy_script_fetcher_ftp_transaction_factory.get()); |
256 // In-memory cookie store. | 258 context->set_cookie_store(globals->system_cookie_store.get()); |
257 context->set_cookie_store(new net::CookieMonster(NULL, NULL)); | 259 context->set_origin_bound_cert_service( |
| 260 globals->system_origin_bound_cert_service.get()); |
258 context->set_network_delegate(globals->system_network_delegate.get()); | 261 context->set_network_delegate(globals->system_network_delegate.get()); |
259 return context; | 262 return context; |
260 } | 263 } |
261 | 264 |
262 scoped_refptr<net::URLRequestContext> | 265 scoped_refptr<net::URLRequestContext> |
263 ConstructSystemRequestContext(IOThread::Globals* globals, | 266 ConstructSystemRequestContext(IOThread::Globals* globals, |
264 net::NetLog* net_log) { | 267 net::NetLog* net_log) { |
265 scoped_refptr<net::URLRequestContext> context( | 268 scoped_refptr<net::URLRequestContext> context( |
266 new SystemURLRequestContext); | 269 new SystemURLRequestContext); |
267 context->set_net_log(net_log); | 270 context->set_net_log(net_log); |
268 context->set_host_resolver(globals->host_resolver.get()); | 271 context->set_host_resolver(globals->host_resolver.get()); |
269 context->set_cert_verifier(globals->cert_verifier.get()); | 272 context->set_cert_verifier(globals->cert_verifier.get()); |
270 context->set_dnsrr_resolver(globals->dnsrr_resolver.get()); | 273 context->set_dnsrr_resolver(globals->dnsrr_resolver.get()); |
271 context->set_http_auth_handler_factory( | 274 context->set_http_auth_handler_factory( |
272 globals->http_auth_handler_factory.get()); | 275 globals->http_auth_handler_factory.get()); |
273 context->set_proxy_service(globals->system_proxy_service.get()); | 276 context->set_proxy_service(globals->system_proxy_service.get()); |
274 context->set_http_transaction_factory( | 277 context->set_http_transaction_factory( |
275 globals->system_http_transaction_factory.get()); | 278 globals->system_http_transaction_factory.get()); |
276 context->set_ftp_transaction_factory( | 279 context->set_ftp_transaction_factory( |
277 globals->system_ftp_transaction_factory.get()); | 280 globals->system_ftp_transaction_factory.get()); |
278 // In-memory cookie store. | 281 context->set_cookie_store(globals->system_cookie_store.get()); |
279 context->set_cookie_store(new net::CookieMonster(NULL, NULL)); | 282 context->set_origin_bound_cert_service( |
| 283 globals->system_origin_bound_cert_service.get()); |
280 return context; | 284 return context; |
281 } | 285 } |
282 | 286 |
283 } // namespace | 287 } // namespace |
284 | 288 |
285 class SystemURLRequestContextGetter : public net::URLRequestContextGetter { | 289 class SystemURLRequestContextGetter : public net::URLRequestContextGetter { |
286 public: | 290 public: |
287 explicit SystemURLRequestContextGetter(IOThread* io_thread); | 291 explicit SystemURLRequestContextGetter(IOThread* io_thread); |
288 virtual ~SystemURLRequestContextGetter(); | 292 virtual ~SystemURLRequestContextGetter(); |
289 | 293 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 globals_->host_resolver.reset( | 489 globals_->host_resolver.reset( |
486 CreateGlobalHostResolver(net_log_)); | 490 CreateGlobalHostResolver(net_log_)); |
487 globals_->cert_verifier.reset(new net::CertVerifier); | 491 globals_->cert_verifier.reset(new net::CertVerifier); |
488 globals_->dnsrr_resolver.reset(new net::DnsRRResolver); | 492 globals_->dnsrr_resolver.reset(new net::DnsRRResolver); |
489 globals_->ssl_config_service = GetSSLConfigService(); | 493 globals_->ssl_config_service = GetSSLConfigService(); |
490 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( | 494 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( |
491 globals_->host_resolver.get())); | 495 globals_->host_resolver.get())); |
492 // For the ProxyScriptFetcher, we use a direct ProxyService. | 496 // For the ProxyScriptFetcher, we use a direct ProxyService. |
493 globals_->proxy_script_fetcher_proxy_service.reset( | 497 globals_->proxy_script_fetcher_proxy_service.reset( |
494 net::ProxyService::CreateDirectWithNetLog(net_log_)); | 498 net::ProxyService::CreateDirectWithNetLog(net_log_)); |
| 499 // In-memory cookie store. |
| 500 globals_->system_cookie_store = new net::CookieMonster(NULL, NULL); |
| 501 // In-memory origin-bound cert store. |
| 502 globals_->system_origin_bound_cert_service.reset( |
| 503 new net::OriginBoundCertService( |
| 504 new net::DefaultOriginBoundCertStore(NULL))); |
495 net::HttpNetworkSession::Params session_params; | 505 net::HttpNetworkSession::Params session_params; |
496 session_params.host_resolver = globals_->host_resolver.get(); | 506 session_params.host_resolver = globals_->host_resolver.get(); |
497 session_params.cert_verifier = globals_->cert_verifier.get(); | 507 session_params.cert_verifier = globals_->cert_verifier.get(); |
| 508 session_params.origin_bound_cert_service = |
| 509 globals_->system_origin_bound_cert_service.get(); |
498 session_params.proxy_service = | 510 session_params.proxy_service = |
499 globals_->proxy_script_fetcher_proxy_service.get(); | 511 globals_->proxy_script_fetcher_proxy_service.get(); |
500 session_params.http_auth_handler_factory = | 512 session_params.http_auth_handler_factory = |
501 globals_->http_auth_handler_factory.get(); | 513 globals_->http_auth_handler_factory.get(); |
502 session_params.network_delegate = globals_->system_network_delegate.get(); | 514 session_params.network_delegate = globals_->system_network_delegate.get(); |
503 session_params.net_log = net_log_; | 515 session_params.net_log = net_log_; |
504 session_params.ssl_config_service = globals_->ssl_config_service; | 516 session_params.ssl_config_service = globals_->ssl_config_service; |
505 scoped_refptr<net::HttpNetworkSession> network_session( | 517 scoped_refptr<net::HttpNetworkSession> network_session( |
506 new net::HttpNetworkSession(session_params)); | 518 new net::HttpNetworkSession(session_params)); |
507 globals_->proxy_script_fetcher_http_transaction_factory.reset( | 519 globals_->proxy_script_fetcher_http_transaction_factory.reset( |
508 new net::HttpNetworkLayer(network_session)); | 520 new net::HttpNetworkLayer(network_session)); |
509 globals_->proxy_script_fetcher_ftp_transaction_factory.reset( | 521 globals_->proxy_script_fetcher_ftp_transaction_factory.reset( |
510 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 522 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
511 | 523 |
512 scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context = | 524 globals_->proxy_script_fetcher_context = |
513 ConstructProxyScriptFetcherContext(globals_, net_log_); | 525 ConstructProxyScriptFetcherContext(globals_, net_log_); |
514 globals_->proxy_script_fetcher_context = proxy_script_fetcher_context; | |
515 } | 526 } |
516 | 527 |
517 void IOThread::CleanUp() { | 528 void IOThread::CleanUp() { |
518 // Step 1: Kill all things that might be holding onto | 529 // Step 1: Kill all things that might be holding onto |
519 // net::URLRequest/net::URLRequestContexts. | 530 // net::URLRequest/net::URLRequestContexts. |
520 | 531 |
521 #if defined(USE_NSS) | 532 #if defined(USE_NSS) |
522 net::ShutdownOCSP(); | 533 net::ShutdownOCSP(); |
523 #endif // defined(USE_NSS) | 534 #endif // defined(USE_NSS) |
524 | 535 |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 722 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
712 globals_->system_proxy_service.reset( | 723 globals_->system_proxy_service.reset( |
713 ProxyServiceFactory::CreateProxyService( | 724 ProxyServiceFactory::CreateProxyService( |
714 net_log_, | 725 net_log_, |
715 globals_->proxy_script_fetcher_context, | 726 globals_->proxy_script_fetcher_context, |
716 system_proxy_config_service_.release(), | 727 system_proxy_config_service_.release(), |
717 command_line)); | 728 command_line)); |
718 net::HttpNetworkSession::Params system_params; | 729 net::HttpNetworkSession::Params system_params; |
719 system_params.host_resolver = globals_->host_resolver.get(); | 730 system_params.host_resolver = globals_->host_resolver.get(); |
720 system_params.cert_verifier = globals_->cert_verifier.get(); | 731 system_params.cert_verifier = globals_->cert_verifier.get(); |
| 732 system_params.origin_bound_cert_service = |
| 733 globals_->system_origin_bound_cert_service.get(); |
721 system_params.dnsrr_resolver = globals_->dnsrr_resolver.get(); | 734 system_params.dnsrr_resolver = globals_->dnsrr_resolver.get(); |
722 system_params.dns_cert_checker = NULL; | 735 system_params.dns_cert_checker = NULL; |
723 system_params.ssl_host_info_factory = NULL; | 736 system_params.ssl_host_info_factory = NULL; |
724 system_params.proxy_service = globals_->system_proxy_service.get(); | 737 system_params.proxy_service = globals_->system_proxy_service.get(); |
725 system_params.ssl_config_service = globals_->ssl_config_service.get(); | 738 system_params.ssl_config_service = globals_->ssl_config_service.get(); |
726 system_params.http_auth_handler_factory = | 739 system_params.http_auth_handler_factory = |
727 globals_->http_auth_handler_factory.get(); | 740 globals_->http_auth_handler_factory.get(); |
728 system_params.network_delegate = globals_->system_network_delegate.get(); | 741 system_params.network_delegate = globals_->system_network_delegate.get(); |
729 system_params.net_log = net_log_; | 742 system_params.net_log = net_log_; |
730 globals_->system_http_transaction_factory.reset( | 743 globals_->system_http_transaction_factory.reset( |
731 new net::HttpNetworkLayer( | 744 new net::HttpNetworkLayer( |
732 new net::HttpNetworkSession(system_params))); | 745 new net::HttpNetworkSession(system_params))); |
733 globals_->system_ftp_transaction_factory.reset( | 746 globals_->system_ftp_transaction_factory.reset( |
734 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 747 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
735 globals_->system_request_context = | 748 globals_->system_request_context = |
736 ConstructSystemRequestContext(globals_, net_log_); | 749 ConstructSystemRequestContext(globals_, net_log_); |
737 } | 750 } |
OLD | NEW |