OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ |
6 #define NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 // A request job that handles reading file URLs | 30 // A request job that handles reading file URLs |
31 class NET_EXPORT URLRequestFileJob : public URLRequestJob { | 31 class NET_EXPORT URLRequestFileJob : public URLRequestJob { |
32 public: | 32 public: |
33 URLRequestFileJob(URLRequest* request, | 33 URLRequestFileJob(URLRequest* request, |
34 NetworkDelegate* network_delegate, | 34 NetworkDelegate* network_delegate, |
35 const base::FilePath& file_path, | 35 const base::FilePath& file_path, |
36 const scoped_refptr<base::TaskRunner>& file_task_runner); | 36 const scoped_refptr<base::TaskRunner>& file_task_runner); |
37 | 37 |
38 // URLRequestJob: | 38 // URLRequestJob: |
39 virtual void Start() override; | 39 void Start() override; |
40 virtual void Kill() override; | 40 void Kill() override; |
41 virtual bool ReadRawData(IOBuffer* buf, | 41 bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read) override; |
42 int buf_size, | 42 bool IsRedirectResponse(GURL* location, int* http_status_code) override; |
43 int* bytes_read) override; | 43 Filter* SetupFilter() const override; |
44 virtual bool IsRedirectResponse(GURL* location, | 44 bool GetMimeType(std::string* mime_type) const override; |
45 int* http_status_code) override; | 45 void SetExtraRequestHeaders(const HttpRequestHeaders& headers) override; |
46 virtual Filter* SetupFilter() const override; | |
47 virtual bool GetMimeType(std::string* mime_type) const override; | |
48 virtual void SetExtraRequestHeaders( | |
49 const HttpRequestHeaders& headers) override; | |
50 | 46 |
51 // An interface for subclasses who wish to monitor read operations. | 47 // An interface for subclasses who wish to monitor read operations. |
52 virtual void OnSeekComplete(int64 result); | 48 virtual void OnSeekComplete(int64 result); |
53 virtual void OnReadComplete(net::IOBuffer* buf, int result); | 49 virtual void OnReadComplete(net::IOBuffer* buf, int result); |
54 | 50 |
55 protected: | 51 protected: |
56 virtual ~URLRequestFileJob(); | 52 ~URLRequestFileJob() override; |
57 | 53 |
58 int64 remaining_bytes() const { return remaining_bytes_; } | 54 int64 remaining_bytes() const { return remaining_bytes_; } |
59 | 55 |
60 // The OS-specific full path name of the file | 56 // The OS-specific full path name of the file |
61 base::FilePath file_path_; | 57 base::FilePath file_path_; |
62 | 58 |
63 private: | 59 private: |
64 // Meta information about the file. It's used as a member in the | 60 // Meta information about the file. It's used as a member in the |
65 // URLRequestFileJob and also passed between threads because disk access is | 61 // URLRequestFileJob and also passed between threads because disk access is |
66 // necessary to obtain it. | 62 // necessary to obtain it. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 int64 remaining_bytes_; | 101 int64 remaining_bytes_; |
106 | 102 |
107 base::WeakPtrFactory<URLRequestFileJob> weak_ptr_factory_; | 103 base::WeakPtrFactory<URLRequestFileJob> weak_ptr_factory_; |
108 | 104 |
109 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); | 105 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); |
110 }; | 106 }; |
111 | 107 |
112 } // namespace net | 108 } // namespace net |
113 | 109 |
114 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ | 110 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ |
OLD | NEW |