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