[email protected] | 65dcdc5 | 2012-08-20 20:30:46 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 | // Use of this source code is governed by a BSD-style license that can be | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #ifndef NET_URL_REQUEST_FILE_PROTOCOL_HANDLER_H_ | ||||
6 | #define NET_URL_REQUEST_FILE_PROTOCOL_HANDLER_H_ | ||||
7 | |||||
[email protected] | 65dcdc5 | 2012-08-20 20:30:46 | [diff] [blame] | 8 | #include "base/compiler_specific.h" |
Avi Drissman | 13fc893 | 2015-12-20 04:40:46 | [diff] [blame] | 9 | #include "base/macros.h" |
[email protected] | 255620da | 2013-08-19 13:14:29 | [diff] [blame] | 10 | #include "base/memory/ref_counted.h" |
bnc | 81c46c1f | 2016-10-04 16:25:59 | [diff] [blame] | 11 | #include "net/base/net_export.h" |
[email protected] | 65dcdc5 | 2012-08-20 20:30:46 | [diff] [blame] | 12 | #include "net/url_request/url_request_job_factory.h" |
13 | |||||
[email protected] | e0f35c9 | 2013-05-08 16:04:34 | [diff] [blame] | 14 | class GURL; |
15 | |||||
[email protected] | 255620da | 2013-08-19 13:14:29 | [diff] [blame] | 16 | namespace base { |
17 | class TaskRunner; | ||||
18 | } | ||||
19 | |||||
[email protected] | 65dcdc5 | 2012-08-20 20:30:46 | [diff] [blame] | 20 | namespace net { |
21 | |||||
22 | class NetworkDelegate; | ||||
23 | class URLRequestJob; | ||||
24 | |||||
25 | // Implements a ProtocolHandler for File jobs. If |network_delegate_| is NULL, | ||||
26 | // then all file requests will fail with ERR_ACCESS_DENIED. | ||||
27 | class NET_EXPORT FileProtocolHandler : | ||||
28 | public URLRequestJobFactory::ProtocolHandler { | ||||
29 | public: | ||||
[email protected] | 255620da | 2013-08-19 13:14:29 | [diff] [blame] | 30 | explicit FileProtocolHandler( |
31 | const scoped_refptr<base::TaskRunner>& file_task_runner); | ||||
dcheng | b03027d | 2014-10-21 12:00:20 | [diff] [blame] | 32 | ~FileProtocolHandler() override; |
33 | URLRequestJob* MaybeCreateJob( | ||||
34 | URLRequest* request, | ||||
35 | NetworkDelegate* network_delegate) const override; | ||||
36 | bool IsSafeRedirectTarget(const GURL& location) const override; | ||||
[email protected] | 65dcdc5 | 2012-08-20 20:30:46 | [diff] [blame] | 37 | |
38 | private: | ||||
[email protected] | 255620da | 2013-08-19 13:14:29 | [diff] [blame] | 39 | const scoped_refptr<base::TaskRunner> file_task_runner_; |
[email protected] | 65dcdc5 | 2012-08-20 20:30:46 | [diff] [blame] | 40 | DISALLOW_COPY_AND_ASSIGN(FileProtocolHandler); |
41 | }; | ||||
42 | |||||
43 | } // namespace net | ||||
44 | |||||
45 | #endif // NET_URL_REQUEST_FILE_PROTOCOL_HANDLER_H_ |