| 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 CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_FILE_STREAM_READER_
H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_FILE_STREAM_READER_
H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_FILE_STREAM_READER_
H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_FILE_STREAM_READER_
H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 11 |
| 10 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 11 #include "base/macros.h" | 13 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 15 #include "storage/browser/fileapi/file_stream_reader.h" | 16 #include "storage/browser/fileapi/file_stream_reader.h" |
| 16 #include "storage/browser/fileapi/file_system_url.h" | 17 #include "storage/browser/fileapi/file_system_url.h" |
| 17 | 18 |
| 18 namespace chromeos { | 19 namespace chromeos { |
| 19 namespace file_system_provider { | 20 namespace file_system_provider { |
| 20 | 21 |
| 21 struct EntryMetadata; | 22 struct EntryMetadata; |
| 22 class ProvidedFileSystemInterface; | 23 class ProvidedFileSystemInterface; |
| 23 | 24 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 65 |
| 65 // Called when opening a file is completed with either a success or an error. | 66 // Called when opening a file is completed with either a success or an error. |
| 66 void OnOpenFileCompleted( | 67 void OnOpenFileCompleted( |
| 67 const base::Closure& pending_closure, | 68 const base::Closure& pending_closure, |
| 68 const net::Int64CompletionCallback& error_callback, | 69 const net::Int64CompletionCallback& error_callback, |
| 69 base::File::Error result); | 70 base::File::Error result); |
| 70 | 71 |
| 71 // Called when initialization is completed with either a success or an error. | 72 // Called when initialization is completed with either a success or an error. |
| 72 void OnInitializeCompleted(const base::Closure& pending_closure, | 73 void OnInitializeCompleted(const base::Closure& pending_closure, |
| 73 const net::Int64CompletionCallback& error_callback, | 74 const net::Int64CompletionCallback& error_callback, |
| 74 scoped_ptr<EntryMetadata> metadata, | 75 std::unique_ptr<EntryMetadata> metadata, |
| 75 base::File::Error result); | 76 base::File::Error result); |
| 76 | 77 |
| 77 // Called when a file system provider returns chunk of read data. Note, that | 78 // Called when a file system provider returns chunk of read data. Note, that |
| 78 // this may be called multiple times per single Read() call, as long as | 79 // this may be called multiple times per single Read() call, as long as |
| 79 // |has_more| is set to true. |result| is set to success only if reading is | 80 // |has_more| is set to true. |result| is set to success only if reading is |
| 80 // successful, and the file has not changed while reading. | 81 // successful, and the file has not changed while reading. |
| 81 void OnReadChunkReceived(const net::CompletionCallback& callback, | 82 void OnReadChunkReceived(const net::CompletionCallback& callback, |
| 82 int chunk_length, | 83 int chunk_length, |
| 83 bool has_more, | 84 bool has_more, |
| 84 base::File::Error result); | 85 base::File::Error result); |
| 85 | 86 |
| 86 // Called when fetching length of the file is completed with either a success | 87 // Called when fetching length of the file is completed with either a success |
| 87 // or an error. | 88 // or an error. |
| 88 void OnGetMetadataForGetLengthReceived( | 89 void OnGetMetadataForGetLengthReceived( |
| 89 const net::Int64CompletionCallback& callback, | 90 const net::Int64CompletionCallback& callback, |
| 90 scoped_ptr<EntryMetadata> metadata, | 91 std::unique_ptr<EntryMetadata> metadata, |
| 91 base::File::Error result); | 92 base::File::Error result); |
| 92 | 93 |
| 93 // Same as Read(), but called after initializing is completed. | 94 // Same as Read(), but called after initializing is completed. |
| 94 void ReadAfterInitialized(scoped_refptr<net::IOBuffer> buffer, | 95 void ReadAfterInitialized(scoped_refptr<net::IOBuffer> buffer, |
| 95 int buffer_length, | 96 int buffer_length, |
| 96 const net::CompletionCallback& callback); | 97 const net::CompletionCallback& callback); |
| 97 | 98 |
| 98 // Same as GetLength(), but called after initializing is completed. | 99 // Same as GetLength(), but called after initializing is completed. |
| 99 void GetLengthAfterInitialized(const net::Int64CompletionCallback& callback); | 100 void GetLengthAfterInitialized(const net::Int64CompletionCallback& callback); |
| 100 | 101 |
| 101 storage::FileSystemURL url_; | 102 storage::FileSystemURL url_; |
| 102 int64_t current_offset_; | 103 int64_t current_offset_; |
| 103 int64_t current_length_; | 104 int64_t current_length_; |
| 104 base::Time expected_modification_time_; | 105 base::Time expected_modification_time_; |
| 105 scoped_refptr<OperationRunner> runner_; | 106 scoped_refptr<OperationRunner> runner_; |
| 106 State state_; | 107 State state_; |
| 107 | 108 |
| 108 base::WeakPtrFactory<FileStreamReader> weak_ptr_factory_; | 109 base::WeakPtrFactory<FileStreamReader> weak_ptr_factory_; |
| 109 DISALLOW_COPY_AND_ASSIGN(FileStreamReader); | 110 DISALLOW_COPY_AND_ASSIGN(FileStreamReader); |
| 110 }; | 111 }; |
| 111 | 112 |
| 112 } // namespace file_system_provider | 113 } // namespace file_system_provider |
| 113 } // namespace chromeos | 114 } // namespace chromeos |
| 114 | 115 |
| 115 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_FILE_STREAM_READ
ER_H_ | 116 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_FILE_STREAM_READ
ER_H_ |
| OLD | NEW |