Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: chrome/browser/io_thread.cc

Issue 11931024: Removed static factories for data, ftp, file, and about jobs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address erikwright's comments Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 net::HttpNetworkSession::Params session_params; 521 net::HttpNetworkSession::Params session_params;
527 InitializeNetworkSessionParams(&session_params); 522 InitializeNetworkSessionParams(&session_params);
528 session_params.net_log = net_log_; 523 session_params.net_log = net_log_;
529 session_params.proxy_service = 524 session_params.proxy_service =
530 globals_->proxy_script_fetcher_proxy_service.get(); 525 globals_->proxy_script_fetcher_proxy_service.get();
531 526
532 scoped_refptr<net::HttpNetworkSession> network_session( 527 scoped_refptr<net::HttpNetworkSession> network_session(
533 new net::HttpNetworkSession(session_params)); 528 new net::HttpNetworkSession(session_params));
534 globals_->proxy_script_fetcher_http_transaction_factory.reset( 529 globals_->proxy_script_fetcher_http_transaction_factory.reset(
535 new net::HttpNetworkLayer(network_session)); 530 new net::HttpNetworkLayer(network_session));
536 globals_->proxy_script_fetcher_ftp_transaction_factory.reset(
537 new net::FtpNetworkLayer(globals_->host_resolver.get()));
538 531
539 globals_->throttler_manager.reset(new net::URLRequestThrottlerManager()); 532 globals_->throttler_manager.reset(new net::URLRequestThrottlerManager());
540 globals_->throttler_manager->set_net_log(net_log_); 533 globals_->throttler_manager->set_net_log(net_log_);
541 // Always done in production, disabled only for unit tests. 534 // Always done in production, disabled only for unit tests.
542 globals_->throttler_manager->set_enable_thread_checks(true); 535 globals_->throttler_manager->set_enable_thread_checks(true);
543 536
544 globals_->proxy_script_fetcher_context.reset( 537 globals_->proxy_script_fetcher_context.reset(
545 ConstructProxyScriptFetcherContext(globals_, net_log_)); 538 ConstructProxyScriptFetcherContext(globals_, net_log_));
546 539
547 sdch_manager_ = new net::SdchManager(); 540 sdch_manager_ = new net::SdchManager();
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 command_line)); 866 command_line));
874 867
875 net::HttpNetworkSession::Params system_params; 868 net::HttpNetworkSession::Params system_params;
876 InitializeNetworkSessionParams(&system_params); 869 InitializeNetworkSessionParams(&system_params);
877 system_params.net_log = net_log_; 870 system_params.net_log = net_log_;
878 system_params.proxy_service = globals_->system_proxy_service.get(); 871 system_params.proxy_service = globals_->system_proxy_service.get();
879 872
880 globals_->system_http_transaction_factory.reset( 873 globals_->system_http_transaction_factory.reset(
881 new net::HttpNetworkLayer( 874 new net::HttpNetworkLayer(
882 new net::HttpNetworkSession(system_params))); 875 new net::HttpNetworkSession(system_params)));
883 globals_->system_ftp_transaction_factory.reset(
884 new net::FtpNetworkLayer(globals_->host_resolver.get()));
885 globals_->system_request_context.reset( 876 globals_->system_request_context.reset(
886 ConstructSystemRequestContext(globals_, net_log_)); 877 ConstructSystemRequestContext(globals_, net_log_));
887 878
888 sdch_manager_->set_sdch_fetcher( 879 sdch_manager_->set_sdch_fetcher(
889 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); 880 new SdchDictionaryFetcher(system_url_request_context_getter_.get()));
890 } 881 }
891 882
892 void IOThread::UpdateDnsClientEnabled() { 883 void IOThread::UpdateDnsClientEnabled() {
893 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); 884 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_);
894 } 885 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698