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