Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(997)

Side by Side Diff: chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader.h

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "webkit/browser/blob/file_stream_reader.h" 12 #include "storage/browser/blob/file_stream_reader.h"
13 #include "webkit/browser/fileapi/file_system_url.h" 13 #include "storage/browser/fileapi/file_system_url.h"
14 14
15 namespace chromeos { 15 namespace chromeos {
16 namespace file_system_provider { 16 namespace file_system_provider {
17 17
18 struct EntryMetadata; 18 struct EntryMetadata;
19 class ProvidedFileSystemInterface; 19 class ProvidedFileSystemInterface;
20 20
21 // Implements a streamed file reader. It is lazily initialized by the first call 21 // Implements a streamed file reader. It is lazily initialized by the first call
22 // to Read(). 22 // to Read().
23 class FileStreamReader : public webkit_blob::FileStreamReader { 23 class FileStreamReader : public storage::FileStreamReader {
24 public: 24 public:
25 typedef base::Callback< 25 typedef base::Callback<
26 void(base::WeakPtr<ProvidedFileSystemInterface> file_system, 26 void(base::WeakPtr<ProvidedFileSystemInterface> file_system,
27 const base::FilePath& file_path, 27 const base::FilePath& file_path,
28 int file_handle, 28 int file_handle,
29 base::File::Error result)> OpenFileCompletedCallback; 29 base::File::Error result)> OpenFileCompletedCallback;
30 30
31 FileStreamReader(fileapi::FileSystemContext* context, 31 FileStreamReader(storage::FileSystemContext* context,
32 const fileapi::FileSystemURL& url, 32 const storage::FileSystemURL& url,
33 int64 initial_offset, 33 int64 initial_offset,
34 const base::Time& expected_modification_time); 34 const base::Time& expected_modification_time);
35 35
36 virtual ~FileStreamReader(); 36 virtual ~FileStreamReader();
37 37
38 // webkit_blob::FileStreamReader overrides. 38 // storage::FileStreamReader overrides.
39 virtual int Read(net::IOBuffer* buf, 39 virtual int Read(net::IOBuffer* buf,
40 int buf_len, 40 int buf_len,
41 const net::CompletionCallback& callback) OVERRIDE; 41 const net::CompletionCallback& callback) OVERRIDE;
42 virtual int64 GetLength( 42 virtual int64 GetLength(
43 const net::Int64CompletionCallback& callback) OVERRIDE; 43 const net::Int64CompletionCallback& callback) OVERRIDE;
44 44
45 private: 45 private:
46 // State of the file stream reader. 46 // State of the file stream reader.
47 enum State { NOT_INITIALIZED, INITIALIZING, INITIALIZED, FAILED }; 47 enum State { NOT_INITIALIZED, INITIALIZING, INITIALIZED, FAILED };
48 48
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 base::File::Error result); 87 base::File::Error result);
88 88
89 // Same as Read(), but called after initializing is completed. 89 // Same as Read(), but called after initializing is completed.
90 void ReadAfterInitialized(scoped_refptr<net::IOBuffer> buffer, 90 void ReadAfterInitialized(scoped_refptr<net::IOBuffer> buffer,
91 int buffer_length, 91 int buffer_length,
92 const net::CompletionCallback& callback); 92 const net::CompletionCallback& callback);
93 93
94 // Same as GetLength(), but called after initializing is completed. 94 // Same as GetLength(), but called after initializing is completed.
95 void GetLengthAfterInitialized(const net::Int64CompletionCallback& callback); 95 void GetLengthAfterInitialized(const net::Int64CompletionCallback& callback);
96 96
97 fileapi::FileSystemURL url_; 97 storage::FileSystemURL url_;
98 int64 current_offset_; 98 int64 current_offset_;
99 int64 current_length_; 99 int64 current_length_;
100 base::Time expected_modification_time_; 100 base::Time expected_modification_time_;
101 State state_; 101 State state_;
102 102
103 // Set during initialization (in case of a success). 103 // Set during initialization (in case of a success).
104 base::WeakPtr<ProvidedFileSystemInterface> file_system_; 104 base::WeakPtr<ProvidedFileSystemInterface> file_system_;
105 base::FilePath file_path_; 105 base::FilePath file_path_;
106 int file_handle_; 106 int file_handle_;
107 107
108 base::WeakPtrFactory<FileStreamReader> weak_ptr_factory_; 108 base::WeakPtrFactory<FileStreamReader> weak_ptr_factory_;
109 DISALLOW_COPY_AND_ASSIGN(FileStreamReader); 109 DISALLOW_COPY_AND_ASSIGN(FileStreamReader);
110 }; 110 };
111 111
112 } // namespace file_system_provider 112 } // namespace file_system_provider
113 } // namespace chromeos 113 } // namespace chromeos
114 114
115 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_FILE_STREAM_READ ER_H_ 115 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_FILE_STREAM_READ ER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698