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 "net/base/cert_verifier.h" | 43 #include "net/base/cert_verifier.h" |
44 #include "net/base/default_server_bound_cert_store.h" | 44 #include "net/base/default_server_bound_cert_store.h" |
45 #include "net/base/host_cache.h" | 45 #include "net/base/host_cache.h" |
46 #include "net/base/host_mapping_rules.h" | 46 #include "net/base/host_mapping_rules.h" |
47 #include "net/base/host_resolver.h" | 47 #include "net/base/host_resolver.h" |
48 #include "net/base/mapped_host_resolver.h" | 48 #include "net/base/mapped_host_resolver.h" |
49 #include "net/base/net_util.h" | 49 #include "net/base/net_util.h" |
50 #include "net/base/sdch_manager.h" | 50 #include "net/base/sdch_manager.h" |
51 #include "net/base/server_bound_cert_service.h" | 51 #include "net/base/server_bound_cert_service.h" |
52 #include "net/cookies/cookie_monster.h" | 52 #include "net/cookies/cookie_monster.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/spdy/spdy_session.h" | 60 #include "net/spdy/spdy_session.h" |
62 #include "net/url_request/url_fetcher.h" | 61 #include "net/url_request/url_fetcher.h" |
63 #include "net/url_request/url_request_throttler_manager.h" | 62 #include "net/url_request/url_request_throttler_manager.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 context->set_net_log(net_log); | 178 context->set_net_log(net_log); |
180 context->set_host_resolver(globals->host_resolver.get()); | 179 context->set_host_resolver(globals->host_resolver.get()); |
181 context->set_cert_verifier(globals->cert_verifier.get()); | 180 context->set_cert_verifier(globals->cert_verifier.get()); |
182 context->set_transport_security_state( | 181 context->set_transport_security_state( |
183 globals->transport_security_state.get()); | 182 globals->transport_security_state.get()); |
184 context->set_http_auth_handler_factory( | 183 context->set_http_auth_handler_factory( |
185 globals->http_auth_handler_factory.get()); | 184 globals->http_auth_handler_factory.get()); |
186 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); | 185 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); |
187 context->set_http_transaction_factory( | 186 context->set_http_transaction_factory( |
188 globals->proxy_script_fetcher_http_transaction_factory.get()); | 187 globals->proxy_script_fetcher_http_transaction_factory.get()); |
189 context->set_ftp_transaction_factory( | |
190 globals->proxy_script_fetcher_ftp_transaction_factory.get()); | |
191 context->set_cookie_store(globals->system_cookie_store.get()); | 188 context->set_cookie_store(globals->system_cookie_store.get()); |
192 context->set_server_bound_cert_service( | 189 context->set_server_bound_cert_service( |
193 globals->system_server_bound_cert_service.get()); | 190 globals->system_server_bound_cert_service.get()); |
194 context->set_network_delegate(globals->system_network_delegate.get()); | 191 context->set_network_delegate(globals->system_network_delegate.get()); |
195 context->set_http_user_agent_settings( | 192 context->set_http_user_agent_settings( |
196 globals->http_user_agent_settings.get()); | 193 globals->http_user_agent_settings.get()); |
197 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 194 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
198 // system URLRequestContext too. There's no reason this should be tied to a | 195 // system URLRequestContext too. There's no reason this should be tied to a |
199 // profile. | 196 // profile. |
200 return context; | 197 return context; |
201 } | 198 } |
202 | 199 |
203 net::URLRequestContext* | 200 net::URLRequestContext* |
204 ConstructSystemRequestContext(IOThread::Globals* globals, | 201 ConstructSystemRequestContext(IOThread::Globals* globals, |
205 net::NetLog* net_log) { | 202 net::NetLog* net_log) { |
206 net::URLRequestContext* context = new SystemURLRequestContext; | 203 net::URLRequestContext* context = new SystemURLRequestContext; |
207 context->set_net_log(net_log); | 204 context->set_net_log(net_log); |
208 context->set_host_resolver(globals->host_resolver.get()); | 205 context->set_host_resolver(globals->host_resolver.get()); |
209 context->set_cert_verifier(globals->cert_verifier.get()); | 206 context->set_cert_verifier(globals->cert_verifier.get()); |
210 context->set_transport_security_state( | 207 context->set_transport_security_state( |
211 globals->transport_security_state.get()); | 208 globals->transport_security_state.get()); |
212 context->set_http_auth_handler_factory( | 209 context->set_http_auth_handler_factory( |
213 globals->http_auth_handler_factory.get()); | 210 globals->http_auth_handler_factory.get()); |
214 context->set_proxy_service(globals->system_proxy_service.get()); | 211 context->set_proxy_service(globals->system_proxy_service.get()); |
215 context->set_http_transaction_factory( | 212 context->set_http_transaction_factory( |
216 globals->system_http_transaction_factory.get()); | 213 globals->system_http_transaction_factory.get()); |
217 context->set_ftp_transaction_factory( | |
218 globals->system_ftp_transaction_factory.get()); | |
219 context->set_cookie_store(globals->system_cookie_store.get()); | 214 context->set_cookie_store(globals->system_cookie_store.get()); |
220 context->set_server_bound_cert_service( | 215 context->set_server_bound_cert_service( |
221 globals->system_server_bound_cert_service.get()); | 216 globals->system_server_bound_cert_service.get()); |
222 context->set_throttler_manager(globals->throttler_manager.get()); | 217 context->set_throttler_manager(globals->throttler_manager.get()); |
223 context->set_network_delegate(globals->system_network_delegate.get()); | 218 context->set_network_delegate(globals->system_network_delegate.get()); |
224 context->set_http_user_agent_settings( | 219 context->set_http_user_agent_settings( |
225 globals->http_user_agent_settings.get()); | 220 globals->http_user_agent_settings.get()); |
226 return context; | 221 return context; |
227 } | 222 } |
228 | 223 |
(...skipping 316 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 sdch_manager_ = new net::SdchManager(); | 559 sdch_manager_ = new net::SdchManager(); |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 command_line)); | 891 command_line)); |
899 | 892 |
900 net::HttpNetworkSession::Params system_params; | 893 net::HttpNetworkSession::Params system_params; |
901 InitializeNetworkSessionParams(&system_params); | 894 InitializeNetworkSessionParams(&system_params); |
902 system_params.net_log = net_log_; | 895 system_params.net_log = net_log_; |
903 system_params.proxy_service = globals_->system_proxy_service.get(); | 896 system_params.proxy_service = globals_->system_proxy_service.get(); |
904 | 897 |
905 globals_->system_http_transaction_factory.reset( | 898 globals_->system_http_transaction_factory.reset( |
906 new net::HttpNetworkLayer( | 899 new net::HttpNetworkLayer( |
907 new net::HttpNetworkSession(system_params))); | 900 new net::HttpNetworkSession(system_params))); |
908 globals_->system_ftp_transaction_factory.reset( | |
909 new net::FtpNetworkLayer(globals_->host_resolver.get())); | |
910 globals_->system_request_context.reset( | 901 globals_->system_request_context.reset( |
911 ConstructSystemRequestContext(globals_, net_log_)); | 902 ConstructSystemRequestContext(globals_, net_log_)); |
912 | 903 |
913 sdch_manager_->set_sdch_fetcher( | 904 sdch_manager_->set_sdch_fetcher( |
914 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); | 905 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); |
915 } | 906 } |
916 | 907 |
917 void IOThread::UpdateDnsClientEnabled() { | 908 void IOThread::UpdateDnsClientEnabled() { |
918 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); | 909 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); |
919 } | 910 } |
OLD | NEW |