| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "net/base/cert_verifier.h" | 42 #include "net/base/cert_verifier.h" |
| 43 #include "net/base/default_server_bound_cert_store.h" | 43 #include "net/base/default_server_bound_cert_store.h" |
| 44 #include "net/base/host_cache.h" | 44 #include "net/base/host_cache.h" |
| 45 #include "net/base/host_mapping_rules.h" | 45 #include "net/base/host_mapping_rules.h" |
| 46 #include "net/base/host_resolver.h" | 46 #include "net/base/host_resolver.h" |
| 47 #include "net/base/mapped_host_resolver.h" | 47 #include "net/base/mapped_host_resolver.h" |
| 48 #include "net/base/net_util.h" | 48 #include "net/base/net_util.h" |
| 49 #include "net/base/sdch_manager.h" | 49 #include "net/base/sdch_manager.h" |
| 50 #include "net/base/server_bound_cert_service.h" | 50 #include "net/base/server_bound_cert_service.h" |
| 51 #include "net/cookies/cookie_monster.h" | 51 #include "net/cookies/cookie_monster.h" |
| 52 #include "net/ftp/ftp_network_layer.h" | |
| 53 #include "net/http/http_auth_filter.h" | 52 #include "net/http/http_auth_filter.h" |
| 54 #include "net/http/http_auth_handler_factory.h" | 53 #include "net/http/http_auth_handler_factory.h" |
| 55 #include "net/http/http_network_layer.h" | 54 #include "net/http/http_network_layer.h" |
| 56 #include "net/http/http_server_properties_impl.h" | 55 #include "net/http/http_server_properties_impl.h" |
| 57 #include "net/proxy/proxy_config_service.h" | 56 #include "net/proxy/proxy_config_service.h" |
| 58 #include "net/proxy/proxy_script_fetcher_impl.h" | 57 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 59 #include "net/proxy/proxy_service.h" | 58 #include "net/proxy/proxy_service.h" |
| 60 #include "net/spdy/spdy_session.h" | 59 #include "net/spdy/spdy_session.h" |
| 61 #include "net/url_request/url_fetcher.h" | 60 #include "net/url_request/url_fetcher.h" |
| 62 #include "net/url_request/url_request_throttler_manager.h" | 61 #include "net/url_request/url_request_throttler_manager.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 context->set_net_log(net_log); | 173 context->set_net_log(net_log); |
| 175 context->set_host_resolver(globals->host_resolver.get()); | 174 context->set_host_resolver(globals->host_resolver.get()); |
| 176 context->set_cert_verifier(globals->cert_verifier.get()); | 175 context->set_cert_verifier(globals->cert_verifier.get()); |
| 177 context->set_transport_security_state( | 176 context->set_transport_security_state( |
| 178 globals->transport_security_state.get()); | 177 globals->transport_security_state.get()); |
| 179 context->set_http_auth_handler_factory( | 178 context->set_http_auth_handler_factory( |
| 180 globals->http_auth_handler_factory.get()); | 179 globals->http_auth_handler_factory.get()); |
| 181 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); | 180 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); |
| 182 context->set_http_transaction_factory( | 181 context->set_http_transaction_factory( |
| 183 globals->proxy_script_fetcher_http_transaction_factory.get()); | 182 globals->proxy_script_fetcher_http_transaction_factory.get()); |
| 184 context->set_ftp_transaction_factory( | |
| 185 globals->proxy_script_fetcher_ftp_transaction_factory.get()); | |
| 186 context->set_cookie_store(globals->system_cookie_store.get()); | 183 context->set_cookie_store(globals->system_cookie_store.get()); |
| 187 context->set_server_bound_cert_service( | 184 context->set_server_bound_cert_service( |
| 188 globals->system_server_bound_cert_service.get()); | 185 globals->system_server_bound_cert_service.get()); |
| 189 context->set_network_delegate(globals->system_network_delegate.get()); | 186 context->set_network_delegate(globals->system_network_delegate.get()); |
| 190 context->set_http_user_agent_settings( | 187 context->set_http_user_agent_settings( |
| 191 globals->http_user_agent_settings.get()); | 188 globals->http_user_agent_settings.get()); |
| 192 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 189 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
| 193 // system URLRequestContext too. There's no reason this should be tied to a | 190 // system URLRequestContext too. There's no reason this should be tied to a |
| 194 // profile. | 191 // profile. |
| 195 return context; | 192 return context; |
| 196 } | 193 } |
| 197 | 194 |
| 198 net::URLRequestContext* | 195 net::URLRequestContext* |
| 199 ConstructSystemRequestContext(IOThread::Globals* globals, | 196 ConstructSystemRequestContext(IOThread::Globals* globals, |
| 200 net::NetLog* net_log) { | 197 net::NetLog* net_log) { |
| 201 net::URLRequestContext* context = new SystemURLRequestContext; | 198 net::URLRequestContext* context = new SystemURLRequestContext; |
| 202 context->set_net_log(net_log); | 199 context->set_net_log(net_log); |
| 203 context->set_host_resolver(globals->host_resolver.get()); | 200 context->set_host_resolver(globals->host_resolver.get()); |
| 204 context->set_cert_verifier(globals->cert_verifier.get()); | 201 context->set_cert_verifier(globals->cert_verifier.get()); |
| 205 context->set_transport_security_state( | 202 context->set_transport_security_state( |
| 206 globals->transport_security_state.get()); | 203 globals->transport_security_state.get()); |
| 207 context->set_http_auth_handler_factory( | 204 context->set_http_auth_handler_factory( |
| 208 globals->http_auth_handler_factory.get()); | 205 globals->http_auth_handler_factory.get()); |
| 209 context->set_proxy_service(globals->system_proxy_service.get()); | 206 context->set_proxy_service(globals->system_proxy_service.get()); |
| 210 context->set_http_transaction_factory( | 207 context->set_http_transaction_factory( |
| 211 globals->system_http_transaction_factory.get()); | 208 globals->system_http_transaction_factory.get()); |
| 212 context->set_ftp_transaction_factory( | |
| 213 globals->system_ftp_transaction_factory.get()); | |
| 214 context->set_cookie_store(globals->system_cookie_store.get()); | 209 context->set_cookie_store(globals->system_cookie_store.get()); |
| 215 context->set_server_bound_cert_service( | 210 context->set_server_bound_cert_service( |
| 216 globals->system_server_bound_cert_service.get()); | 211 globals->system_server_bound_cert_service.get()); |
| 217 context->set_throttler_manager(globals->throttler_manager.get()); | 212 context->set_throttler_manager(globals->throttler_manager.get()); |
| 218 context->set_network_delegate(globals->system_network_delegate.get()); | 213 context->set_network_delegate(globals->system_network_delegate.get()); |
| 219 context->set_http_user_agent_settings( | 214 context->set_http_user_agent_settings( |
| 220 globals->http_user_agent_settings.get()); | 215 globals->http_user_agent_settings.get()); |
| 221 return context; | 216 return context; |
| 222 } | 217 } |
| 223 | 218 |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 net::HttpNetworkSession::Params session_params; | 522 net::HttpNetworkSession::Params session_params; |
| 528 InitializeNetworkSessionParams(&session_params); | 523 InitializeNetworkSessionParams(&session_params); |
| 529 session_params.net_log = net_log_; | 524 session_params.net_log = net_log_; |
| 530 session_params.proxy_service = | 525 session_params.proxy_service = |
| 531 globals_->proxy_script_fetcher_proxy_service.get(); | 526 globals_->proxy_script_fetcher_proxy_service.get(); |
| 532 | 527 |
| 533 scoped_refptr<net::HttpNetworkSession> network_session( | 528 scoped_refptr<net::HttpNetworkSession> network_session( |
| 534 new net::HttpNetworkSession(session_params)); | 529 new net::HttpNetworkSession(session_params)); |
| 535 globals_->proxy_script_fetcher_http_transaction_factory.reset( | 530 globals_->proxy_script_fetcher_http_transaction_factory.reset( |
| 536 new net::HttpNetworkLayer(network_session)); | 531 new net::HttpNetworkLayer(network_session)); |
| 537 globals_->proxy_script_fetcher_ftp_transaction_factory.reset( | |
| 538 new net::FtpNetworkLayer(globals_->host_resolver.get())); | |
| 539 | 532 |
| 540 globals_->throttler_manager.reset(new net::URLRequestThrottlerManager()); | 533 globals_->throttler_manager.reset(new net::URLRequestThrottlerManager()); |
| 541 globals_->throttler_manager->set_net_log(net_log_); | 534 globals_->throttler_manager->set_net_log(net_log_); |
| 542 // Always done in production, disabled only for unit tests. | 535 // Always done in production, disabled only for unit tests. |
| 543 globals_->throttler_manager->set_enable_thread_checks(true); | 536 globals_->throttler_manager->set_enable_thread_checks(true); |
| 544 | 537 |
| 545 globals_->proxy_script_fetcher_context.reset( | 538 globals_->proxy_script_fetcher_context.reset( |
| 546 ConstructProxyScriptFetcherContext(globals_, net_log_)); | 539 ConstructProxyScriptFetcherContext(globals_, net_log_)); |
| 547 | 540 |
| 548 sdch_manager_ = new net::SdchManager(); | 541 sdch_manager_ = new net::SdchManager(); |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 command_line)); | 871 command_line)); |
| 879 | 872 |
| 880 net::HttpNetworkSession::Params system_params; | 873 net::HttpNetworkSession::Params system_params; |
| 881 InitializeNetworkSessionParams(&system_params); | 874 InitializeNetworkSessionParams(&system_params); |
| 882 system_params.net_log = net_log_; | 875 system_params.net_log = net_log_; |
| 883 system_params.proxy_service = globals_->system_proxy_service.get(); | 876 system_params.proxy_service = globals_->system_proxy_service.get(); |
| 884 | 877 |
| 885 globals_->system_http_transaction_factory.reset( | 878 globals_->system_http_transaction_factory.reset( |
| 886 new net::HttpNetworkLayer( | 879 new net::HttpNetworkLayer( |
| 887 new net::HttpNetworkSession(system_params))); | 880 new net::HttpNetworkSession(system_params))); |
| 888 globals_->system_ftp_transaction_factory.reset( | |
| 889 new net::FtpNetworkLayer(globals_->host_resolver.get())); | |
| 890 globals_->system_request_context.reset( | 881 globals_->system_request_context.reset( |
| 891 ConstructSystemRequestContext(globals_, net_log_)); | 882 ConstructSystemRequestContext(globals_, net_log_)); |
| 892 | 883 |
| 893 sdch_manager_->set_sdch_fetcher( | 884 sdch_manager_->set_sdch_fetcher( |
| 894 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); | 885 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); |
| 895 } | 886 } |
| 896 | 887 |
| 897 void IOThread::UpdateDnsClientEnabled() { | 888 void IOThread::UpdateDnsClientEnabled() { |
| 898 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); | 889 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); |
| 899 } | 890 } |
| OLD | NEW |