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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/private_api_file_system.h

Issue 23766029: Files.app: Let the file browser private filesystem APIs use the auto-generated helper classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // This file provides file system related API functions. 5 // This file provides file system related API functions.
6 6
7 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_FILE_SYSTEM_ H_ 7 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_FILE_SYSTEM_ H_
8 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_FILE_SYSTEM_ H_ 8 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_FILE_SYSTEM_ H_
9 9
10 #include <string> 10 #include <string>
(...skipping 14 matching lines...) Expand all
25 25
26 namespace extensions { 26 namespace extensions {
27 27
28 // Implements the chrome.fileBrowserPrivate.requestFileSystem method. 28 // Implements the chrome.fileBrowserPrivate.requestFileSystem method.
29 class FileBrowserPrivateRequestFileSystemFunction 29 class FileBrowserPrivateRequestFileSystemFunction
30 : public LoggedAsyncExtensionFunction { 30 : public LoggedAsyncExtensionFunction {
31 public: 31 public:
32 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.requestFileSystem", 32 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.requestFileSystem",
33 FILEBROWSERPRIVATE_REQUESTFILESYSTEM) 33 FILEBROWSERPRIVATE_REQUESTFILESYSTEM)
34 34
35 FileBrowserPrivateRequestFileSystemFunction();
36
37 protected: 35 protected:
38 virtual ~FileBrowserPrivateRequestFileSystemFunction(); 36 virtual ~FileBrowserPrivateRequestFileSystemFunction() {}
39 37
40 // AsyncExtensionFunction overrides. 38 // AsyncExtensionFunction overrides.
41 virtual bool RunImpl() OVERRIDE; 39 virtual bool RunImpl() OVERRIDE;
42 40
43 private: 41 private:
44 void RespondSuccessOnUIThread(const std::string& name, 42 void RespondSuccessOnUIThread(const std::string& name,
45 const GURL& root_url); 43 const GURL& root_url);
46 void RespondFailedOnUIThread(base::PlatformFileError error_code); 44 void RespondFailedOnUIThread(base::PlatformFileError error_code);
47 45
48 // Called when FileSystemContext::OpenFileSystem() is done. 46 // Called when FileSystemContext::OpenFileSystem() is done.
(...skipping 13 matching lines...) Expand all
62 scoped_refptr<fileapi::FileSystemContext> file_system_context, 60 scoped_refptr<fileapi::FileSystemContext> file_system_context,
63 int child_id, 61 int child_id,
64 scoped_refptr<const extensions::Extension> extension); 62 scoped_refptr<const extensions::Extension> extension);
65 }; 63 };
66 64
67 // Base class for FileBrowserPrivateAddFileWatchFunction and 65 // Base class for FileBrowserPrivateAddFileWatchFunction and
68 // FileBrowserPrivateRemoveFileWatchFunction. Although it's called "FileWatch", 66 // FileBrowserPrivateRemoveFileWatchFunction. Although it's called "FileWatch",
69 // the class and its sub classes are used only for watching changes in 67 // the class and its sub classes are used only for watching changes in
70 // directories. 68 // directories.
71 class FileWatchFunctionBase : public LoggedAsyncExtensionFunction { 69 class FileWatchFunctionBase : public LoggedAsyncExtensionFunction {
72 public:
73 FileWatchFunctionBase();
74
75 protected: 70 protected:
76 virtual ~FileWatchFunctionBase(); 71 virtual ~FileWatchFunctionBase() {}
77 72
78 // Performs a file watch operation (ex. adds or removes a file watch). 73 // Performs a file watch operation (ex. adds or removes a file watch).
79 virtual void PerformFileWatchOperation( 74 virtual void PerformFileWatchOperation(
80 const base::FilePath& local_path, 75 const base::FilePath& local_path,
81 const base::FilePath& virtual_path, 76 const base::FilePath& virtual_path,
82 const std::string& extension_id) = 0; 77 const std::string& extension_id) = 0;
83 78
84 // AsyncExtensionFunction overrides. 79 // AsyncExtensionFunction overrides.
85 virtual bool RunImpl() OVERRIDE; 80 virtual bool RunImpl() OVERRIDE;
86 81
87 // Calls SendResponse() with |success| converted to base::Value. 82 // Calls SendResponse() with |success| converted to base::Value.
88 void Respond(bool success); 83 void Respond(bool success);
89 }; 84 };
90 85
91 // Implements the chrome.fileBrowserPrivate.addFileWatch method. 86 // Implements the chrome.fileBrowserPrivate.addFileWatch method.
92 // Starts watching changes in directories. 87 // Starts watching changes in directories.
93 class FileBrowserPrivateAddFileWatchFunction : public FileWatchFunctionBase { 88 class FileBrowserPrivateAddFileWatchFunction : public FileWatchFunctionBase {
94 public: 89 public:
95 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.addFileWatch", 90 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.addFileWatch",
96 FILEBROWSERPRIVATE_ADDFILEWATCH) 91 FILEBROWSERPRIVATE_ADDFILEWATCH)
97 92
98 FileBrowserPrivateAddFileWatchFunction();
99
100 protected: 93 protected:
101 virtual ~FileBrowserPrivateAddFileWatchFunction(); 94 virtual ~FileBrowserPrivateAddFileWatchFunction() {}
102 95
103 // FileWatchFunctionBase override. 96 // FileWatchFunctionBase override.
104 virtual void PerformFileWatchOperation( 97 virtual void PerformFileWatchOperation(
105 const base::FilePath& local_path, 98 const base::FilePath& local_path,
106 const base::FilePath& virtual_path, 99 const base::FilePath& virtual_path,
107 const std::string& extension_id) OVERRIDE; 100 const std::string& extension_id) OVERRIDE;
108 }; 101 };
109 102
110 103
111 // Implements the chrome.fileBrowserPrivate.removeFileWatch method. 104 // Implements the chrome.fileBrowserPrivate.removeFileWatch method.
112 // Stops watching changes in directories. 105 // Stops watching changes in directories.
113 class FileBrowserPrivateRemoveFileWatchFunction : public FileWatchFunctionBase { 106 class FileBrowserPrivateRemoveFileWatchFunction : public FileWatchFunctionBase {
114 public: 107 public:
115 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.removeFileWatch", 108 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.removeFileWatch",
116 FILEBROWSERPRIVATE_REMOVEFILEWATCH) 109 FILEBROWSERPRIVATE_REMOVEFILEWATCH)
117 110
118 FileBrowserPrivateRemoveFileWatchFunction();
119
120 protected: 111 protected:
121 virtual ~FileBrowserPrivateRemoveFileWatchFunction(); 112 virtual ~FileBrowserPrivateRemoveFileWatchFunction() {}
122 113
123 // FileWatchFunctionBase override. 114 // FileWatchFunctionBase override.
124 virtual void PerformFileWatchOperation( 115 virtual void PerformFileWatchOperation(
125 const base::FilePath& local_path, 116 const base::FilePath& local_path,
126 const base::FilePath& virtual_path, 117 const base::FilePath& virtual_path,
127 const std::string& extension_id) OVERRIDE; 118 const std::string& extension_id) OVERRIDE;
128 }; 119 };
129 120
130 // Implements the chrome.fileBrowserPrivate.setLastModified method. 121 // Implements the chrome.fileBrowserPrivate.setLastModified method.
131 // Sets last modified date in seconds of local file 122 // Sets last modified date in seconds of local file
132 class FileBrowserPrivateSetLastModifiedFunction 123 class FileBrowserPrivateSetLastModifiedFunction
133 : public LoggedAsyncExtensionFunction { 124 : public LoggedAsyncExtensionFunction {
134 public: 125 public:
135 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.setLastModified", 126 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.setLastModified",
136 FILEBROWSERPRIVATE_SETLASTMODIFIED) 127 FILEBROWSERPRIVATE_SETLASTMODIFIED)
137 128
138 FileBrowserPrivateSetLastModifiedFunction();
139
140 protected: 129 protected:
141 virtual ~FileBrowserPrivateSetLastModifiedFunction(); 130 virtual ~FileBrowserPrivateSetLastModifiedFunction() {}
142 131
143 // AsyncExtensionFunction overrides. 132 // AsyncExtensionFunction overrides.
144 virtual bool RunImpl() OVERRIDE; 133 virtual bool RunImpl() OVERRIDE;
145 }; 134 };
146 135
147 // Implements the chrome.fileBrowserPrivate.getSizeStats method. 136 // Implements the chrome.fileBrowserPrivate.getSizeStats method.
148 class FileBrowserPrivateGetSizeStatsFunction 137 class FileBrowserPrivateGetSizeStatsFunction
149 : public LoggedAsyncExtensionFunction { 138 : public LoggedAsyncExtensionFunction {
150 public: 139 public:
151 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getSizeStats", 140 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getSizeStats",
152 FILEBROWSERPRIVATE_GETSIZESTATS) 141 FILEBROWSERPRIVATE_GETSIZESTATS)
153 142
154 FileBrowserPrivateGetSizeStatsFunction();
155
156 protected: 143 protected:
157 virtual ~FileBrowserPrivateGetSizeStatsFunction(); 144 virtual ~FileBrowserPrivateGetSizeStatsFunction() {}
158 145
159 // AsyncExtensionFunction overrides. 146 // AsyncExtensionFunction overrides.
160 virtual bool RunImpl() OVERRIDE; 147 virtual bool RunImpl() OVERRIDE;
161 148
162 private: 149 private:
163 void GetDriveAvailableSpaceCallback(drive::FileError error, 150 void GetDriveAvailableSpaceCallback(drive::FileError error,
164 int64 bytes_total, 151 int64 bytes_total,
165 int64 bytes_used); 152 int64 bytes_used);
166 153
167 void GetSizeStatsCallback(const uint64* total_size, 154 void GetSizeStatsCallback(const uint64* total_size,
168 const uint64* remaining_size); 155 const uint64* remaining_size);
169 }; 156 };
170 157
171 // Implements the chrome.fileBrowserPrivate.getVolumeMetadata method. 158 // Implements the chrome.fileBrowserPrivate.getVolumeMetadata method.
172 // Retrieves devices meta-data. Expects volume's device path as an argument. 159 // Retrieves devices meta-data. Expects volume's device path as an argument.
173 class FileBrowserPrivateGetVolumeMetadataFunction 160 class FileBrowserPrivateGetVolumeMetadataFunction
174 : public LoggedAsyncExtensionFunction { 161 : public LoggedAsyncExtensionFunction {
175 public: 162 public:
176 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getVolumeMetadata", 163 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getVolumeMetadata",
177 FILEBROWSERPRIVATE_GETVOLUMEMETADATA) 164 FILEBROWSERPRIVATE_GETVOLUMEMETADATA)
178 165
179 FileBrowserPrivateGetVolumeMetadataFunction();
180
181 protected: 166 protected:
182 virtual ~FileBrowserPrivateGetVolumeMetadataFunction(); 167 virtual ~FileBrowserPrivateGetVolumeMetadataFunction() {}
183 168
184 // AsyncExtensionFunction overrides. 169 // AsyncExtensionFunction overrides.
185 virtual bool RunImpl() OVERRIDE; 170 virtual bool RunImpl() OVERRIDE;
186 }; 171 };
187 172
188 // Implements the chrome.fileBrowserPrivate.validatePathNameLength method. 173 // Implements the chrome.fileBrowserPrivate.validatePathNameLength method.
189 class FileBrowserPrivateValidatePathNameLengthFunction 174 class FileBrowserPrivateValidatePathNameLengthFunction
190 : public LoggedAsyncExtensionFunction { 175 : public LoggedAsyncExtensionFunction {
191 public: 176 public:
192 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.validatePathNameLength", 177 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.validatePathNameLength",
193 FILEBROWSERPRIVATE_VALIDATEPATHNAMELENGTH) 178 FILEBROWSERPRIVATE_VALIDATEPATHNAMELENGTH)
194 179
195 FileBrowserPrivateValidatePathNameLengthFunction();
196
197 protected: 180 protected:
198 virtual ~FileBrowserPrivateValidatePathNameLengthFunction(); 181 virtual ~FileBrowserPrivateValidatePathNameLengthFunction() {}
199 182
200 void OnFilePathLimitRetrieved(size_t current_length, size_t max_length); 183 void OnFilePathLimitRetrieved(size_t current_length, size_t max_length);
201 184
202 // AsyncExtensionFunction overrides. 185 // AsyncExtensionFunction overrides.
203 virtual bool RunImpl() OVERRIDE; 186 virtual bool RunImpl() OVERRIDE;
204 }; 187 };
205 188
206 // Implements the chrome.fileBrowserPrivate.formatDevice method. 189 // Implements the chrome.fileBrowserPrivate.formatDevice method.
207 // Formats Device given its mount path. 190 // Formats Device given its mount path.
208 class FileBrowserPrivateFormatDeviceFunction 191 class FileBrowserPrivateFormatDeviceFunction
209 : public LoggedAsyncExtensionFunction { 192 : public LoggedAsyncExtensionFunction {
210 public: 193 public:
211 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.formatDevice", 194 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.formatDevice",
212 FILEBROWSERPRIVATE_FORMATDEVICE) 195 FILEBROWSERPRIVATE_FORMATDEVICE)
213 196
214 FileBrowserPrivateFormatDeviceFunction();
215
216 protected: 197 protected:
217 virtual ~FileBrowserPrivateFormatDeviceFunction(); 198 virtual ~FileBrowserPrivateFormatDeviceFunction() {}
218 199
219 // AsyncExtensionFunction overrides. 200 // AsyncExtensionFunction overrides.
220 virtual bool RunImpl() OVERRIDE; 201 virtual bool RunImpl() OVERRIDE;
221 }; 202 };
222 203
223 // Implements the chrome.fileBrowserPrivate.startCopy method. 204 // Implements the chrome.fileBrowserPrivate.startCopy method.
224 class FileBrowserPrivateStartCopyFunction 205 class FileBrowserPrivateStartCopyFunction
225 : public LoggedAsyncExtensionFunction { 206 : public LoggedAsyncExtensionFunction {
226 public: 207 public:
227 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.startCopy", 208 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.startCopy",
228 FILEBROWSERPRIVATE_STARTCOPY) 209 FILEBROWSERPRIVATE_STARTCOPY)
229 210
230 FileBrowserPrivateStartCopyFunction();
231
232 protected: 211 protected:
233 virtual ~FileBrowserPrivateStartCopyFunction(); 212 virtual ~FileBrowserPrivateStartCopyFunction() {}
234 213
235 // AsyncExtensionFunction overrides. 214 // AsyncExtensionFunction overrides.
236 virtual bool RunImpl() OVERRIDE; 215 virtual bool RunImpl() OVERRIDE;
237 216
238 private: 217 private:
239 // Part of RunImpl(). Called after Copy() is started on IO thread. 218 // Part of RunImpl(). Called after Copy() is started on IO thread.
240 void RunAfterStartCopy(int operation_id); 219 void RunAfterStartCopy(int operation_id);
241 }; 220 };
242 221
243 // Implements the chrome.fileBrowserPrivate.cancelCopy method. 222 // Implements the chrome.fileBrowserPrivate.cancelCopy method.
244 class FileBrowserPrivateCancelCopyFunction 223 class FileBrowserPrivateCancelCopyFunction
245 : public LoggedAsyncExtensionFunction { 224 : public LoggedAsyncExtensionFunction {
246 public: 225 public:
247 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.cancelCopy", 226 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.cancelCopy",
248 FILEBROWSERPRIVATE_CANCELCOPY) 227 FILEBROWSERPRIVATE_CANCELCOPY)
249 228
250 FileBrowserPrivateCancelCopyFunction();
251
252 protected: 229 protected:
253 virtual ~FileBrowserPrivateCancelCopyFunction(); 230 virtual ~FileBrowserPrivateCancelCopyFunction() {}
254 231
255 // AsyncExtensionFunction overrides. 232 // AsyncExtensionFunction overrides.
256 virtual bool RunImpl() OVERRIDE; 233 virtual bool RunImpl() OVERRIDE;
257 }; 234 };
258 235
259 } // namespace extensions 236 } // namespace extensions
260 237
261 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_FILE_SYST EM_H_ 238 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_FILE_SYST EM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698