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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_file_system_proxy.h

Issue 10874028: Rename GDataFileSystem* to DriveFileSystem* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remaining manual changes Created 8 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
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_
7
8 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h"
9 #include "chrome/browser/chromeos/gdata/gdata_file_system_interface.h"
10 #include "webkit/chromeos/fileapi/remote_file_system_proxy.h"
11
12 namespace fileapi {
13 class FileSystemURL;
14 }
15
16 namespace gdata {
17
18 class DriveEntryProto;
19 class GDataFileSystemInterface;
20
21 typedef std::vector<DriveEntryProto> DriveEntryProtoVector;
22
23 // Implementation of File API's remote file system proxy for GData file system.
24 class GDataFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface {
25 public:
26 // |file_system| is the GDataFileSystem instance owned by GDataSystemService.
27 explicit GDataFileSystemProxy(GDataFileSystemInterface* file_system);
28
29 // fileapi::RemoteFileSystemProxyInterface overrides.
30 virtual void GetFileInfo(
31 const fileapi::FileSystemURL& url,
32 const fileapi::FileSystemOperationInterface::GetMetadataCallback&
33 callback) OVERRIDE;
34 virtual void Copy(
35 const fileapi::FileSystemURL& src_url,
36 const fileapi::FileSystemURL& dest_url,
37 const fileapi::FileSystemOperationInterface::StatusCallback& callback)
38 OVERRIDE;
39 virtual void Move(
40 const fileapi::FileSystemURL& src_url,
41 const fileapi::FileSystemURL& dest_url,
42 const fileapi::FileSystemOperationInterface::StatusCallback& callback)
43 OVERRIDE;
44 virtual void ReadDirectory(const fileapi::FileSystemURL& url,
45 const fileapi::FileSystemOperationInterface::ReadDirectoryCallback&
46 callback) OVERRIDE;
47 virtual void Remove(
48 const fileapi::FileSystemURL& url, bool recursive,
49 const fileapi::FileSystemOperationInterface::StatusCallback& callback)
50 OVERRIDE;
51 virtual void CreateDirectory(
52 const fileapi::FileSystemURL& file_url,
53 bool exclusive,
54 bool recursive,
55 const fileapi::FileSystemOperationInterface::StatusCallback& callback)
56 OVERRIDE;
57 virtual void CreateFile(
58 const fileapi::FileSystemURL& file_url,
59 bool exclusive,
60 const fileapi::FileSystemOperationInterface::StatusCallback& callback)
61 OVERRIDE;
62 virtual void Truncate(
63 const fileapi::FileSystemURL& file_url, int64 length,
64 const fileapi::FileSystemOperationInterface::StatusCallback& callback)
65 OVERRIDE;
66 virtual void CreateSnapshotFile(
67 const fileapi::FileSystemURL& url,
68 const fileapi::FileSystemOperationInterface::SnapshotFileCallback&
69 callback) OVERRIDE;
70 virtual void CreateWritableSnapshotFile(
71 const fileapi::FileSystemURL& url,
72 const fileapi::WritableSnapshotFile& callback) OVERRIDE;
73 virtual void OpenFile(
74 const fileapi::FileSystemURL& url,
75 int file_flags,
76 base::ProcessHandle peer_handle,
77 const fileapi::FileSystemOperationInterface::OpenFileCallback&
78 callback) OVERRIDE;
79 virtual void NotifyCloseFile(const fileapi::FileSystemURL& url) OVERRIDE;
80 // TODO(zelidrag): More methods to follow as we implement other parts of FSO.
81
82 protected:
83 virtual ~GDataFileSystemProxy();
84
85 private:
86 // Checks if a given |url| belongs to this file system. If it does,
87 // the call will return true and fill in |file_path| with a file path of
88 // a corresponding element within this file system.
89 static bool ValidateUrl(const fileapi::FileSystemURL& url,
90 FilePath* file_path);
91
92 // Helper callback for relaying reply for status callbacks to the
93 // calling thread.
94 void OnStatusCallback(
95 const fileapi::FileSystemOperationInterface::StatusCallback& callback,
96 DriveFileError error);
97
98 // Helper callback for relaying reply for metadata retrieval request to the
99 // calling thread.
100 void OnGetMetadata(
101 const FilePath& file_path,
102 const fileapi::FileSystemOperationInterface::GetMetadataCallback&
103 callback,
104 DriveFileError error,
105 scoped_ptr<DriveEntryProto> entry_proto);
106
107 // Helper callback for relaying reply for GetEntryInfoByPath() to the
108 // calling thread.
109 void OnGetEntryInfoByPath(
110 const FilePath& entry_path,
111 const fileapi::FileSystemOperationInterface::SnapshotFileCallback&
112 callback,
113 DriveFileError error,
114 scoped_ptr<DriveEntryProto> entry_proto);
115
116 // Helper callback for relaying reply for ReadDirectory() to the calling
117 // thread.
118 void OnReadDirectory(
119 const fileapi::FileSystemOperationInterface::ReadDirectoryCallback&
120 callback,
121 DriveFileError error,
122 bool hide_hosted_documents,
123 scoped_ptr<DriveEntryProtoVector> proto_entries);
124
125 // Helper callback for relaying reply for CreateWritableSnapshotFile() to
126 // the calling thread.
127 void OnCreateWritableSnapshotFile(
128 const FilePath& virtual_path,
129 const fileapi::WritableSnapshotFile& callback,
130 DriveFileError result,
131 const FilePath& local_path);
132
133 // Helper callback for closing the local cache file and committing the dirty
134 // flag. This is triggered when the callback for CreateWritableSnapshotFile
135 // released the refcounted reference to the file.
136 void CloseWritableSnapshotFile(
137 const FilePath& virtual_path,
138 const FilePath& local_path);
139
140 // Invoked during Truncate() operation. This is called when a local modifiable
141 // cache is ready for truncation.
142 void OnFileOpenedForTruncate(
143 const FilePath& virtual_path,
144 int64 length,
145 const fileapi::FileSystemOperationInterface::StatusCallback& callback,
146 DriveFileError open_result,
147 const FilePath& local_cache_path);
148
149 // Invoked during Truncate() operation. This is called when the truncation of
150 // a local cache file is finished on FILE thread.
151 void DidTruncate(
152 const FilePath& virtual_path,
153 const fileapi::FileSystemOperationInterface::StatusCallback& callback,
154 base::PlatformFileError* truncate_result);
155
156 // Invoked during OpenFile() operation when truncate or write flags are set.
157 // This is called when a local modifiable cached file is ready for such
158 // operation.
159 void OnOpenFileForWriting(
160 int file_flags,
161 base::ProcessHandle peer_handle,
162 const fileapi::FileSystemOperationInterface::OpenFileCallback& callback,
163 DriveFileError file_error,
164 const FilePath& local_cache_path);
165
166 // Invoked during OpenFile() operation when file create flags are set.
167 void OnCreateFileForOpen(
168 const FilePath& file_path,
169 int file_flags,
170 base::ProcessHandle peer_handle,
171 const fileapi::FileSystemOperationInterface::OpenFileCallback& callback,
172 DriveFileError file_error);
173
174 // Invoked during OpenFile() operation when base::PLATFORM_FILE_OPEN_TRUNCATED
175 // flag is set. This is called when the truncation of a local cache file is
176 // finished on FILE thread.
177 void OnOpenAndTruncate(
178 base::ProcessHandle peer_handle,
179 const fileapi::FileSystemOperationInterface::OpenFileCallback& callback,
180 base::PlatformFile* platform_file,
181 base::PlatformFileError* truncate_result);
182
183 // GDataFileSystem is owned by Profile, which outlives GDataFileSystemProxy,
184 // which is owned by CrosMountPointProvider (i.e. by the time Profile is
185 // removed, the file manager is already gone). Hence it's safe to use this as
186 // a raw pointer.
187 GDataFileSystemInterface* file_system_;
188 };
189
190 } // namespace chromeos
191
192 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698