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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/fileapi/file_stream_writer.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_WRITER_ H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_FILE_STREAM_WRITER_ H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_FILE_STREAM_WRITER_ H_ 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_FILE_STREAM_WRITER_ H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "webkit/browser/fileapi/file_stream_writer.h" 13 #include "storage/browser/fileapi/file_stream_writer.h"
14 #include "webkit/browser/fileapi/file_system_url.h" 14 #include "storage/browser/fileapi/file_system_url.h"
15 15
16 namespace chromeos { 16 namespace chromeos {
17 namespace file_system_provider { 17 namespace file_system_provider {
18 18
19 class ProvidedFileSystemInterface; 19 class ProvidedFileSystemInterface;
20 20
21 // Implements a streamed file writer. It is lazily initialized by the first call 21 // Implements a streamed file writer. It is lazily initialized by the first call
22 // to Write(). 22 // to Write().
23 class FileStreamWriter : public fileapi::FileStreamWriter { 23 class FileStreamWriter : public storage::FileStreamWriter {
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 FileStreamWriter(const fileapi::FileSystemURL& url, int64 initial_offset); 31 FileStreamWriter(const storage::FileSystemURL& url, int64 initial_offset);
32 32
33 virtual ~FileStreamWriter(); 33 virtual ~FileStreamWriter();
34 34
35 // fileapi::FileStreamWriter overrides. 35 // storage::FileStreamWriter overrides.
36 virtual int Write(net::IOBuffer* buf, 36 virtual int Write(net::IOBuffer* buf,
37 int buf_len, 37 int buf_len,
38 const net::CompletionCallback& callback) OVERRIDE; 38 const net::CompletionCallback& callback) OVERRIDE;
39 virtual int Cancel(const net::CompletionCallback& callback) OVERRIDE; 39 virtual int Cancel(const net::CompletionCallback& callback) OVERRIDE;
40 virtual int Flush(const net::CompletionCallback& callback) OVERRIDE; 40 virtual int Flush(const net::CompletionCallback& callback) OVERRIDE;
41 41
42 private: 42 private:
43 // State of the file stream writer. 43 // State of the file stream writer.
44 enum State { NOT_INITIALIZED, INITIALIZING, INITIALIZED, FAILED }; 44 enum State { NOT_INITIALIZED, INITIALIZING, INITIALIZED, FAILED };
45 45
(...skipping 17 matching lines...) Expand all
63 base::WeakPtr<ProvidedFileSystemInterface> file_system, 63 base::WeakPtr<ProvidedFileSystemInterface> file_system,
64 const base::FilePath& file_path, 64 const base::FilePath& file_path,
65 int file_handle, 65 int file_handle,
66 base::File::Error result); 66 base::File::Error result);
67 67
68 // Same as Write(), but called after initializing is completed. 68 // Same as Write(), but called after initializing is completed.
69 void WriteAfterInitialized(scoped_refptr<net::IOBuffer> buffer, 69 void WriteAfterInitialized(scoped_refptr<net::IOBuffer> buffer,
70 int buffer_length, 70 int buffer_length,
71 const net::CompletionCallback& callback); 71 const net::CompletionCallback& callback);
72 72
73 fileapi::FileSystemURL url_; 73 storage::FileSystemURL url_;
74 int64 current_offset_; 74 int64 current_offset_;
75 State state_; 75 State state_;
76 76
77 // Set during initialization (in case of a success). 77 // Set during initialization (in case of a success).
78 base::WeakPtr<ProvidedFileSystemInterface> file_system_; 78 base::WeakPtr<ProvidedFileSystemInterface> file_system_;
79 base::FilePath file_path_; 79 base::FilePath file_path_;
80 int file_handle_; 80 int file_handle_;
81 81
82 base::WeakPtrFactory<FileStreamWriter> weak_ptr_factory_; 82 base::WeakPtrFactory<FileStreamWriter> weak_ptr_factory_;
83 DISALLOW_COPY_AND_ASSIGN(FileStreamWriter); 83 DISALLOW_COPY_AND_ASSIGN(FileStreamWriter);
84 }; 84 };
85 85
86 } // namespace file_system_provider 86 } // namespace file_system_provider
87 } // namespace chromeos 87 } // namespace chromeos
88 88
89 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_FILE_STREAM_WRIT ER_H_ 89 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_FILE_STREAM_WRIT ER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698