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