| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 virtual ~UploadElementReader() {} | 24 virtual ~UploadElementReader() {} |
| 25 | 25 |
| 26 // Returns this instance's pointer as UploadBytesElementReader when possible, | 26 // Returns this instance's pointer as UploadBytesElementReader when possible, |
| 27 // otherwise returns NULL. | 27 // otherwise returns NULL. |
| 28 virtual const UploadBytesElementReader* AsBytesReader() const; | 28 virtual const UploadBytesElementReader* AsBytesReader() const; |
| 29 | 29 |
| 30 // Returns this instance's pointer as UploadFileElementReader when possible, | 30 // Returns this instance's pointer as UploadFileElementReader when possible, |
| 31 // otherwise returns NULL. | 31 // otherwise returns NULL. |
| 32 virtual const UploadFileElementReader* AsFileReader() const; | 32 virtual const UploadFileElementReader* AsFileReader() const; |
| 33 | 33 |
| 34 // This function must be called before calling any other method. It is not |
| 35 // valid to call any method (other than the destructor) if Init() fails. |
| 36 // This method can be called multiple times. Calling this method after an |
| 37 // Init() success results in resetting the state (i.e. the stream is rewound). |
| 38 // |
| 34 // Initializes the instance synchronously when possible, otherwise does | 39 // Initializes the instance synchronously when possible, otherwise does |
| 35 // initialization aynschronously, returns ERR_IO_PENDING and runs callback. | 40 // initialization aynschronously, returns ERR_IO_PENDING and runs callback. |
| 36 // Calling this method again after a Init() success results in resetting the | 41 // Calling this method again after a Init() success results in resetting the |
| 37 // state. | 42 // state. |
| 38 virtual int Init(const CompletionCallback& callback) = 0; | 43 virtual int Init(const CompletionCallback& callback) = 0; |
| 39 | 44 |
| 40 // Returns the byte-length of the element. For files that do not exist, 0 | 45 // Returns the byte-length of the element. For files that do not exist, 0 |
| 41 // is returned. This is done for consistency with Mozilla. | 46 // is returned. This is done for consistency with Mozilla. |
| 42 virtual uint64_t GetContentLength() const = 0; | 47 virtual uint64_t GetContentLength() const = 0; |
| 43 | 48 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 55 int buf_length, | 60 int buf_length, |
| 56 const CompletionCallback& callback) = 0; | 61 const CompletionCallback& callback) = 0; |
| 57 | 62 |
| 58 private: | 63 private: |
| 59 DISALLOW_COPY_AND_ASSIGN(UploadElementReader); | 64 DISALLOW_COPY_AND_ASSIGN(UploadElementReader); |
| 60 }; | 65 }; |
| 61 | 66 |
| 62 } // namespace net | 67 } // namespace net |
| 63 | 68 |
| 64 #endif // NET_BASE_UPLOAD_ELEMENT_READER_H_ | 69 #endif // NET_BASE_UPLOAD_ELEMENT_READER_H_ |
| OLD | NEW |