blob: 954d0162921366cad2bde8bb7b2a8eb5298711e2 [file] [log] [blame]
[email protected]65dcdc52012-08-20 20:30:461// 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]65dcdc52012-08-20 20:30:468#include "base/compiler_specific.h"
Avi Drissman13fc8932015-12-20 04:40:469#include "base/macros.h"
[email protected]255620da2013-08-19 13:14:2910#include "base/memory/ref_counted.h"
bnc81c46c1f2016-10-04 16:25:5911#include "net/base/net_export.h"
[email protected]65dcdc52012-08-20 20:30:4612#include "net/url_request/url_request_job_factory.h"
13
[email protected]e0f35c92013-05-08 16:04:3414class GURL;
15
[email protected]255620da2013-08-19 13:14:2916namespace base {
17class TaskRunner;
18}
19
[email protected]65dcdc52012-08-20 20:30:4620namespace net {
21
22class NetworkDelegate;
23class 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.
27class NET_EXPORT FileProtocolHandler :
28 public URLRequestJobFactory::ProtocolHandler {
29 public:
[email protected]255620da2013-08-19 13:14:2930 explicit FileProtocolHandler(
31 const scoped_refptr<base::TaskRunner>& file_task_runner);
dchengb03027d2014-10-21 12:00:2032 ~FileProtocolHandler() override;
33 URLRequestJob* MaybeCreateJob(
34 URLRequest* request,
35 NetworkDelegate* network_delegate) const override;
36 bool IsSafeRedirectTarget(const GURL& location) const override;
[email protected]65dcdc52012-08-20 20:30:4637
38 private:
[email protected]255620da2013-08-19 13:14:2939 const scoped_refptr<base::TaskRunner> file_task_runner_;
[email protected]65dcdc52012-08-20 20:30:4640 DISALLOW_COPY_AND_ASSIGN(FileProtocolHandler);
41};
42
43} // namespace net
44
45#endif // NET_URL_REQUEST_FILE_PROTOCOL_HANDLER_H_