| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "net/cookies/cookie_monster.h" | 45 #include "net/cookies/cookie_monster.h" |
| 46 #include "net/ftp/ftp_network_layer.h" | 46 #include "net/ftp/ftp_network_layer.h" |
| 47 #include "net/http/http_auth_filter.h" | 47 #include "net/http/http_auth_filter.h" |
| 48 #include "net/http/http_auth_handler_factory.h" | 48 #include "net/http/http_auth_handler_factory.h" |
| 49 #include "net/http/http_network_layer.h" | 49 #include "net/http/http_network_layer.h" |
| 50 #include "net/http/http_network_session.h" | 50 #include "net/http/http_network_session.h" |
| 51 #include "net/http/http_server_properties_impl.h" | 51 #include "net/http/http_server_properties_impl.h" |
| 52 #include "net/proxy/proxy_config_service.h" | 52 #include "net/proxy/proxy_config_service.h" |
| 53 #include "net/proxy/proxy_script_fetcher_impl.h" | 53 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 54 #include "net/proxy/proxy_service.h" | 54 #include "net/proxy/proxy_service.h" |
| 55 #include "net/url_request/url_request_throttler_manager.h" |
| 55 | 56 |
| 56 #if defined(USE_NSS) | 57 #if defined(USE_NSS) |
| 57 #include "net/ocsp/nss_ocsp.h" | 58 #include "net/ocsp/nss_ocsp.h" |
| 58 #endif // defined(USE_NSS) | 59 #endif // defined(USE_NSS) |
| 59 | 60 |
| 60 #if defined(OS_CHROMEOS) | 61 #if defined(OS_CHROMEOS) |
| 61 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 62 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
| 62 #endif // defined(OS_CHROMEOS) | 63 #endif // defined(OS_CHROMEOS) |
| 63 | 64 |
| 64 using content::BrowserThread; | 65 using content::BrowserThread; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 context->set_http_auth_handler_factory( | 238 context->set_http_auth_handler_factory( |
| 238 globals->http_auth_handler_factory.get()); | 239 globals->http_auth_handler_factory.get()); |
| 239 context->set_proxy_service(globals->system_proxy_service.get()); | 240 context->set_proxy_service(globals->system_proxy_service.get()); |
| 240 context->set_http_transaction_factory( | 241 context->set_http_transaction_factory( |
| 241 globals->system_http_transaction_factory.get()); | 242 globals->system_http_transaction_factory.get()); |
| 242 context->set_ftp_transaction_factory( | 243 context->set_ftp_transaction_factory( |
| 243 globals->system_ftp_transaction_factory.get()); | 244 globals->system_ftp_transaction_factory.get()); |
| 244 context->set_cookie_store(globals->system_cookie_store.get()); | 245 context->set_cookie_store(globals->system_cookie_store.get()); |
| 245 context->set_server_bound_cert_service( | 246 context->set_server_bound_cert_service( |
| 246 globals->system_server_bound_cert_service.get()); | 247 globals->system_server_bound_cert_service.get()); |
| 248 context->set_throttler_manager(globals->throttler_manager.get()); |
| 247 return context; | 249 return context; |
| 248 } | 250 } |
| 249 | 251 |
| 250 } // namespace | 252 } // namespace |
| 251 | 253 |
| 252 class SystemURLRequestContextGetter : public net::URLRequestContextGetter { | 254 class SystemURLRequestContextGetter : public net::URLRequestContextGetter { |
| 253 public: | 255 public: |
| 254 explicit SystemURLRequestContextGetter(IOThread* io_thread); | 256 explicit SystemURLRequestContextGetter(IOThread* io_thread); |
| 255 | 257 |
| 256 // Implementation for net::UrlRequestContextGetter. | 258 // Implementation for net::UrlRequestContextGetter. |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 globals_->http_server_properties.get(); | 438 globals_->http_server_properties.get(); |
| 437 session_params.net_log = net_log_; | 439 session_params.net_log = net_log_; |
| 438 session_params.ssl_config_service = globals_->ssl_config_service; | 440 session_params.ssl_config_service = globals_->ssl_config_service; |
| 439 scoped_refptr<net::HttpNetworkSession> network_session( | 441 scoped_refptr<net::HttpNetworkSession> network_session( |
| 440 new net::HttpNetworkSession(session_params)); | 442 new net::HttpNetworkSession(session_params)); |
| 441 globals_->proxy_script_fetcher_http_transaction_factory.reset( | 443 globals_->proxy_script_fetcher_http_transaction_factory.reset( |
| 442 new net::HttpNetworkLayer(network_session)); | 444 new net::HttpNetworkLayer(network_session)); |
| 443 globals_->proxy_script_fetcher_ftp_transaction_factory.reset( | 445 globals_->proxy_script_fetcher_ftp_transaction_factory.reset( |
| 444 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 446 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
| 445 | 447 |
| 448 globals_->throttler_manager.reset(new net::URLRequestThrottlerManager()); |
| 449 // Always done in production, disabled only for unit tests. |
| 450 globals_->throttler_manager->set_enable_thread_checks(true); |
| 451 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 452 switches::kDisableExtensionsHttpThrottling)) { |
| 453 globals_->throttler_manager->set_enforce_throttling(false); |
| 454 } |
| 455 globals_->throttler_manager->set_net_log(net_log_); |
| 456 |
| 446 globals_->proxy_script_fetcher_context = | 457 globals_->proxy_script_fetcher_context = |
| 447 ConstructProxyScriptFetcherContext(globals_, net_log_); | 458 ConstructProxyScriptFetcherContext(globals_, net_log_); |
| 448 | 459 |
| 449 sdch_manager_ = new net::SdchManager(); | 460 sdch_manager_ = new net::SdchManager(); |
| 450 | 461 |
| 451 // InitSystemRequestContext turns right around and posts a task back | 462 // InitSystemRequestContext turns right around and posts a task back |
| 452 // to the IO thread, so we can't let it run until we know the IO | 463 // to the IO thread, so we can't let it run until we know the IO |
| 453 // thread has started. | 464 // thread has started. |
| 454 // | 465 // |
| 455 // Note that since we are at BrowserThread::Init time, the UI thread | 466 // Note that since we are at BrowserThread::Init time, the UI thread |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 new net::HttpNetworkLayer( | 622 new net::HttpNetworkLayer( |
| 612 new net::HttpNetworkSession(system_params))); | 623 new net::HttpNetworkSession(system_params))); |
| 613 globals_->system_ftp_transaction_factory.reset( | 624 globals_->system_ftp_transaction_factory.reset( |
| 614 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 625 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
| 615 globals_->system_request_context = | 626 globals_->system_request_context = |
| 616 ConstructSystemRequestContext(globals_, net_log_); | 627 ConstructSystemRequestContext(globals_, net_log_); |
| 617 | 628 |
| 618 sdch_manager_->set_sdch_fetcher( | 629 sdch_manager_->set_sdch_fetcher( |
| 619 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); | 630 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); |
| 620 } | 631 } |
| OLD | NEW |