OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/browser/android/content_protocol_handler_impl.h" | 5 #include "content/browser/android/content_protocol_handler_impl.h" |
6 | 6 |
| 7 #include "base/memory/ptr_util.h" |
7 #include "base/task_runner.h" | 8 #include "base/task_runner.h" |
8 #include "content/browser/android/url_request_content_job.h" | 9 #include "content/browser/android/url_request_content_job.h" |
9 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
10 #include "net/url_request/url_request.h" | 11 #include "net/url_request/url_request.h" |
11 #include "net/url_request/url_request_error_job.h" | 12 #include "net/url_request/url_request_error_job.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 | 15 |
15 // static | 16 // static |
16 scoped_ptr<ContentProtocolHandler> ContentProtocolHandler::Create( | 17 std::unique_ptr<ContentProtocolHandler> ContentProtocolHandler::Create( |
17 const scoped_refptr<base::TaskRunner>& content_task_runner) { | 18 const scoped_refptr<base::TaskRunner>& content_task_runner) { |
18 return make_scoped_ptr(new ContentProtocolHandlerImpl(content_task_runner)); | 19 return base::WrapUnique(new ContentProtocolHandlerImpl(content_task_runner)); |
19 } | 20 } |
20 | 21 |
21 ContentProtocolHandlerImpl::ContentProtocolHandlerImpl( | 22 ContentProtocolHandlerImpl::ContentProtocolHandlerImpl( |
22 const scoped_refptr<base::TaskRunner>& content_task_runner) | 23 const scoped_refptr<base::TaskRunner>& content_task_runner) |
23 : content_task_runner_(content_task_runner) {} | 24 : content_task_runner_(content_task_runner) {} |
24 | 25 |
25 ContentProtocolHandlerImpl::~ContentProtocolHandlerImpl() {} | 26 ContentProtocolHandlerImpl::~ContentProtocolHandlerImpl() {} |
26 | 27 |
27 net::URLRequestJob* ContentProtocolHandlerImpl::MaybeCreateJob( | 28 net::URLRequestJob* ContentProtocolHandlerImpl::MaybeCreateJob( |
28 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { | 29 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { |
29 if (!network_delegate) { | 30 if (!network_delegate) { |
30 return new net::URLRequestErrorJob( | 31 return new net::URLRequestErrorJob( |
31 request, network_delegate, net::ERR_ACCESS_DENIED); | 32 request, network_delegate, net::ERR_ACCESS_DENIED); |
32 } | 33 } |
33 return new URLRequestContentJob( | 34 return new URLRequestContentJob( |
34 request, network_delegate, base::FilePath(request->url().spec()), | 35 request, network_delegate, base::FilePath(request->url().spec()), |
35 content_task_runner_); | 36 content_task_runner_); |
36 } | 37 } |
37 | 38 |
38 bool ContentProtocolHandlerImpl::IsSafeRedirectTarget( | 39 bool ContentProtocolHandlerImpl::IsSafeRedirectTarget( |
39 const GURL& location) const { | 40 const GURL& location) const { |
40 return false; | 41 return false; |
41 } | 42 } |
42 | 43 |
43 } // namespace content | 44 } // namespace content |
OLD | NEW |