OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/base/url_request_context_getter.h" | 5 #include "remoting/base/url_request_context_getter.h" |
6 | 6 |
7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
8 #include "net/proxy/proxy_config_service.h" | 8 #include "net/proxy/proxy_config_service.h" |
9 #include "net/url_request/url_request_context.h" | 9 #include "net/url_request/url_request_context.h" |
10 #include "net/url_request/url_request_context_builder.h" | 10 #include "net/url_request/url_request_context_builder.h" |
11 #include "remoting/base/vlog_net_log.h" | 11 #include "remoting/base/vlog_net_log.h" |
12 | 12 |
13 namespace remoting { | 13 namespace remoting { |
14 | 14 |
15 URLRequestContextGetter::URLRequestContextGetter( | 15 URLRequestContextGetter::URLRequestContextGetter( |
16 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, | 16 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, |
17 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) | 17 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) |
18 : network_task_runner_(network_task_runner), | 18 : network_task_runner_(network_task_runner), |
19 file_task_runner_(file_task_runner) { | 19 file_task_runner_(file_task_runner) { |
20 proxy_config_service_.reset(net::ProxyService::CreateSystemProxyConfigService( | 20 proxy_config_service_.reset(net::ProxyService::CreateSystemProxyConfigService( |
21 network_task_runner_, file_task_runner)); | 21 network_task_runner_, file_task_runner)); |
22 } | 22 } |
23 | 23 |
24 net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { | 24 net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { |
25 if (!url_request_context_.get()) { | 25 if (!url_request_context_.get()) { |
26 net::URLRequestContextBuilder builder; | 26 net::URLRequestContextBuilder builder; |
27 builder.SetFileTaskRunner(file_task_runner_); | 27 builder.SetFileTaskRunner(file_task_runner_); |
28 builder.set_net_log(new VlogNetLog()); | 28 net_log_.reset(new VlogNetLog()); |
| 29 builder.set_net_log(net_log_.get()); |
29 builder.DisableHttpCache(); | 30 builder.DisableHttpCache(); |
30 builder.set_proxy_config_service(proxy_config_service_.release()); | 31 builder.set_proxy_config_service(proxy_config_service_.Pass()); |
31 url_request_context_.reset(builder.Build()); | 32 url_request_context_ = builder.Build().Pass(); |
32 } | 33 } |
33 return url_request_context_.get(); | 34 return url_request_context_.get(); |
34 } | 35 } |
35 | 36 |
36 scoped_refptr<base::SingleThreadTaskRunner> | 37 scoped_refptr<base::SingleThreadTaskRunner> |
37 URLRequestContextGetter::GetNetworkTaskRunner() const { | 38 URLRequestContextGetter::GetNetworkTaskRunner() const { |
38 return network_task_runner_; | 39 return network_task_runner_; |
39 } | 40 } |
40 | 41 |
41 URLRequestContextGetter::~URLRequestContextGetter() { | 42 URLRequestContextGetter::~URLRequestContextGetter() { |
42 } | 43 } |
43 | 44 |
44 } // namespace remoting | 45 } // namespace remoting |
OLD | NEW |