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

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

Issue 2043603004: headless: Introduce a browser context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits Created 4 years, 6 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 <memory> 7 #include <memory>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 net::URLRequestContext* 53 net::URLRequestContext*
54 HeadlessURLRequestContextGetter::GetURLRequestContext() { 54 HeadlessURLRequestContextGetter::GetURLRequestContext() {
55 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 55 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
56 if (!url_request_context_) { 56 if (!url_request_context_) {
57 net::URLRequestContextBuilder builder; 57 net::URLRequestContextBuilder builder;
58 // TODO(skyostil): Make language settings configurable. 58 // TODO(skyostil): Make language settings configurable.
59 builder.set_user_agent(user_agent_); 59 builder.set_user_agent(user_agent_);
60 // TODO(skyostil): Make these configurable. 60 // TODO(skyostil): Make these configurable.
61 builder.set_data_enabled(true); 61 builder.set_data_enabled(true);
62 builder.set_file_enabled(true); 62 builder.set_file_enabled(true);
63 builder.SetFileTaskRunner(
64 content::BrowserThread::GetMessageLoopProxyForThread(
65 content::BrowserThread::FILE));
63 if (!proxy_server_.IsEmpty()) { 66 if (!proxy_server_.IsEmpty()) {
64 builder.set_proxy_service( 67 builder.set_proxy_service(
65 net::ProxyService::CreateFixed(proxy_server_.ToString())); 68 net::ProxyService::CreateFixed(proxy_server_.ToString()));
66 } else { 69 } else {
67 builder.set_proxy_config_service(std::move(proxy_config_service_)); 70 builder.set_proxy_config_service(std::move(proxy_config_service_));
68 } 71 }
69 72
70 if (!host_resolver_rules_.empty()) { 73 if (!host_resolver_rules_.empty()) {
71 std::unique_ptr<net::HostResolver> host_resolver( 74 std::unique_ptr<net::HostResolver> host_resolver(
72 net::HostResolver::CreateDefaultResolver(nullptr /* net_log */)); 75 net::HostResolver::CreateDefaultResolver(nullptr /* net_log */));
(...skipping 27 matching lines...) Expand all
100 HeadlessURLRequestContextGetter::GetNetworkTaskRunner() const { 103 HeadlessURLRequestContextGetter::GetNetworkTaskRunner() const {
101 return content::BrowserThread::GetMessageLoopProxyForThread( 104 return content::BrowserThread::GetMessageLoopProxyForThread(
102 content::BrowserThread::IO); 105 content::BrowserThread::IO);
103 } 106 }
104 107
105 net::HostResolver* HeadlessURLRequestContextGetter::host_resolver() const { 108 net::HostResolver* HeadlessURLRequestContextGetter::host_resolver() const {
106 return url_request_context_->host_resolver(); 109 return url_request_context_->host_resolver();
107 } 110 }
108 111
109 } // namespace headless 112 } // namespace headless
OLDNEW
« no previous file with comments | « headless/lib/browser/headless_devtools.cc ('k') | headless/lib/browser/headless_web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698