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