OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_BROWSER_FILEAPI_UPLOAD_FILE_SYSTEM_FILE_ELEMENT_READER_H_ | 5 #ifndef CONTENT_BROWSER_FILEAPI_UPLOAD_FILE_SYSTEM_FILE_ELEMENT_READER_H_ |
6 #define CONTENT_BROWSER_FILEAPI_UPLOAD_FILE_SYSTEM_FILE_ELEMENT_READER_H_ | 6 #define CONTENT_BROWSER_FILEAPI_UPLOAD_FILE_SYSTEM_FILE_ELEMENT_READER_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
9 #include "base/time/time.h" | 11 #include "base/time/time.h" |
10 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
11 #include "net/base/upload_element_reader.h" | 13 #include "net/base/upload_element_reader.h" |
12 #include "url/gurl.h" | 14 #include "url/gurl.h" |
13 | 15 |
14 namespace storage { | 16 namespace storage { |
15 class FileStreamReader; | 17 class FileStreamReader; |
16 } | 18 } |
17 | 19 |
18 namespace storage { | 20 namespace storage { |
19 class FileSystemContext; | 21 class FileSystemContext; |
20 } | 22 } |
21 | 23 |
22 namespace content { | 24 namespace content { |
23 | 25 |
24 // An UploadElementReader implementation for filesystem file. | 26 // An UploadElementReader implementation for filesystem file. |
25 class CONTENT_EXPORT UploadFileSystemFileElementReader : | 27 class CONTENT_EXPORT UploadFileSystemFileElementReader : |
26 NON_EXPORTED_BASE(public net::UploadElementReader) { | 28 NON_EXPORTED_BASE(public net::UploadElementReader) { |
27 public: | 29 public: |
28 UploadFileSystemFileElementReader( | 30 UploadFileSystemFileElementReader( |
29 storage::FileSystemContext* file_system_context, | 31 storage::FileSystemContext* file_system_context, |
30 const GURL& url, | 32 const GURL& url, |
31 uint64 range_offset, | 33 uint64_t range_offset, |
32 uint64 range_length, | 34 uint64_t range_length, |
33 const base::Time& expected_modification_time); | 35 const base::Time& expected_modification_time); |
34 ~UploadFileSystemFileElementReader() override; | 36 ~UploadFileSystemFileElementReader() override; |
35 | 37 |
36 // UploadElementReader overrides: | 38 // UploadElementReader overrides: |
37 int Init(const net::CompletionCallback& callback) override; | 39 int Init(const net::CompletionCallback& callback) override; |
38 uint64 GetContentLength() const override; | 40 uint64_t GetContentLength() const override; |
39 uint64 BytesRemaining() const override; | 41 uint64_t BytesRemaining() const override; |
40 int Read(net::IOBuffer* buf, | 42 int Read(net::IOBuffer* buf, |
41 int buf_length, | 43 int buf_length, |
42 const net::CompletionCallback& callback) override; | 44 const net::CompletionCallback& callback) override; |
43 | 45 |
44 private: | 46 private: |
45 void OnGetLength(const net::CompletionCallback& callback, int64 result); | 47 void OnGetLength(const net::CompletionCallback& callback, int64_t result); |
46 void OnRead(const net::CompletionCallback& callback, int result); | 48 void OnRead(const net::CompletionCallback& callback, int result); |
47 | 49 |
48 scoped_refptr<storage::FileSystemContext> file_system_context_; | 50 scoped_refptr<storage::FileSystemContext> file_system_context_; |
49 const GURL url_; | 51 const GURL url_; |
50 const uint64 range_offset_; | 52 const uint64_t range_offset_; |
51 const uint64 range_length_; | 53 const uint64_t range_length_; |
52 const base::Time expected_modification_time_; | 54 const base::Time expected_modification_time_; |
53 | 55 |
54 scoped_ptr<storage::FileStreamReader> stream_reader_; | 56 scoped_ptr<storage::FileStreamReader> stream_reader_; |
55 | 57 |
56 uint64 stream_length_; | 58 uint64_t stream_length_; |
57 uint64 position_; | 59 uint64_t position_; |
58 | 60 |
59 base::WeakPtrFactory<UploadFileSystemFileElementReader> weak_ptr_factory_; | 61 base::WeakPtrFactory<UploadFileSystemFileElementReader> weak_ptr_factory_; |
60 | 62 |
61 DISALLOW_COPY_AND_ASSIGN(UploadFileSystemFileElementReader); | 63 DISALLOW_COPY_AND_ASSIGN(UploadFileSystemFileElementReader); |
62 }; | 64 }; |
63 | 65 |
64 } // namespace content | 66 } // namespace content |
65 | 67 |
66 #endif // CONTENT_BROWSER_FILEAPI_UPLOAD_FILE_SYSTEM_FILE_ELEMENT_READER_H_ | 68 #endif // CONTENT_BROWSER_FILEAPI_UPLOAD_FILE_SYSTEM_FILE_ELEMENT_READER_H_ |
OLD | NEW |