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 net::ProxyConfigService* proxy_config_service) |
24 : ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) { | 24 : ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) { |
| 25 net_log_.reset(new VlogNetLog()); |
| 26 |
25 storage_.set_host_resolver( | 27 storage_.set_host_resolver( |
26 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, | 28 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, |
27 net::HostResolver::kDefaultRetryAttempts, | 29 net::HostResolver::kDefaultRetryAttempts, |
28 NULL)); | 30 net_log_.get())); |
29 storage_.set_proxy_service(net::ProxyService::CreateUsingSystemProxyResolver( | 31 storage_.set_proxy_service(net::ProxyService::CreateUsingSystemProxyResolver( |
30 proxy_config_service, 0u, NULL)); | 32 proxy_config_service, 0u, net_log_.get())); |
31 storage_.set_cert_verifier(net::CertVerifier::CreateDefault()); | 33 storage_.set_cert_verifier(net::CertVerifier::CreateDefault()); |
32 storage_.set_ssl_config_service(new net::SSLConfigServiceDefaults); | 34 storage_.set_ssl_config_service(new net::SSLConfigServiceDefaults); |
33 storage_.set_http_auth_handler_factory( | 35 storage_.set_http_auth_handler_factory( |
34 net::HttpAuthHandlerFactory::CreateDefault(host_resolver())); | 36 net::HttpAuthHandlerFactory::CreateDefault(host_resolver())); |
35 storage_.set_http_server_properties(new net::HttpServerPropertiesImpl); | 37 storage_.set_http_server_properties(new net::HttpServerPropertiesImpl); |
36 | 38 |
37 net::HttpNetworkSession::Params session_params; | 39 net::HttpNetworkSession::Params session_params; |
38 session_params.host_resolver = host_resolver(); | 40 session_params.host_resolver = host_resolver(); |
39 session_params.cert_verifier = cert_verifier(); | 41 session_params.cert_verifier = cert_verifier(); |
40 session_params.proxy_service = proxy_service(); | 42 session_params.proxy_service = proxy_service(); |
41 session_params.ssl_config_service = ssl_config_service(); | 43 session_params.ssl_config_service = ssl_config_service(); |
42 session_params.http_auth_handler_factory = http_auth_handler_factory(); | 44 session_params.http_auth_handler_factory = http_auth_handler_factory(); |
43 session_params.http_server_properties = http_server_properties(); | 45 session_params.http_server_properties = http_server_properties(); |
| 46 session_params.net_log = net_log_.get(); |
44 scoped_refptr<net::HttpNetworkSession> network_session( | 47 scoped_refptr<net::HttpNetworkSession> network_session( |
45 new net::HttpNetworkSession(session_params)); | 48 new net::HttpNetworkSession(session_params)); |
46 storage_.set_http_transaction_factory( | 49 storage_.set_http_transaction_factory( |
47 new net::HttpNetworkLayer(network_session)); | 50 new net::HttpNetworkLayer(network_session)); |
48 } | 51 } |
49 | 52 |
50 URLRequestContext::~URLRequestContext() { | 53 URLRequestContext::~URLRequestContext() { |
51 } | 54 } |
52 | 55 |
53 URLRequestContextGetter::URLRequestContextGetter( | 56 URLRequestContextGetter::URLRequestContextGetter( |
(...skipping 13 matching lines...) Expand all Loading... |
67 } | 70 } |
68 | 71 |
69 scoped_refptr<base::MessageLoopProxy> | 72 scoped_refptr<base::MessageLoopProxy> |
70 URLRequestContextGetter::GetIOMessageLoopProxy() const { | 73 URLRequestContextGetter::GetIOMessageLoopProxy() const { |
71 return io_message_loop_proxy_; | 74 return io_message_loop_proxy_; |
72 } | 75 } |
73 | 76 |
74 URLRequestContextGetter::~URLRequestContextGetter() {} | 77 URLRequestContextGetter::~URLRequestContextGetter() {} |
75 | 78 |
76 } // namespace remoting | 79 } // namespace remoting |
OLD | NEW |