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

Side by Side Diff: content/shell/browser/shell_url_request_context_getter.cc

Issue 2944313003: Remove the dependence on BrowserThread::FILE for (Closed)
Patch Set: address mmenke's comments Created 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/shell/browser/shell_url_request_context_getter.h" 5 #include "content/shell/browser/shell_url_request_context_getter.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 bool ignore_certificate_errors, 88 bool ignore_certificate_errors,
89 const base::FilePath& base_path, 89 const base::FilePath& base_path,
90 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, 90 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
91 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, 91 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner,
92 ProtocolHandlerMap* protocol_handlers, 92 ProtocolHandlerMap* protocol_handlers,
93 URLRequestInterceptorScopedVector request_interceptors, 93 URLRequestInterceptorScopedVector request_interceptors,
94 net::NetLog* net_log) 94 net::NetLog* net_log)
95 : ignore_certificate_errors_(ignore_certificate_errors), 95 : ignore_certificate_errors_(ignore_certificate_errors),
96 base_path_(base_path), 96 base_path_(base_path),
97 io_task_runner_(std::move(io_task_runner)), 97 io_task_runner_(std::move(io_task_runner)),
98 file_task_runner_(std::move(file_task_runner)),
99 net_log_(net_log), 98 net_log_(net_log),
100 request_interceptors_(std::move(request_interceptors)) { 99 request_interceptors_(std::move(request_interceptors)) {
101 // Must first be created on the UI thread. 100 // Must first be created on the UI thread.
102 DCHECK_CURRENTLY_ON(BrowserThread::UI); 101 DCHECK_CURRENTLY_ON(BrowserThread::UI);
103 102
104 std::swap(protocol_handlers_, *protocol_handlers); 103 std::swap(protocol_handlers_, *protocol_handlers);
105 104
106 // We must create the proxy config service on the UI loop on Linux because it 105 // We must create the proxy config service on the UI loop on Linux because it
107 // must synchronously run on the glib message loop. This will be passed to 106 // must synchronously run on the glib message loop. This will be passed to
108 // the URLRequestContextStorage on the IO thread in GetURLRequestContext(). 107 // the URLRequestContextStorage on the IO thread in GetURLRequestContext().
109 proxy_config_service_ = GetProxyConfigService(); 108 proxy_config_service_ = GetProxyConfigService();
110 } 109 }
111 110
112 ShellURLRequestContextGetter::~ShellURLRequestContextGetter() { 111 ShellURLRequestContextGetter::~ShellURLRequestContextGetter() {
113 } 112 }
114 113
115 std::unique_ptr<net::NetworkDelegate> 114 std::unique_ptr<net::NetworkDelegate>
116 ShellURLRequestContextGetter::CreateNetworkDelegate() { 115 ShellURLRequestContextGetter::CreateNetworkDelegate() {
117 return base::WrapUnique(new ShellNetworkDelegate); 116 return base::WrapUnique(new ShellNetworkDelegate);
118 } 117 }
119 118
120 std::unique_ptr<net::ProxyConfigService> 119 std::unique_ptr<net::ProxyConfigService>
121 ShellURLRequestContextGetter::GetProxyConfigService() { 120 ShellURLRequestContextGetter::GetProxyConfigService() {
122 return net::ProxyService::CreateSystemProxyConfigService(io_task_runner_, 121 return net::ProxyService::CreateSystemProxyConfigService(io_task_runner_);
123 file_task_runner_);
124 } 122 }
125 123
126 std::unique_ptr<net::ProxyService> 124 std::unique_ptr<net::ProxyService>
127 ShellURLRequestContextGetter::GetProxyService() { 125 ShellURLRequestContextGetter::GetProxyService() {
128 // TODO(jam): use v8 if possible, look at chrome code. 126 // TODO(jam): use v8 if possible, look at chrome code.
129 return net::ProxyService::CreateUsingSystemProxyResolver( 127 return net::ProxyService::CreateUsingSystemProxyResolver(
130 std::move(proxy_config_service_), url_request_context_->net_log()); 128 std::move(proxy_config_service_), url_request_context_->net_log());
131 } 129 }
132 130
133 net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() { 131 net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 scoped_refptr<base::SingleThreadTaskRunner> 275 scoped_refptr<base::SingleThreadTaskRunner>
278 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { 276 ShellURLRequestContextGetter::GetNetworkTaskRunner() const {
279 return BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); 277 return BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
280 } 278 }
281 279
282 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { 280 net::HostResolver* ShellURLRequestContextGetter::host_resolver() {
283 return url_request_context_->host_resolver(); 281 return url_request_context_->host_resolver();
284 } 282 }
285 283
286 } // namespace content 284 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/shell_url_request_context_getter.h ('k') | headless/lib/browser/headless_url_request_context_getter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698