OLD | NEW |
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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 // ShellContentBrowserClient::IsHandledURL(). | 251 // ShellContentBrowserClient::IsHandledURL(). |
252 InstallProtocolHandlers(job_factory.get(), &protocol_handlers_); | 252 InstallProtocolHandlers(job_factory.get(), &protocol_handlers_); |
253 bool set_protocol = job_factory->SetProtocolHandler( | 253 bool set_protocol = job_factory->SetProtocolHandler( |
254 url::kDataScheme, base::WrapUnique(new net::DataProtocolHandler)); | 254 url::kDataScheme, base::WrapUnique(new net::DataProtocolHandler)); |
255 DCHECK(set_protocol); | 255 DCHECK(set_protocol); |
256 #if !BUILDFLAG(DISABLE_FILE_SUPPORT) | 256 #if !BUILDFLAG(DISABLE_FILE_SUPPORT) |
257 set_protocol = job_factory->SetProtocolHandler( | 257 set_protocol = job_factory->SetProtocolHandler( |
258 url::kFileScheme, | 258 url::kFileScheme, |
259 base::MakeUnique<net::FileProtocolHandler>( | 259 base::MakeUnique<net::FileProtocolHandler>( |
260 base::CreateTaskRunnerWithTraits( | 260 base::CreateTaskRunnerWithTraits( |
261 base::TaskTraits() | 261 {base::MayBlock(), base::TaskPriority::USER_VISIBLE, |
262 .MayBlock() | 262 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}))); |
263 .WithPriority(base::TaskPriority::USER_VISIBLE) | |
264 .WithShutdownBehavior( | |
265 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)))); | |
266 DCHECK(set_protocol); | 263 DCHECK(set_protocol); |
267 #endif | 264 #endif |
268 | 265 |
269 // Set up interceptors in the reverse order. | 266 // Set up interceptors in the reverse order. |
270 std::unique_ptr<net::URLRequestJobFactory> top_job_factory = | 267 std::unique_ptr<net::URLRequestJobFactory> top_job_factory = |
271 std::move(job_factory); | 268 std::move(job_factory); |
272 for (auto i = request_interceptors_.rbegin(); | 269 for (auto i = request_interceptors_.rbegin(); |
273 i != request_interceptors_.rend(); ++i) { | 270 i != request_interceptors_.rend(); ++i) { |
274 top_job_factory.reset(new net::URLRequestInterceptingJobFactory( | 271 top_job_factory.reset(new net::URLRequestInterceptingJobFactory( |
275 std::move(top_job_factory), std::move(*i))); | 272 std::move(top_job_factory), std::move(*i))); |
276 } | 273 } |
277 request_interceptors_.clear(); | 274 request_interceptors_.clear(); |
278 | 275 |
279 storage_->set_job_factory(std::move(top_job_factory)); | 276 storage_->set_job_factory(std::move(top_job_factory)); |
280 } | 277 } |
281 | 278 |
282 return url_request_context_.get(); | 279 return url_request_context_.get(); |
283 } | 280 } |
284 | 281 |
285 scoped_refptr<base::SingleThreadTaskRunner> | 282 scoped_refptr<base::SingleThreadTaskRunner> |
286 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { | 283 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { |
287 return BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); | 284 return BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); |
288 } | 285 } |
289 | 286 |
290 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { | 287 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { |
291 return url_request_context_->host_resolver(); | 288 return url_request_context_->host_resolver(); |
292 } | 289 } |
293 | 290 |
294 } // namespace content | 291 } // namespace content |
OLD | NEW |