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