| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "content/public/browser/browser_thread.h" | 43 #include "content/public/browser/browser_thread.h" |
| 44 #include "net/base/host_mapping_rules.h" | 44 #include "net/base/host_mapping_rules.h" |
| 45 #include "net/base/net_util.h" | 45 #include "net/base/net_util.h" |
| 46 #include "net/base/network_time_notifier.h" | 46 #include "net/base/network_time_notifier.h" |
| 47 #include "net/base/sdch_manager.h" | 47 #include "net/base/sdch_manager.h" |
| 48 #include "net/cert/cert_verifier.h" | 48 #include "net/cert/cert_verifier.h" |
| 49 #include "net/cookies/cookie_monster.h" | 49 #include "net/cookies/cookie_monster.h" |
| 50 #include "net/dns/host_cache.h" | 50 #include "net/dns/host_cache.h" |
| 51 #include "net/dns/host_resolver.h" | 51 #include "net/dns/host_resolver.h" |
| 52 #include "net/dns/mapped_host_resolver.h" | 52 #include "net/dns/mapped_host_resolver.h" |
| 53 #include "net/ftp/ftp_network_layer.h" | |
| 54 #include "net/http/http_auth_filter.h" | 53 #include "net/http/http_auth_filter.h" |
| 55 #include "net/http/http_auth_handler_factory.h" | 54 #include "net/http/http_auth_handler_factory.h" |
| 56 #include "net/http/http_network_layer.h" | 55 #include "net/http/http_network_layer.h" |
| 57 #include "net/http/http_server_properties_impl.h" | 56 #include "net/http/http_server_properties_impl.h" |
| 58 #include "net/proxy/proxy_config_service.h" | 57 #include "net/proxy/proxy_config_service.h" |
| 59 #include "net/proxy/proxy_script_fetcher_impl.h" | 58 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 60 #include "net/proxy/proxy_service.h" | 59 #include "net/proxy/proxy_service.h" |
| 61 #include "net/socket/tcp_client_socket.h" | 60 #include "net/socket/tcp_client_socket.h" |
| 62 #include "net/spdy/spdy_session.h" | 61 #include "net/spdy/spdy_session.h" |
| 63 #include "net/ssl/default_server_bound_cert_store.h" | 62 #include "net/ssl/default_server_bound_cert_store.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 context->set_net_log(net_log); | 181 context->set_net_log(net_log); |
| 183 context->set_host_resolver(globals->host_resolver.get()); | 182 context->set_host_resolver(globals->host_resolver.get()); |
| 184 context->set_cert_verifier(globals->cert_verifier.get()); | 183 context->set_cert_verifier(globals->cert_verifier.get()); |
| 185 context->set_transport_security_state( | 184 context->set_transport_security_state( |
| 186 globals->transport_security_state.get()); | 185 globals->transport_security_state.get()); |
| 187 context->set_http_auth_handler_factory( | 186 context->set_http_auth_handler_factory( |
| 188 globals->http_auth_handler_factory.get()); | 187 globals->http_auth_handler_factory.get()); |
| 189 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); | 188 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); |
| 190 context->set_http_transaction_factory( | 189 context->set_http_transaction_factory( |
| 191 globals->proxy_script_fetcher_http_transaction_factory.get()); | 190 globals->proxy_script_fetcher_http_transaction_factory.get()); |
| 192 context->set_ftp_transaction_factory( | |
| 193 globals->proxy_script_fetcher_ftp_transaction_factory.get()); | |
| 194 context->set_cookie_store(globals->system_cookie_store.get()); | 191 context->set_cookie_store(globals->system_cookie_store.get()); |
| 195 context->set_server_bound_cert_service( | 192 context->set_server_bound_cert_service( |
| 196 globals->system_server_bound_cert_service.get()); | 193 globals->system_server_bound_cert_service.get()); |
| 197 context->set_network_delegate(globals->system_network_delegate.get()); | 194 context->set_network_delegate(globals->system_network_delegate.get()); |
| 198 context->set_http_user_agent_settings( | 195 context->set_http_user_agent_settings( |
| 199 globals->http_user_agent_settings.get()); | 196 globals->http_user_agent_settings.get()); |
| 200 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 197 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
| 201 // system URLRequestContext too. There's no reason this should be tied to a | 198 // system URLRequestContext too. There's no reason this should be tied to a |
| 202 // profile. | 199 // profile. |
| 203 return context; | 200 return context; |
| 204 } | 201 } |
| 205 | 202 |
| 206 net::URLRequestContext* | 203 net::URLRequestContext* |
| 207 ConstructSystemRequestContext(IOThread::Globals* globals, | 204 ConstructSystemRequestContext(IOThread::Globals* globals, |
| 208 net::NetLog* net_log) { | 205 net::NetLog* net_log) { |
| 209 net::URLRequestContext* context = new SystemURLRequestContext; | 206 net::URLRequestContext* context = new SystemURLRequestContext; |
| 210 context->set_net_log(net_log); | 207 context->set_net_log(net_log); |
| 211 context->set_host_resolver(globals->host_resolver.get()); | 208 context->set_host_resolver(globals->host_resolver.get()); |
| 212 context->set_cert_verifier(globals->cert_verifier.get()); | 209 context->set_cert_verifier(globals->cert_verifier.get()); |
| 213 context->set_transport_security_state( | 210 context->set_transport_security_state( |
| 214 globals->transport_security_state.get()); | 211 globals->transport_security_state.get()); |
| 215 context->set_http_auth_handler_factory( | 212 context->set_http_auth_handler_factory( |
| 216 globals->http_auth_handler_factory.get()); | 213 globals->http_auth_handler_factory.get()); |
| 217 context->set_proxy_service(globals->system_proxy_service.get()); | 214 context->set_proxy_service(globals->system_proxy_service.get()); |
| 218 context->set_http_transaction_factory( | 215 context->set_http_transaction_factory( |
| 219 globals->system_http_transaction_factory.get()); | 216 globals->system_http_transaction_factory.get()); |
| 220 context->set_ftp_transaction_factory( | |
| 221 globals->system_ftp_transaction_factory.get()); | |
| 222 context->set_cookie_store(globals->system_cookie_store.get()); | 217 context->set_cookie_store(globals->system_cookie_store.get()); |
| 223 context->set_server_bound_cert_service( | 218 context->set_server_bound_cert_service( |
| 224 globals->system_server_bound_cert_service.get()); | 219 globals->system_server_bound_cert_service.get()); |
| 225 context->set_throttler_manager(globals->throttler_manager.get()); | 220 context->set_throttler_manager(globals->throttler_manager.get()); |
| 226 context->set_network_delegate(globals->system_network_delegate.get()); | 221 context->set_network_delegate(globals->system_network_delegate.get()); |
| 227 context->set_http_user_agent_settings( | 222 context->set_http_user_agent_settings( |
| 228 globals->http_user_agent_settings.get()); | 223 globals->http_user_agent_settings.get()); |
| 229 return context; | 224 return context; |
| 230 } | 225 } |
| 231 | 226 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 net::HttpNetworkSession::Params session_params; | 540 net::HttpNetworkSession::Params session_params; |
| 546 InitializeNetworkSessionParams(&session_params); | 541 InitializeNetworkSessionParams(&session_params); |
| 547 session_params.net_log = net_log_; | 542 session_params.net_log = net_log_; |
| 548 session_params.proxy_service = | 543 session_params.proxy_service = |
| 549 globals_->proxy_script_fetcher_proxy_service.get(); | 544 globals_->proxy_script_fetcher_proxy_service.get(); |
| 550 | 545 |
| 551 scoped_refptr<net::HttpNetworkSession> network_session( | 546 scoped_refptr<net::HttpNetworkSession> network_session( |
| 552 new net::HttpNetworkSession(session_params)); | 547 new net::HttpNetworkSession(session_params)); |
| 553 globals_->proxy_script_fetcher_http_transaction_factory.reset( | 548 globals_->proxy_script_fetcher_http_transaction_factory.reset( |
| 554 new net::HttpNetworkLayer(network_session)); | 549 new net::HttpNetworkLayer(network_session)); |
| 555 globals_->proxy_script_fetcher_ftp_transaction_factory.reset( | |
| 556 new net::FtpNetworkLayer(globals_->host_resolver.get())); | |
| 557 | 550 |
| 558 globals_->throttler_manager.reset(new net::URLRequestThrottlerManager()); | 551 globals_->throttler_manager.reset(new net::URLRequestThrottlerManager()); |
| 559 globals_->throttler_manager->set_net_log(net_log_); | 552 globals_->throttler_manager->set_net_log(net_log_); |
| 560 // Always done in production, disabled only for unit tests. | 553 // Always done in production, disabled only for unit tests. |
| 561 globals_->throttler_manager->set_enable_thread_checks(true); | 554 globals_->throttler_manager->set_enable_thread_checks(true); |
| 562 | 555 |
| 563 globals_->proxy_script_fetcher_context.reset( | 556 globals_->proxy_script_fetcher_context.reset( |
| 564 ConstructProxyScriptFetcherContext(globals_, net_log_)); | 557 ConstructProxyScriptFetcherContext(globals_, net_log_)); |
| 565 | 558 |
| 566 globals_->network_time_notifier.reset( | 559 globals_->network_time_notifier.reset( |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 command_line)); | 903 command_line)); |
| 911 | 904 |
| 912 net::HttpNetworkSession::Params system_params; | 905 net::HttpNetworkSession::Params system_params; |
| 913 InitializeNetworkSessionParams(&system_params); | 906 InitializeNetworkSessionParams(&system_params); |
| 914 system_params.net_log = net_log_; | 907 system_params.net_log = net_log_; |
| 915 system_params.proxy_service = globals_->system_proxy_service.get(); | 908 system_params.proxy_service = globals_->system_proxy_service.get(); |
| 916 | 909 |
| 917 globals_->system_http_transaction_factory.reset( | 910 globals_->system_http_transaction_factory.reset( |
| 918 new net::HttpNetworkLayer( | 911 new net::HttpNetworkLayer( |
| 919 new net::HttpNetworkSession(system_params))); | 912 new net::HttpNetworkSession(system_params))); |
| 920 globals_->system_ftp_transaction_factory.reset( | |
| 921 new net::FtpNetworkLayer(globals_->host_resolver.get())); | |
| 922 globals_->system_request_context.reset( | 913 globals_->system_request_context.reset( |
| 923 ConstructSystemRequestContext(globals_, net_log_)); | 914 ConstructSystemRequestContext(globals_, net_log_)); |
| 924 | 915 |
| 925 sdch_manager_->set_sdch_fetcher( | 916 sdch_manager_->set_sdch_fetcher( |
| 926 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); | 917 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); |
| 927 } | 918 } |
| 928 | 919 |
| 929 void IOThread::UpdateDnsClientEnabled() { | 920 void IOThread::UpdateDnsClientEnabled() { |
| 930 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); | 921 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); |
| 931 } | 922 } |
| OLD | NEW |