Revert of Sandbox html_viewer on Linux. (patchset #6 id:100001 of https://codereview...
[chromium-blink-merge.git] / remoting / base / url_request_context_getter.cc
blob4c9c2728c63ec3f5d81baf7a2a92bc5ea416c4c5
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
3 // found in the LICENSE file.
5 #include "remoting/base/url_request_context_getter.h"
7 #include "base/single_thread_task_runner.h"
8 #include "net/proxy/proxy_config_service.h"
9 #include "net/url_request/url_request_context.h"
10 #include "net/url_request/url_request_context_builder.h"
11 #include "remoting/base/vlog_net_log.h"
13 namespace remoting {
15 URLRequestContextGetter::URLRequestContextGetter(
16 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
17 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner)
18 : network_task_runner_(network_task_runner),
19 file_task_runner_(file_task_runner) {
20 proxy_config_service_.reset(net::ProxyService::CreateSystemProxyConfigService(
21 network_task_runner_, file_task_runner));
24 net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
25 if (!url_request_context_.get()) {
26 net::URLRequestContextBuilder builder;
27 builder.SetFileTaskRunner(file_task_runner_);
28 builder.set_net_log(new VlogNetLog());
29 builder.DisableHttpCache();
30 builder.set_proxy_config_service(proxy_config_service_.release());
31 url_request_context_.reset(builder.Build());
33 return url_request_context_.get();
36 scoped_refptr<base::SingleThreadTaskRunner>
37 URLRequestContextGetter::GetNetworkTaskRunner() const {
38 return network_task_runner_;
41 URLRequestContextGetter::~URLRequestContextGetter() {
44 } // namespace remoting