| 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/cert_verifier.h" | 43 #include "net/base/cert_verifier.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/cookies/cookie_monster.h" | 50 #include "net/cookies/cookie_monster.h" |
| 51 #include "net/ftp/ftp_network_layer.h" |
| 51 #include "net/http/http_auth_filter.h" | 52 #include "net/http/http_auth_filter.h" |
| 52 #include "net/http/http_auth_handler_factory.h" | 53 #include "net/http/http_auth_handler_factory.h" |
| 53 #include "net/http/http_network_layer.h" | 54 #include "net/http/http_network_layer.h" |
| 54 #include "net/http/http_server_properties_impl.h" | 55 #include "net/http/http_server_properties_impl.h" |
| 55 #include "net/proxy/proxy_config_service.h" | 56 #include "net/proxy/proxy_config_service.h" |
| 56 #include "net/proxy/proxy_script_fetcher_impl.h" | 57 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 57 #include "net/proxy/proxy_service.h" | 58 #include "net/proxy/proxy_service.h" |
| 58 #include "net/spdy/spdy_session.h" | 59 #include "net/spdy/spdy_session.h" |
| 59 #include "net/ssl/default_server_bound_cert_store.h" | 60 #include "net/ssl/default_server_bound_cert_store.h" |
| 60 #include "net/ssl/server_bound_cert_service.h" | 61 #include "net/ssl/server_bound_cert_service.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 context->set_net_log(net_log); | 179 context->set_net_log(net_log); |
| 179 context->set_host_resolver(globals->host_resolver.get()); | 180 context->set_host_resolver(globals->host_resolver.get()); |
| 180 context->set_cert_verifier(globals->cert_verifier.get()); | 181 context->set_cert_verifier(globals->cert_verifier.get()); |
| 181 context->set_transport_security_state( | 182 context->set_transport_security_state( |
| 182 globals->transport_security_state.get()); | 183 globals->transport_security_state.get()); |
| 183 context->set_http_auth_handler_factory( | 184 context->set_http_auth_handler_factory( |
| 184 globals->http_auth_handler_factory.get()); | 185 globals->http_auth_handler_factory.get()); |
| 185 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); | 186 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); |
| 186 context->set_http_transaction_factory( | 187 context->set_http_transaction_factory( |
| 187 globals->proxy_script_fetcher_http_transaction_factory.get()); | 188 globals->proxy_script_fetcher_http_transaction_factory.get()); |
| 189 context->set_ftp_transaction_factory( |
| 190 globals->proxy_script_fetcher_ftp_transaction_factory.get()); |
| 188 context->set_cookie_store(globals->system_cookie_store.get()); | 191 context->set_cookie_store(globals->system_cookie_store.get()); |
| 189 context->set_server_bound_cert_service( | 192 context->set_server_bound_cert_service( |
| 190 globals->system_server_bound_cert_service.get()); | 193 globals->system_server_bound_cert_service.get()); |
| 191 context->set_network_delegate(globals->system_network_delegate.get()); | 194 context->set_network_delegate(globals->system_network_delegate.get()); |
| 192 context->set_http_user_agent_settings( | 195 context->set_http_user_agent_settings( |
| 193 globals->http_user_agent_settings.get()); | 196 globals->http_user_agent_settings.get()); |
| 194 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 197 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
| 195 // 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 |
| 196 // profile. | 199 // profile. |
| 197 return context; | 200 return context; |
| 198 } | 201 } |
| 199 | 202 |
| 200 net::URLRequestContext* | 203 net::URLRequestContext* |
| 201 ConstructSystemRequestContext(IOThread::Globals* globals, | 204 ConstructSystemRequestContext(IOThread::Globals* globals, |
| 202 net::NetLog* net_log) { | 205 net::NetLog* net_log) { |
| 203 net::URLRequestContext* context = new SystemURLRequestContext; | 206 net::URLRequestContext* context = new SystemURLRequestContext; |
| 204 context->set_net_log(net_log); | 207 context->set_net_log(net_log); |
| 205 context->set_host_resolver(globals->host_resolver.get()); | 208 context->set_host_resolver(globals->host_resolver.get()); |
| 206 context->set_cert_verifier(globals->cert_verifier.get()); | 209 context->set_cert_verifier(globals->cert_verifier.get()); |
| 207 context->set_transport_security_state( | 210 context->set_transport_security_state( |
| 208 globals->transport_security_state.get()); | 211 globals->transport_security_state.get()); |
| 209 context->set_http_auth_handler_factory( | 212 context->set_http_auth_handler_factory( |
| 210 globals->http_auth_handler_factory.get()); | 213 globals->http_auth_handler_factory.get()); |
| 211 context->set_proxy_service(globals->system_proxy_service.get()); | 214 context->set_proxy_service(globals->system_proxy_service.get()); |
| 212 context->set_http_transaction_factory( | 215 context->set_http_transaction_factory( |
| 213 globals->system_http_transaction_factory.get()); | 216 globals->system_http_transaction_factory.get()); |
| 217 context->set_ftp_transaction_factory( |
| 218 globals->system_ftp_transaction_factory.get()); |
| 214 context->set_cookie_store(globals->system_cookie_store.get()); | 219 context->set_cookie_store(globals->system_cookie_store.get()); |
| 215 context->set_server_bound_cert_service( | 220 context->set_server_bound_cert_service( |
| 216 globals->system_server_bound_cert_service.get()); | 221 globals->system_server_bound_cert_service.get()); |
| 217 context->set_throttler_manager(globals->throttler_manager.get()); | 222 context->set_throttler_manager(globals->throttler_manager.get()); |
| 218 context->set_network_delegate(globals->system_network_delegate.get()); | 223 context->set_network_delegate(globals->system_network_delegate.get()); |
| 219 context->set_http_user_agent_settings( | 224 context->set_http_user_agent_settings( |
| 220 globals->http_user_agent_settings.get()); | 225 globals->http_user_agent_settings.get()); |
| 221 return context; | 226 return context; |
| 222 } | 227 } |
| 223 | 228 |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 net::HttpNetworkSession::Params session_params; | 543 net::HttpNetworkSession::Params session_params; |
| 539 InitializeNetworkSessionParams(&session_params); | 544 InitializeNetworkSessionParams(&session_params); |
| 540 session_params.net_log = net_log_; | 545 session_params.net_log = net_log_; |
| 541 session_params.proxy_service = | 546 session_params.proxy_service = |
| 542 globals_->proxy_script_fetcher_proxy_service.get(); | 547 globals_->proxy_script_fetcher_proxy_service.get(); |
| 543 | 548 |
| 544 scoped_refptr<net::HttpNetworkSession> network_session( | 549 scoped_refptr<net::HttpNetworkSession> network_session( |
| 545 new net::HttpNetworkSession(session_params)); | 550 new net::HttpNetworkSession(session_params)); |
| 546 globals_->proxy_script_fetcher_http_transaction_factory.reset( | 551 globals_->proxy_script_fetcher_http_transaction_factory.reset( |
| 547 new net::HttpNetworkLayer(network_session)); | 552 new net::HttpNetworkLayer(network_session)); |
| 553 globals_->proxy_script_fetcher_ftp_transaction_factory.reset( |
| 554 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
| 548 | 555 |
| 549 globals_->throttler_manager.reset(new net::URLRequestThrottlerManager()); | 556 globals_->throttler_manager.reset(new net::URLRequestThrottlerManager()); |
| 550 globals_->throttler_manager->set_net_log(net_log_); | 557 globals_->throttler_manager->set_net_log(net_log_); |
| 551 // Always done in production, disabled only for unit tests. | 558 // Always done in production, disabled only for unit tests. |
| 552 globals_->throttler_manager->set_enable_thread_checks(true); | 559 globals_->throttler_manager->set_enable_thread_checks(true); |
| 553 | 560 |
| 554 globals_->proxy_script_fetcher_context.reset( | 561 globals_->proxy_script_fetcher_context.reset( |
| 555 ConstructProxyScriptFetcherContext(globals_, net_log_)); | 562 ConstructProxyScriptFetcherContext(globals_, net_log_)); |
| 556 | 563 |
| 557 sdch_manager_ = new net::SdchManager(); | 564 sdch_manager_ = new net::SdchManager(); |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 command_line)); | 889 command_line)); |
| 883 | 890 |
| 884 net::HttpNetworkSession::Params system_params; | 891 net::HttpNetworkSession::Params system_params; |
| 885 InitializeNetworkSessionParams(&system_params); | 892 InitializeNetworkSessionParams(&system_params); |
| 886 system_params.net_log = net_log_; | 893 system_params.net_log = net_log_; |
| 887 system_params.proxy_service = globals_->system_proxy_service.get(); | 894 system_params.proxy_service = globals_->system_proxy_service.get(); |
| 888 | 895 |
| 889 globals_->system_http_transaction_factory.reset( | 896 globals_->system_http_transaction_factory.reset( |
| 890 new net::HttpNetworkLayer( | 897 new net::HttpNetworkLayer( |
| 891 new net::HttpNetworkSession(system_params))); | 898 new net::HttpNetworkSession(system_params))); |
| 899 globals_->system_ftp_transaction_factory.reset( |
| 900 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
| 892 globals_->system_request_context.reset( | 901 globals_->system_request_context.reset( |
| 893 ConstructSystemRequestContext(globals_, net_log_)); | 902 ConstructSystemRequestContext(globals_, net_log_)); |
| 894 | 903 |
| 895 sdch_manager_->set_sdch_fetcher( | 904 sdch_manager_->set_sdch_fetcher( |
| 896 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); | 905 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); |
| 897 } | 906 } |
| 898 | 907 |
| 899 void IOThread::UpdateDnsClientEnabled() { | 908 void IOThread::UpdateDnsClientEnabled() { |
| 900 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); | 909 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); |
| 901 } | 910 } |
| OLD | NEW |