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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 context->set_transport_security_state( | 205 context->set_transport_security_state( |
206 globals->transport_security_state.get()); | 206 globals->transport_security_state.get()); |
207 context->set_http_auth_handler_factory( | 207 context->set_http_auth_handler_factory( |
208 globals->http_auth_handler_factory.get()); | 208 globals->http_auth_handler_factory.get()); |
209 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); | 209 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); |
210 context->set_http_transaction_factory( | 210 context->set_http_transaction_factory( |
211 globals->proxy_script_fetcher_http_transaction_factory.get()); | 211 globals->proxy_script_fetcher_http_transaction_factory.get()); |
212 context->set_ftp_transaction_factory( | 212 context->set_ftp_transaction_factory( |
213 globals->proxy_script_fetcher_ftp_transaction_factory.get()); | 213 globals->proxy_script_fetcher_ftp_transaction_factory.get()); |
214 context->set_cookie_store(globals->system_cookie_store.get()); | 214 context->set_cookie_store(globals->system_cookie_store.get()); |
215 context->set_origin_bound_cert_service( | 215 context->set_server_bound_cert_service( |
216 globals->system_origin_bound_cert_service.get()); | 216 globals->system_server_bound_cert_service.get()); |
217 context->set_network_delegate(globals->system_network_delegate.get()); | 217 context->set_network_delegate(globals->system_network_delegate.get()); |
218 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 218 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
219 // system URLRequestContext too. There's no reason this should be tied to a | 219 // system URLRequestContext too. There's no reason this should be tied to a |
220 // profile. | 220 // profile. |
221 return context; | 221 return context; |
222 } | 222 } |
223 | 223 |
224 scoped_refptr<net::URLRequestContext> | 224 scoped_refptr<net::URLRequestContext> |
225 ConstructSystemRequestContext(IOThread::Globals* globals, | 225 ConstructSystemRequestContext(IOThread::Globals* globals, |
226 net::NetLog* net_log) { | 226 net::NetLog* net_log) { |
227 scoped_refptr<net::URLRequestContext> context( | 227 scoped_refptr<net::URLRequestContext> context( |
228 new SystemURLRequestContext); | 228 new SystemURLRequestContext); |
229 context->set_net_log(net_log); | 229 context->set_net_log(net_log); |
230 context->set_host_resolver(globals->host_resolver.get()); | 230 context->set_host_resolver(globals->host_resolver.get()); |
231 context->set_cert_verifier(globals->cert_verifier.get()); | 231 context->set_cert_verifier(globals->cert_verifier.get()); |
232 context->set_transport_security_state( | 232 context->set_transport_security_state( |
233 globals->transport_security_state.get()); | 233 globals->transport_security_state.get()); |
234 context->set_http_auth_handler_factory( | 234 context->set_http_auth_handler_factory( |
235 globals->http_auth_handler_factory.get()); | 235 globals->http_auth_handler_factory.get()); |
236 context->set_proxy_service(globals->system_proxy_service.get()); | 236 context->set_proxy_service(globals->system_proxy_service.get()); |
237 context->set_http_transaction_factory( | 237 context->set_http_transaction_factory( |
238 globals->system_http_transaction_factory.get()); | 238 globals->system_http_transaction_factory.get()); |
239 context->set_ftp_transaction_factory( | 239 context->set_ftp_transaction_factory( |
240 globals->system_ftp_transaction_factory.get()); | 240 globals->system_ftp_transaction_factory.get()); |
241 context->set_cookie_store(globals->system_cookie_store.get()); | 241 context->set_cookie_store(globals->system_cookie_store.get()); |
242 context->set_origin_bound_cert_service( | 242 context->set_server_bound_cert_service( |
243 globals->system_origin_bound_cert_service.get()); | 243 globals->system_server_bound_cert_service.get()); |
244 return context; | 244 return context; |
245 } | 245 } |
246 | 246 |
247 } // namespace | 247 } // namespace |
248 | 248 |
249 class SystemURLRequestContextGetter : public net::URLRequestContextGetter { | 249 class SystemURLRequestContextGetter : public net::URLRequestContextGetter { |
250 public: | 250 public: |
251 explicit SystemURLRequestContextGetter(IOThread* io_thread); | 251 explicit SystemURLRequestContextGetter(IOThread* io_thread); |
252 virtual ~SystemURLRequestContextGetter(); | 252 virtual ~SystemURLRequestContextGetter(); |
253 | 253 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 globals_->transport_security_state.reset(new net::TransportSecurityState("")); | 397 globals_->transport_security_state.reset(new net::TransportSecurityState("")); |
398 globals_->ssl_config_service = GetSSLConfigService(); | 398 globals_->ssl_config_service = GetSSLConfigService(); |
399 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( | 399 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( |
400 globals_->host_resolver.get())); | 400 globals_->host_resolver.get())); |
401 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl); | 401 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl); |
402 // For the ProxyScriptFetcher, we use a direct ProxyService. | 402 // For the ProxyScriptFetcher, we use a direct ProxyService. |
403 globals_->proxy_script_fetcher_proxy_service.reset( | 403 globals_->proxy_script_fetcher_proxy_service.reset( |
404 net::ProxyService::CreateDirectWithNetLog(net_log_)); | 404 net::ProxyService::CreateDirectWithNetLog(net_log_)); |
405 // In-memory cookie store. | 405 // In-memory cookie store. |
406 globals_->system_cookie_store = new net::CookieMonster(NULL, NULL); | 406 globals_->system_cookie_store = new net::CookieMonster(NULL, NULL); |
407 // In-memory origin-bound cert store. | 407 // In-memory server bound cert store. |
408 globals_->system_origin_bound_cert_service.reset( | 408 globals_->system_server_bound_cert_service.reset( |
409 new net::OriginBoundCertService( | 409 new net::ServerBoundCertService( |
410 new net::DefaultOriginBoundCertStore(NULL))); | 410 new net::DefaultServerBoundCertStore(NULL))); |
411 net::HttpNetworkSession::Params session_params; | 411 net::HttpNetworkSession::Params session_params; |
412 session_params.host_resolver = globals_->host_resolver.get(); | 412 session_params.host_resolver = globals_->host_resolver.get(); |
413 session_params.cert_verifier = globals_->cert_verifier.get(); | 413 session_params.cert_verifier = globals_->cert_verifier.get(); |
414 session_params.origin_bound_cert_service = | 414 session_params.server_bound_cert_service = |
415 globals_->system_origin_bound_cert_service.get(); | 415 globals_->system_server_bound_cert_service.get(); |
416 session_params.transport_security_state = | 416 session_params.transport_security_state = |
417 globals_->transport_security_state.get(); | 417 globals_->transport_security_state.get(); |
418 session_params.proxy_service = | 418 session_params.proxy_service = |
419 globals_->proxy_script_fetcher_proxy_service.get(); | 419 globals_->proxy_script_fetcher_proxy_service.get(); |
420 session_params.http_auth_handler_factory = | 420 session_params.http_auth_handler_factory = |
421 globals_->http_auth_handler_factory.get(); | 421 globals_->http_auth_handler_factory.get(); |
422 session_params.network_delegate = globals_->system_network_delegate.get(); | 422 session_params.network_delegate = globals_->system_network_delegate.get(); |
423 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 423 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
424 // system URLRequestContext too. There's no reason this should be tied to a | 424 // system URLRequestContext too. There's no reason this should be tied to a |
425 // profile. | 425 // profile. |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 579 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
580 globals_->system_proxy_service.reset( | 580 globals_->system_proxy_service.reset( |
581 ProxyServiceFactory::CreateProxyService( | 581 ProxyServiceFactory::CreateProxyService( |
582 net_log_, | 582 net_log_, |
583 globals_->proxy_script_fetcher_context, | 583 globals_->proxy_script_fetcher_context, |
584 system_proxy_config_service_.release(), | 584 system_proxy_config_service_.release(), |
585 command_line)); | 585 command_line)); |
586 net::HttpNetworkSession::Params system_params; | 586 net::HttpNetworkSession::Params system_params; |
587 system_params.host_resolver = globals_->host_resolver.get(); | 587 system_params.host_resolver = globals_->host_resolver.get(); |
588 system_params.cert_verifier = globals_->cert_verifier.get(); | 588 system_params.cert_verifier = globals_->cert_verifier.get(); |
589 system_params.origin_bound_cert_service = | 589 system_params.server_bound_cert_service = |
590 globals_->system_origin_bound_cert_service.get(); | 590 globals_->system_server_bound_cert_service.get(); |
591 system_params.transport_security_state = | 591 system_params.transport_security_state = |
592 globals_->transport_security_state.get(); | 592 globals_->transport_security_state.get(); |
593 system_params.ssl_host_info_factory = NULL; | 593 system_params.ssl_host_info_factory = NULL; |
594 system_params.proxy_service = globals_->system_proxy_service.get(); | 594 system_params.proxy_service = globals_->system_proxy_service.get(); |
595 system_params.ssl_config_service = globals_->ssl_config_service.get(); | 595 system_params.ssl_config_service = globals_->ssl_config_service.get(); |
596 system_params.http_auth_handler_factory = | 596 system_params.http_auth_handler_factory = |
597 globals_->http_auth_handler_factory.get(); | 597 globals_->http_auth_handler_factory.get(); |
598 system_params.http_server_properties = globals_->http_server_properties.get(); | 598 system_params.http_server_properties = globals_->http_server_properties.get(); |
599 system_params.network_delegate = globals_->system_network_delegate.get(); | 599 system_params.network_delegate = globals_->system_network_delegate.get(); |
600 system_params.net_log = net_log_; | 600 system_params.net_log = net_log_; |
601 globals_->system_http_transaction_factory.reset( | 601 globals_->system_http_transaction_factory.reset( |
602 new net::HttpNetworkLayer( | 602 new net::HttpNetworkLayer( |
603 new net::HttpNetworkSession(system_params))); | 603 new net::HttpNetworkSession(system_params))); |
604 globals_->system_ftp_transaction_factory.reset( | 604 globals_->system_ftp_transaction_factory.reset( |
605 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 605 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
606 globals_->system_request_context = | 606 globals_->system_request_context = |
607 ConstructSystemRequestContext(globals_, net_log_); | 607 ConstructSystemRequestContext(globals_, net_log_); |
608 | 608 |
609 sdch_manager_->set_sdch_fetcher( | 609 sdch_manager_->set_sdch_fetcher( |
610 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); | 610 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); |
611 } | 611 } |
OLD | NEW |