Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: headless/lib/browser/headless_url_request_context_getter.cc

Issue 1781193004: headless: Make it possible to configure an HTTP proxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finalized test. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "headless/lib/browser/headless_url_request_context_getter.h" 5 #include "headless/lib/browser/headless_url_request_context_getter.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/worker_pool.h" 10 #include "base/threading/worker_pool.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 HeadlessURLRequestContextGetter::~HeadlessURLRequestContextGetter() {} 79 HeadlessURLRequestContextGetter::~HeadlessURLRequestContextGetter() {}
80 80
81 scoped_ptr<net::NetworkDelegate> 81 scoped_ptr<net::NetworkDelegate>
82 HeadlessURLRequestContextGetter::CreateNetworkDelegate() { 82 HeadlessURLRequestContextGetter::CreateNetworkDelegate() {
83 return nullptr; 83 return nullptr;
84 } 84 }
85 85
86 scoped_ptr<net::ProxyConfigService> 86 scoped_ptr<net::ProxyConfigService>
87 HeadlessURLRequestContextGetter::GetProxyConfigService() { 87 HeadlessURLRequestContextGetter::GetProxyConfigService() {
88 if (!options_.proxy_server.IsEmpty())
89 return nullptr;
alex clarke (OOO till 29th) 2016/03/14 18:16:08 Is it worth adding a comment to the definition say
Sami 2016/03/14 18:33:27 Good point, it might be cleaner just to avoid call
88 return net::ProxyService::CreateSystemProxyConfigService(io_task_runner_, 90 return net::ProxyService::CreateSystemProxyConfigService(io_task_runner_,
89 file_task_runner_); 91 file_task_runner_);
90 } 92 }
91 93
92 scoped_ptr<net::ProxyService> 94 scoped_ptr<net::ProxyService>
93 HeadlessURLRequestContextGetter::GetProxyService() { 95 HeadlessURLRequestContextGetter::GetProxyService() {
96 if (!options_.proxy_server.IsEmpty())
97 return net::ProxyService::CreateFixed(options_.proxy_server.ToString());
94 return net::ProxyService::CreateUsingSystemProxyResolver( 98 return net::ProxyService::CreateUsingSystemProxyResolver(
95 std::move(proxy_config_service_), 0, url_request_context_->net_log()); 99 std::move(proxy_config_service_), 0, url_request_context_->net_log());
96 } 100 }
97 101
98 net::URLRequestContext* 102 net::URLRequestContext*
99 HeadlessURLRequestContextGetter::GetURLRequestContext() { 103 HeadlessURLRequestContextGetter::GetURLRequestContext() {
100 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 104 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
101 105
102 if (!url_request_context_) { 106 if (!url_request_context_) {
103 const base::CommandLine& command_line = 107 const base::CommandLine& command_line =
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 HeadlessURLRequestContextGetter::GetNetworkTaskRunner() const { 217 HeadlessURLRequestContextGetter::GetNetworkTaskRunner() const {
214 return content::BrowserThread::GetMessageLoopProxyForThread( 218 return content::BrowserThread::GetMessageLoopProxyForThread(
215 content::BrowserThread::IO); 219 content::BrowserThread::IO);
216 } 220 }
217 221
218 net::HostResolver* HeadlessURLRequestContextGetter::host_resolver() const { 222 net::HostResolver* HeadlessURLRequestContextGetter::host_resolver() const {
219 return url_request_context_->host_resolver(); 223 return url_request_context_->host_resolver();
220 } 224 }
221 225
222 } // namespace headless 226 } // namespace headless
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698