Add ability to gather metrics to BubbleManager.
[chromium-blink-merge.git] / remoting / base / url_request_context_getter.cc
blobb527481943dfdc860a8681bd2b56b6639fb35b10
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 net_log_.reset(new VlogNetLog());
29 builder.set_net_log(net_log_.get());
30 builder.DisableHttpCache();
31 builder.set_proxy_config_service(proxy_config_service_.Pass());
32 url_request_context_ = builder.Build().Pass();
34 return url_request_context_.get();
37 scoped_refptr<base::SingleThreadTaskRunner>
38 URLRequestContextGetter::GetNetworkTaskRunner() const {
39 return network_task_runner_;
42 URLRequestContextGetter::~URLRequestContextGetter() {
45 } // namespace remoting