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_BASE_UPLOAD_ELEMENT_READER_H_ | 5 #ifndef NET_BASE_UPLOAD_ELEMENT_READER_H_ |
6 #define NET_BASE_UPLOAD_ELEMENT_READER_H_ | 6 #define NET_BASE_UPLOAD_ELEMENT_READER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "net/base/completion_callback.h" | 9 #include "net/base/completion_callback.h" |
10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
11 | 11 |
12 namespace net { | 12 namespace net { |
13 | 13 |
14 class IOBuffer; | 14 class IOBuffer; |
15 class UploadBytesElementReader; | 15 class UploadBytesElementReader; |
16 class UploadDiskCacheEntryElementReader; | |
17 class UploadFileElementReader; | 16 class UploadFileElementReader; |
18 | 17 |
19 // An interface to read an upload data element. | 18 // An interface to read an upload data element. |
20 class NET_EXPORT UploadElementReader { | 19 class NET_EXPORT UploadElementReader { |
21 public: | 20 public: |
22 UploadElementReader() {} | 21 UploadElementReader() {} |
23 virtual ~UploadElementReader() {} | 22 virtual ~UploadElementReader() {} |
24 | 23 |
25 // Returns this instance's pointer as UploadDiskCacheEntryElementReader when | |
26 // possible, otherwise returns nullptr. | |
27 virtual const UploadDiskCacheEntryElementReader* | |
28 AsDiskCacheEntryReaderForTests() const; | |
29 | |
30 // Returns this instance's pointer as UploadBytesElementReader when possible, | 24 // Returns this instance's pointer as UploadBytesElementReader when possible, |
31 // otherwise returns NULL. | 25 // otherwise returns NULL. |
32 virtual const UploadBytesElementReader* AsBytesReader() const; | 26 virtual const UploadBytesElementReader* AsBytesReader() const; |
33 | 27 |
34 // Returns this instance's pointer as UploadFileElementReader when possible, | 28 // Returns this instance's pointer as UploadFileElementReader when possible, |
35 // otherwise returns NULL. | 29 // otherwise returns NULL. |
36 virtual const UploadFileElementReader* AsFileReader() const; | 30 virtual const UploadFileElementReader* AsFileReader() const; |
37 | 31 |
38 // Initializes the instance synchronously when possible, otherwise does | 32 // Initializes the instance synchronously when possible, otherwise does |
39 // initialization aynschronously, returns ERR_IO_PENDING and runs callback. | 33 // initialization aynschronously, returns ERR_IO_PENDING and runs callback. |
(...skipping 19 matching lines...) Expand all Loading... |
59 int buf_length, | 53 int buf_length, |
60 const CompletionCallback& callback) = 0; | 54 const CompletionCallback& callback) = 0; |
61 | 55 |
62 private: | 56 private: |
63 DISALLOW_COPY_AND_ASSIGN(UploadElementReader); | 57 DISALLOW_COPY_AND_ASSIGN(UploadElementReader); |
64 }; | 58 }; |
65 | 59 |
66 } // namespace net | 60 } // namespace net |
67 | 61 |
68 #endif // NET_BASE_UPLOAD_ELEMENT_READER_H_ | 62 #endif // NET_BASE_UPLOAD_ELEMENT_READER_H_ |
OLD | NEW |