Chromium Code Reviews| 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 "remoting/host/url_request_context.h" | 5 #include "remoting/host/url_request_context.h" |
| 6 | 6 |
| 7 #include "base/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
| 8 #include "net/base/cert_verifier.h" | 8 #include "net/base/cert_verifier.h" |
| 9 #include "net/base/host_resolver.h" | 9 #include "net/base/host_resolver.h" |
| 10 #include "net/base/ssl_config_service_defaults.h" | 10 #include "net/base/ssl_config_service_defaults.h" |
| 11 #include "net/http/http_auth_handler_factory.h" | 11 #include "net/http/http_auth_handler_factory.h" |
| 12 #include "net/http/http_network_layer.h" | 12 #include "net/http/http_network_layer.h" |
| 13 #include "net/http/http_network_session.h" | 13 #include "net/http/http_network_session.h" |
| 14 #include "net/http/http_server_properties_impl.h" | 14 #include "net/http/http_server_properties_impl.h" |
| 15 #include "net/proxy/proxy_config_service.h" | 15 #include "net/proxy/proxy_config_service.h" |
| 16 #include "net/proxy/proxy_service.h" | 16 #include "net/proxy/proxy_service.h" |
| 17 | 17 |
| 18 namespace remoting { | 18 namespace remoting { |
| 19 | 19 |
| 20 // TODO(willchan): This is largely copied from service_url_request_context.cc, | 20 // TODO(willchan): This is largely copied from service_url_request_context.cc, |
| 21 // which is in turn copied from some test code. Move it somewhere reusable. | 21 // which is in turn copied from some test code. Move it somewhere reusable. |
| 22 URLRequestContext::URLRequestContext( | 22 URLRequestContext::URLRequestContext( |
| 23 net::ProxyConfigService* proxy_config_service) | 23 scoped_ptr<net::ProxyConfigService> proxy_config_service) |
| 24 : ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) { | 24 : ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) { |
| 25 storage_.set_host_resolver( | 25 storage_.set_host_resolver( |
| 26 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, | 26 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, |
| 27 net::HostResolver::kDefaultRetryAttempts, | 27 net::HostResolver::kDefaultRetryAttempts, |
| 28 NULL)); | 28 NULL)); |
| 29 storage_.set_proxy_service(net::ProxyService::CreateUsingSystemProxyResolver( | 29 storage_.set_proxy_service(net::ProxyService::CreateUsingSystemProxyResolver( |
| 30 proxy_config_service, 0u, NULL)); | 30 proxy_config_service.release(), 0u, NULL)); |
| 31 storage_.set_cert_verifier(net::CertVerifier::CreateDefault()); | 31 storage_.set_cert_verifier(net::CertVerifier::CreateDefault()); |
| 32 storage_.set_ssl_config_service(new net::SSLConfigServiceDefaults); | 32 storage_.set_ssl_config_service(new net::SSLConfigServiceDefaults); |
| 33 storage_.set_http_auth_handler_factory( | 33 storage_.set_http_auth_handler_factory( |
| 34 net::HttpAuthHandlerFactory::CreateDefault(host_resolver())); | 34 net::HttpAuthHandlerFactory::CreateDefault(host_resolver())); |
| 35 storage_.set_http_server_properties(new net::HttpServerPropertiesImpl); | 35 storage_.set_http_server_properties(new net::HttpServerPropertiesImpl); |
| 36 | 36 |
| 37 net::HttpNetworkSession::Params session_params; | 37 net::HttpNetworkSession::Params session_params; |
| 38 session_params.host_resolver = host_resolver(); | 38 session_params.host_resolver = host_resolver(); |
| 39 session_params.cert_verifier = cert_verifier(); | 39 session_params.cert_verifier = cert_verifier(); |
| 40 session_params.proxy_service = proxy_service(); | 40 session_params.proxy_service = proxy_service(); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 54 MessageLoop* io_message_loop, | 54 MessageLoop* io_message_loop, |
| 55 MessageLoop* file_message_loop) | 55 MessageLoop* file_message_loop) |
| 56 : io_message_loop_proxy_(io_message_loop->message_loop_proxy()) { | 56 : io_message_loop_proxy_(io_message_loop->message_loop_proxy()) { |
| 57 proxy_config_service_.reset( | 57 proxy_config_service_.reset( |
| 58 net::ProxyService::CreateSystemProxyConfigService( | 58 net::ProxyService::CreateSystemProxyConfigService( |
| 59 io_message_loop, file_message_loop)); | 59 io_message_loop, file_message_loop)); |
| 60 } | 60 } |
| 61 | 61 |
| 62 net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { | 62 net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { |
| 63 if (!url_request_context_) | 63 if (!url_request_context_) |
| 64 url_request_context_ = | 64 url_request_context_ = |
|
Sergey Ulanov
2012/04/17 20:01:25
nit: this should be wrapped in {}
alexeypa (please no reviews)
2012/04/17 20:28:09
Done.
| |
| 65 new URLRequestContext(proxy_config_service_.get()); | 65 new URLRequestContext(proxy_config_service_.Pass()); |
| 66 return url_request_context_; | 66 return url_request_context_; |
| 67 } | 67 } |
| 68 | 68 |
| 69 scoped_refptr<base::MessageLoopProxy> | 69 scoped_refptr<base::MessageLoopProxy> |
| 70 URLRequestContextGetter::GetIOMessageLoopProxy() const { | 70 URLRequestContextGetter::GetIOMessageLoopProxy() const { |
| 71 return io_message_loop_proxy_; | 71 return io_message_loop_proxy_; |
| 72 } | 72 } |
| 73 | 73 |
| 74 URLRequestContextGetter::~URLRequestContextGetter() {} | 74 URLRequestContextGetter::~URLRequestContextGetter() {} |
| 75 | 75 |
| 76 } // namespace remoting | 76 } // namespace remoting |
| OLD | NEW |