| 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_FILE_ELEMENT_READER_H_ | 5 #ifndef NET_BASE_UPLOAD_FILE_ELEMENT_READER_H_ |
| 6 #define NET_BASE_UPLOAD_FILE_ELEMENT_READER_H_ | 6 #define NET_BASE_UPLOAD_FILE_ELEMENT_READER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 uint64 range_offset, | 24 uint64 range_offset, |
| 25 uint64 range_length, | 25 uint64 range_length, |
| 26 const base::Time& expected_modification_time); | 26 const base::Time& expected_modification_time); |
| 27 virtual ~UploadFileElementReader(); | 27 virtual ~UploadFileElementReader(); |
| 28 | 28 |
| 29 // UploadElementReader overrides: | 29 // UploadElementReader overrides: |
| 30 virtual int Init(const CompletionCallback& callback) OVERRIDE; | 30 virtual int Init(const CompletionCallback& callback) OVERRIDE; |
| 31 virtual int InitSync() OVERRIDE; | 31 virtual int InitSync() OVERRIDE; |
| 32 virtual uint64 GetContentLength() const OVERRIDE; | 32 virtual uint64 GetContentLength() const OVERRIDE; |
| 33 virtual uint64 BytesRemaining() const OVERRIDE; | 33 virtual uint64 BytesRemaining() const OVERRIDE; |
| 34 virtual int ReadSync(char* buf, int buf_length) OVERRIDE; | 34 virtual int Read(IOBuffer* buf, |
| 35 int buf_length, |
| 36 const CompletionCallback& callback) OVERRIDE; |
| 37 virtual int ReadSync(IOBuffer* buf, int buf_length) OVERRIDE; |
| 35 | 38 |
| 36 private: | 39 private: |
| 37 // This method is used to implement Init(). | 40 // This method is used to implement Init(). |
| 38 void OnInitCompleted(scoped_ptr<FileStream>* file_stream, | 41 void OnInitCompleted(scoped_ptr<FileStream>* file_stream, |
| 39 uint64* content_length, | 42 uint64* content_length, |
| 40 int* result, | 43 int* result, |
| 41 const CompletionCallback& callback); | 44 const CompletionCallback& callback); |
| 42 | 45 |
| 46 // This method is used to implement Read(). |
| 47 void OnReadCompleted(scoped_ptr<FileStream> file_stream, |
| 48 int* result, |
| 49 const CompletionCallback& callback); |
| 50 |
| 43 // Sets an value to override the result for GetContentLength(). | 51 // Sets an value to override the result for GetContentLength(). |
| 44 // Used for tests. | 52 // Used for tests. |
| 45 struct NET_EXPORT_PRIVATE ScopedOverridingContentLengthForTests { | 53 struct NET_EXPORT_PRIVATE ScopedOverridingContentLengthForTests { |
| 46 ScopedOverridingContentLengthForTests(uint64 value); | 54 ScopedOverridingContentLengthForTests(uint64 value); |
| 47 ~ScopedOverridingContentLengthForTests(); | 55 ~ScopedOverridingContentLengthForTests(); |
| 48 }; | 56 }; |
| 49 | 57 |
| 50 FilePath path_; | 58 FilePath path_; |
| 51 uint64 range_offset_; | 59 uint64 range_offset_; |
| 52 uint64 range_length_; | 60 uint64 range_length_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 63 UploadFileSmallerThanLength); | 71 UploadFileSmallerThanLength); |
| 64 FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionSpdy3Test, | 72 FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionSpdy3Test, |
| 65 UploadFileSmallerThanLength); | 73 UploadFileSmallerThanLength); |
| 66 | 74 |
| 67 DISALLOW_COPY_AND_ASSIGN(UploadFileElementReader); | 75 DISALLOW_COPY_AND_ASSIGN(UploadFileElementReader); |
| 68 }; | 76 }; |
| 69 | 77 |
| 70 } // namespace net | 78 } // namespace net |
| 71 | 79 |
| 72 #endif // NET_BASE_UPLOAD_FILE_ELEMENT_READER_H_ | 80 #endif // NET_BASE_UPLOAD_FILE_ELEMENT_READER_H_ |
| OLD | NEW |