OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_EXTENSIONS_FILE_BROWSER_PRIVATE_API_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_PRIVATE_API_H_ |
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_PRIVATE_API_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_PRIVATE_API_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 12 matching lines...) Expand all Loading... |
23 namespace content { | 23 namespace content { |
24 struct SelectedFileInfo; | 24 struct SelectedFileInfo; |
25 } | 25 } |
26 | 26 |
27 namespace gdata { | 27 namespace gdata { |
28 struct SearchResultInfo; | 28 struct SearchResultInfo; |
29 } | 29 } |
30 | 30 |
31 // Implements the chrome.fileBrowserPrivate.requestLocalFileSystem method. | 31 // Implements the chrome.fileBrowserPrivate.requestLocalFileSystem method. |
32 class RequestLocalFileSystemFunction : public AsyncExtensionFunction { | 32 class RequestLocalFileSystemFunction : public AsyncExtensionFunction { |
| 33 public: |
| 34 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.requestLocalFileSystem"); |
| 35 |
33 protected: | 36 protected: |
| 37 virtual ~RequestLocalFileSystemFunction() {} |
| 38 |
34 // AsyncExtensionFunction overrides. | 39 // AsyncExtensionFunction overrides. |
35 virtual bool RunImpl() OVERRIDE; | 40 virtual bool RunImpl() OVERRIDE; |
36 | 41 |
37 private: | 42 private: |
38 class LocalFileSystemCallbackDispatcher; | 43 class LocalFileSystemCallbackDispatcher; |
39 | 44 |
40 void RespondSuccessOnUIThread(const std::string& name, | 45 void RespondSuccessOnUIThread(const std::string& name, |
41 const GURL& root_path); | 46 const GURL& root_path); |
42 void RespondFailedOnUIThread(base::PlatformFileError error_code); | 47 void RespondFailedOnUIThread(base::PlatformFileError error_code); |
43 void RequestOnFileThread(const GURL& source_url, int child_id); | 48 void RequestOnFileThread(const GURL& source_url, int child_id); |
44 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.requestLocalFileSystem"); | |
45 }; | 49 }; |
46 | 50 |
47 // Implements the chrome.fileBrowserPrivate.addFileWatch method. | 51 // Implements the chrome.fileBrowserPrivate.addFileWatch method. |
48 class FileWatchBrowserFunctionBase : public AsyncExtensionFunction { | 52 class FileWatchBrowserFunctionBase : public AsyncExtensionFunction { |
49 protected: | 53 protected: |
| 54 virtual ~FileWatchBrowserFunctionBase() {} |
| 55 |
50 virtual bool PerformFileWatchOperation( | 56 virtual bool PerformFileWatchOperation( |
51 scoped_refptr<FileBrowserEventRouter> event_router, | 57 scoped_refptr<FileBrowserEventRouter> event_router, |
52 const FilePath& local_path, const FilePath& virtual_path, | 58 const FilePath& local_path, const FilePath& virtual_path, |
53 const std::string& extension_id) = 0; | 59 const std::string& extension_id) = 0; |
54 | 60 |
55 // AsyncExtensionFunction overrides. | 61 // AsyncExtensionFunction overrides. |
56 virtual bool RunImpl() OVERRIDE; | 62 virtual bool RunImpl() OVERRIDE; |
57 | 63 |
58 private: | 64 private: |
59 bool GetLocalFilePath(const GURL& file_url, FilePath* local_path, | 65 bool GetLocalFilePath(const GURL& file_url, FilePath* local_path, |
60 FilePath* virtual_path); | 66 FilePath* virtual_path); |
61 void RespondOnUIThread(bool success); | 67 void RespondOnUIThread(bool success); |
62 void RunFileWatchOperationOnFileThread( | 68 void RunFileWatchOperationOnFileThread( |
63 scoped_refptr<FileBrowserEventRouter> event_router, | 69 scoped_refptr<FileBrowserEventRouter> event_router, |
64 const GURL& file_url, | 70 const GURL& file_url, |
65 const std::string& extension_id); | 71 const std::string& extension_id); |
66 }; | 72 }; |
67 | 73 |
68 // Implements the chrome.fileBrowserPrivate.addFileWatch method. | 74 // Implements the chrome.fileBrowserPrivate.addFileWatch method. |
69 class AddFileWatchBrowserFunction : public FileWatchBrowserFunctionBase { | 75 class AddFileWatchBrowserFunction : public FileWatchBrowserFunctionBase { |
| 76 public: |
| 77 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.addFileWatch"); |
| 78 |
70 protected: | 79 protected: |
| 80 virtual ~AddFileWatchBrowserFunction() {} |
| 81 |
71 virtual bool PerformFileWatchOperation( | 82 virtual bool PerformFileWatchOperation( |
72 scoped_refptr<FileBrowserEventRouter> event_router, | 83 scoped_refptr<FileBrowserEventRouter> event_router, |
73 const FilePath& local_path, const FilePath& virtual_path, | 84 const FilePath& local_path, const FilePath& virtual_path, |
74 const std::string& extension_id) OVERRIDE; | 85 const std::string& extension_id) OVERRIDE; |
75 | |
76 private: | |
77 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.addFileWatch"); | |
78 }; | 86 }; |
79 | 87 |
80 | 88 |
81 // Implements the chrome.fileBrowserPrivate.removeFileWatch method. | 89 // Implements the chrome.fileBrowserPrivate.removeFileWatch method. |
82 class RemoveFileWatchBrowserFunction : public FileWatchBrowserFunctionBase { | 90 class RemoveFileWatchBrowserFunction : public FileWatchBrowserFunctionBase { |
| 91 public: |
| 92 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.removeFileWatch"); |
| 93 |
83 protected: | 94 protected: |
| 95 virtual ~RemoveFileWatchBrowserFunction() {} |
| 96 |
84 virtual bool PerformFileWatchOperation( | 97 virtual bool PerformFileWatchOperation( |
85 scoped_refptr<FileBrowserEventRouter> event_router, | 98 scoped_refptr<FileBrowserEventRouter> event_router, |
86 const FilePath& local_path, const FilePath& virtual_path, | 99 const FilePath& local_path, const FilePath& virtual_path, |
87 const std::string& extension_id) OVERRIDE; | 100 const std::string& extension_id) OVERRIDE; |
88 | |
89 private: | |
90 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.removeFileWatch"); | |
91 }; | 101 }; |
92 | 102 |
93 // Implements the chrome.fileBrowserPrivate.getFileTasks method. | 103 // Implements the chrome.fileBrowserPrivate.getFileTasks method. |
94 class GetFileTasksFileBrowserFunction : public AsyncExtensionFunction { | 104 class GetFileTasksFileBrowserFunction : public AsyncExtensionFunction { |
| 105 public: |
| 106 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getFileTasks"); |
| 107 |
95 protected: | 108 protected: |
| 109 virtual ~GetFileTasksFileBrowserFunction() {} |
| 110 |
96 // AsyncExtensionFunction overrides. | 111 // AsyncExtensionFunction overrides. |
97 virtual bool RunImpl() OVERRIDE; | 112 virtual bool RunImpl() OVERRIDE; |
98 | 113 |
99 private: | 114 private: |
100 bool FindDriveAppTasks(const std::vector<GURL>& file_urls, | 115 bool FindDriveAppTasks(const std::vector<GURL>& file_urls, |
101 ListValue* result_list); | 116 ListValue* result_list); |
102 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getFileTasks"); | |
103 }; | 117 }; |
104 | 118 |
105 // Implements the chrome.fileBrowserPrivate.executeTask method. | 119 // Implements the chrome.fileBrowserPrivate.executeTask method. |
106 class ExecuteTasksFileBrowserFunction : public AsyncExtensionFunction { | 120 class ExecuteTasksFileBrowserFunction : public AsyncExtensionFunction { |
107 public: | 121 public: |
| 122 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.executeTask"); |
| 123 |
108 ExecuteTasksFileBrowserFunction(); | 124 ExecuteTasksFileBrowserFunction(); |
109 virtual ~ExecuteTasksFileBrowserFunction(); | |
110 | 125 |
111 void OnTaskExecuted(bool success); | 126 void OnTaskExecuted(bool success); |
112 | 127 |
113 protected: | 128 protected: |
| 129 virtual ~ExecuteTasksFileBrowserFunction(); |
| 130 |
114 // AsyncExtensionFunction overrides. | 131 // AsyncExtensionFunction overrides. |
115 virtual bool RunImpl() OVERRIDE; | 132 virtual bool RunImpl() OVERRIDE; |
116 | |
117 private: | |
118 | |
119 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.executeTask"); | |
120 }; | 133 }; |
121 | 134 |
122 // Implements the chrome.fileBrowserPrivate.setDefaultTask method. | 135 // Implements the chrome.fileBrowserPrivate.setDefaultTask method. |
123 class SetDefaultTaskFileBrowserFunction : public SyncExtensionFunction { | 136 class SetDefaultTaskFileBrowserFunction : public SyncExtensionFunction { |
124 public: | 137 public: |
| 138 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.setDefaultTask"); |
| 139 |
125 SetDefaultTaskFileBrowserFunction(); | 140 SetDefaultTaskFileBrowserFunction(); |
| 141 |
| 142 protected: |
126 virtual ~SetDefaultTaskFileBrowserFunction(); | 143 virtual ~SetDefaultTaskFileBrowserFunction(); |
127 | 144 |
128 protected: | |
129 // AsyncExtensionFunction overrides. | 145 // AsyncExtensionFunction overrides. |
130 virtual bool RunImpl() OVERRIDE; | 146 virtual bool RunImpl() OVERRIDE; |
131 | |
132 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.setDefaultTask"); | |
133 }; | 147 }; |
134 | 148 |
135 // Parent class for the chromium extension APIs for the file dialog. | 149 // Parent class for the chromium extension APIs for the file dialog. |
136 class FileBrowserFunction | 150 class FileBrowserFunction |
137 : public AsyncExtensionFunction { | 151 : public AsyncExtensionFunction { |
138 public: | 152 public: |
139 FileBrowserFunction(); | 153 FileBrowserFunction(); |
140 | 154 |
141 protected: | 155 protected: |
142 typedef std::vector<GURL> UrlList; | 156 typedef std::vector<GURL> UrlList; |
(...skipping 14 matching lines...) Expand all Loading... |
157 | 171 |
158 private: | 172 private: |
159 // Converts virtual paths to local paths and call |callback| (on the UI | 173 // Converts virtual paths to local paths and call |callback| (on the UI |
160 // thread) with the results. | 174 // thread) with the results. |
161 // This method must be called from the file thread. | 175 // This method must be called from the file thread. |
162 void GetLocalPathsOnFileThread(const UrlList& file_urls, | 176 void GetLocalPathsOnFileThread(const UrlList& file_urls, |
163 GetLocalPathsCallback callback); | 177 GetLocalPathsCallback callback); |
164 }; | 178 }; |
165 | 179 |
166 // Select a single file. Closes the dialog window. | 180 // Select a single file. Closes the dialog window. |
167 class SelectFileFunction | 181 class SelectFileFunction : public FileBrowserFunction { |
168 : public FileBrowserFunction { | |
169 public: | 182 public: |
| 183 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.selectFile"); |
| 184 |
170 SelectFileFunction() {} | 185 SelectFileFunction() {} |
171 | 186 |
172 protected: | 187 protected: |
173 virtual ~SelectFileFunction() {} | 188 virtual ~SelectFileFunction() {} |
174 | 189 |
175 // AsyncExtensionFunction overrides. | 190 // AsyncExtensionFunction overrides. |
176 virtual bool RunImpl() OVERRIDE; | 191 virtual bool RunImpl() OVERRIDE; |
177 | 192 |
178 private: | 193 private: |
179 // A callback method to handle the result of | 194 // A callback method to handle the result of |
180 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. | 195 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. |
181 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); | 196 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); |
182 | |
183 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.selectFile"); | |
184 }; | 197 }; |
185 | 198 |
186 // View multiple selected files. Window stays open. | 199 // View multiple selected files. Window stays open. |
187 class ViewFilesFunction | 200 class ViewFilesFunction : public FileBrowserFunction { |
188 : public FileBrowserFunction { | |
189 public: | 201 public: |
| 202 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.viewFiles"); |
| 203 |
190 ViewFilesFunction(); | 204 ViewFilesFunction(); |
191 | 205 |
192 protected: | 206 protected: |
193 virtual ~ViewFilesFunction(); | 207 virtual ~ViewFilesFunction(); |
194 | 208 |
195 // AsyncExtensionFunction overrides. | 209 // AsyncExtensionFunction overrides. |
196 virtual bool RunImpl() OVERRIDE; | 210 virtual bool RunImpl() OVERRIDE; |
197 | 211 |
198 private: | 212 private: |
199 // A callback method to handle the result of | 213 // A callback method to handle the result of |
200 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. | 214 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. |
201 void GetLocalPathsResponseOnUIThread(const std::string& internal_task_id, | 215 void GetLocalPathsResponseOnUIThread(const std::string& internal_task_id, |
202 const SelectedFileInfoList& files); | 216 const SelectedFileInfoList& files); |
203 | |
204 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.viewFiles"); | |
205 }; | 217 }; |
206 | 218 |
207 // Select multiple files. Closes the dialog window. | 219 // Select multiple files. Closes the dialog window. |
208 class SelectFilesFunction | 220 class SelectFilesFunction : public FileBrowserFunction { |
209 : public FileBrowserFunction { | |
210 public: | 221 public: |
| 222 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.selectFiles"); |
| 223 |
211 SelectFilesFunction(); | 224 SelectFilesFunction(); |
212 | 225 |
213 protected: | 226 protected: |
214 virtual ~SelectFilesFunction(); | 227 virtual ~SelectFilesFunction(); |
215 | 228 |
216 // AsyncExtensionFunction overrides. | 229 // AsyncExtensionFunction overrides. |
217 virtual bool RunImpl() OVERRIDE; | 230 virtual bool RunImpl() OVERRIDE; |
218 | 231 |
219 private: | 232 private: |
220 // A callback method to handle the result of | 233 // A callback method to handle the result of |
221 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. | 234 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. |
222 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); | 235 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); |
223 | |
224 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.selectFiles"); | |
225 }; | 236 }; |
226 | 237 |
227 // Cancel file selection Dialog. Closes the dialog window. | 238 // Cancel file selection Dialog. Closes the dialog window. |
228 class CancelFileDialogFunction | 239 class CancelFileDialogFunction : public FileBrowserFunction { |
229 : public FileBrowserFunction { | |
230 public: | 240 public: |
| 241 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.cancelDialog"); |
| 242 |
231 CancelFileDialogFunction() {} | 243 CancelFileDialogFunction() {} |
232 | 244 |
233 protected: | 245 protected: |
234 virtual ~CancelFileDialogFunction() {} | 246 virtual ~CancelFileDialogFunction() {} |
235 | 247 |
236 // AsyncExtensionFunction overrides. | 248 // AsyncExtensionFunction overrides. |
237 virtual bool RunImpl() OVERRIDE; | 249 virtual bool RunImpl() OVERRIDE; |
238 | |
239 private: | |
240 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.cancelDialog"); | |
241 }; | 250 }; |
242 | 251 |
243 // Mount a device or a file. | 252 // Mount a device or a file. |
244 class AddMountFunction | 253 class AddMountFunction : public FileBrowserFunction { |
245 : public FileBrowserFunction { | |
246 public: | 254 public: |
| 255 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.addMount"); |
| 256 |
247 AddMountFunction(); | 257 AddMountFunction(); |
248 | 258 |
249 protected: | 259 protected: |
250 virtual ~AddMountFunction(); | 260 virtual ~AddMountFunction(); |
251 | 261 |
252 // AsyncExtensionFunction overrides. | 262 // AsyncExtensionFunction overrides. |
253 virtual bool RunImpl() OVERRIDE; | 263 virtual bool RunImpl() OVERRIDE; |
254 | 264 |
255 private: | 265 private: |
256 // Sends gdata mount event to renderers. | 266 // Sends gdata mount event to renderers. |
257 void RaiseGDataMountEvent(gdata::GDataErrorCode error); | 267 void RaiseGDataMountEvent(gdata::GDataErrorCode error); |
258 // A callback method to handle the result of GData authentication request. | 268 // A callback method to handle the result of GData authentication request. |
259 void OnGDataAuthentication(gdata::GDataErrorCode error, | 269 void OnGDataAuthentication(gdata::GDataErrorCode error, |
260 const std::string& token); | 270 const std::string& token); |
261 // A callback method to handle the result of | 271 // A callback method to handle the result of |
262 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. | 272 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. |
263 void GetLocalPathsResponseOnUIThread(const std::string& mount_type_str, | 273 void GetLocalPathsResponseOnUIThread(const std::string& mount_type_str, |
264 const SelectedFileInfoList& files); | 274 const SelectedFileInfoList& files); |
265 // A callback method to handle the result of SetMountedState. | 275 // A callback method to handle the result of SetMountedState. |
266 void OnMountedStateSet(const std::string& mount_type, | 276 void OnMountedStateSet(const std::string& mount_type, |
267 const FilePath::StringType& file_name, | 277 const FilePath::StringType& file_name, |
268 base::PlatformFileError error, | 278 base::PlatformFileError error, |
269 const FilePath& file_path); | 279 const FilePath& file_path); |
270 | |
271 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.addMount"); | |
272 }; | 280 }; |
273 | 281 |
274 // Unmounts selected device. Expects mount point path as an argument. | 282 // Unmounts selected device. Expects mount point path as an argument. |
275 class RemoveMountFunction | 283 class RemoveMountFunction : public FileBrowserFunction { |
276 : public FileBrowserFunction { | |
277 public: | 284 public: |
| 285 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.removeMount"); |
| 286 |
278 RemoveMountFunction(); | 287 RemoveMountFunction(); |
279 | 288 |
280 protected: | 289 protected: |
281 virtual ~RemoveMountFunction(); | 290 virtual ~RemoveMountFunction(); |
282 | 291 |
283 // AsyncExtensionFunction overrides. | 292 // AsyncExtensionFunction overrides. |
284 virtual bool RunImpl() OVERRIDE; | 293 virtual bool RunImpl() OVERRIDE; |
285 | 294 |
286 private: | 295 private: |
287 // A callback method to handle the result of | 296 // A callback method to handle the result of |
288 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. | 297 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. |
289 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); | 298 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); |
290 | |
291 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.removeMount"); | |
292 }; | 299 }; |
293 | 300 |
294 class GetMountPointsFunction | 301 class GetMountPointsFunction : public AsyncExtensionFunction { |
295 : public AsyncExtensionFunction { | |
296 public: | 302 public: |
| 303 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getMountPoints"); |
| 304 |
297 GetMountPointsFunction(); | 305 GetMountPointsFunction(); |
298 | 306 |
299 protected: | 307 protected: |
300 virtual ~GetMountPointsFunction(); | 308 virtual ~GetMountPointsFunction(); |
301 | 309 |
302 // AsyncExtensionFunction overrides. | 310 // AsyncExtensionFunction overrides. |
303 virtual bool RunImpl() OVERRIDE; | 311 virtual bool RunImpl() OVERRIDE; |
304 | |
305 private: | |
306 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getMountPoints"); | |
307 }; | 312 }; |
308 | 313 |
309 // Formats Device given its mount path. | 314 // Formats Device given its mount path. |
310 class FormatDeviceFunction | 315 class FormatDeviceFunction : public FileBrowserFunction { |
311 : public FileBrowserFunction { | |
312 public: | 316 public: |
| 317 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.formatDevice"); |
| 318 |
313 FormatDeviceFunction(); | 319 FormatDeviceFunction(); |
314 | 320 |
315 protected: | 321 protected: |
316 virtual ~FormatDeviceFunction(); | 322 virtual ~FormatDeviceFunction(); |
317 | 323 |
318 // AsyncExtensionFunction overrides. | 324 // AsyncExtensionFunction overrides. |
319 virtual bool RunImpl() OVERRIDE; | 325 virtual bool RunImpl() OVERRIDE; |
320 | 326 |
321 private: | 327 private: |
322 // A callback method to handle the result of | 328 // A callback method to handle the result of |
323 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. | 329 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. |
324 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); | 330 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); |
325 | |
326 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.formatDevice"); | |
327 }; | 331 }; |
328 | 332 |
329 class GetSizeStatsFunction | 333 class GetSizeStatsFunction : public FileBrowserFunction { |
330 : public FileBrowserFunction { | |
331 public: | 334 public: |
| 335 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getSizeStats"); |
| 336 |
332 GetSizeStatsFunction(); | 337 GetSizeStatsFunction(); |
333 | 338 |
334 protected: | 339 protected: |
335 virtual ~GetSizeStatsFunction(); | 340 virtual ~GetSizeStatsFunction(); |
336 | 341 |
337 // AsyncExtensionFunction overrides. | 342 // AsyncExtensionFunction overrides. |
338 virtual bool RunImpl() OVERRIDE; | 343 virtual bool RunImpl() OVERRIDE; |
339 | 344 |
340 private: | 345 private: |
341 // A callback method to handle the result of | 346 // A callback method to handle the result of |
342 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. | 347 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. |
343 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); | 348 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); |
344 | 349 |
345 void GetSizeStatsCallbackOnUIThread(const std::string& mount_path, | 350 void GetSizeStatsCallbackOnUIThread(const std::string& mount_path, |
346 size_t total_size_kb, | 351 size_t total_size_kb, |
347 size_t remaining_size_kb); | 352 size_t remaining_size_kb); |
348 void CallGetSizeStatsOnFileThread(const std::string& mount_path); | 353 void CallGetSizeStatsOnFileThread(const std::string& mount_path); |
349 | |
350 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getSizeStats"); | |
351 }; | 354 }; |
352 | 355 |
353 // Retrieves devices meta-data. Expects volume's device path as an argument. | 356 // Retrieves devices meta-data. Expects volume's device path as an argument. |
354 class GetVolumeMetadataFunction | 357 class GetVolumeMetadataFunction : public FileBrowserFunction { |
355 : public FileBrowserFunction { | |
356 public: | 358 public: |
| 359 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getVolumeMetadata"); |
| 360 |
357 GetVolumeMetadataFunction(); | 361 GetVolumeMetadataFunction(); |
358 | 362 |
359 protected: | 363 protected: |
360 virtual ~GetVolumeMetadataFunction(); | 364 virtual ~GetVolumeMetadataFunction(); |
361 | 365 |
| 366 // AsyncExtensionFunction overrides. |
362 virtual bool RunImpl() OVERRIDE; | 367 virtual bool RunImpl() OVERRIDE; |
363 | 368 |
364 private: | 369 private: |
365 // A callback method to handle the result of | 370 // A callback method to handle the result of |
366 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. | 371 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. |
367 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); | 372 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); |
368 | |
369 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getVolumeMetadata"); | |
370 }; | 373 }; |
371 | 374 |
372 // Toggles fullscreen mode for the browser. | 375 // Toggles fullscreen mode for the browser. |
373 class ToggleFullscreenFunction : public SyncExtensionFunction { | 376 class ToggleFullscreenFunction : public SyncExtensionFunction { |
| 377 public: |
| 378 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.toggleFullscreen"); |
| 379 |
374 protected: | 380 protected: |
| 381 virtual ~ToggleFullscreenFunction() {} |
| 382 |
| 383 // SyncExtensionFunction overrides. |
375 virtual bool RunImpl() OVERRIDE; | 384 virtual bool RunImpl() OVERRIDE; |
376 private: | |
377 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.toggleFullscreen"); | |
378 }; | 385 }; |
379 | 386 |
380 // Checks if the browser is in fullscreen mode. | 387 // Checks if the browser is in fullscreen mode. |
381 class IsFullscreenFunction : public SyncExtensionFunction { | 388 class IsFullscreenFunction : public SyncExtensionFunction { |
| 389 public: |
| 390 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.isFullscreen"); |
| 391 |
382 protected: | 392 protected: |
| 393 virtual ~IsFullscreenFunction() {} |
| 394 |
| 395 // SyncExtensionFunction overrides. |
383 virtual bool RunImpl() OVERRIDE; | 396 virtual bool RunImpl() OVERRIDE; |
384 private: | |
385 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.isFullscreen"); | |
386 }; | 397 }; |
387 | 398 |
388 // File Dialog Strings. | 399 // File Dialog Strings. |
389 class FileDialogStringsFunction : public SyncExtensionFunction { | 400 class FileDialogStringsFunction : public SyncExtensionFunction { |
390 public: | 401 public: |
| 402 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getStrings"); |
| 403 |
391 FileDialogStringsFunction() {} | 404 FileDialogStringsFunction() {} |
392 | 405 |
393 protected: | 406 protected: |
394 virtual ~FileDialogStringsFunction() {} | 407 virtual ~FileDialogStringsFunction() {} |
395 | 408 |
396 // SyncExtensionFunction overrides. | 409 // SyncExtensionFunction overrides. |
397 virtual bool RunImpl() OVERRIDE; | 410 virtual bool RunImpl() OVERRIDE; |
398 | |
399 private: | |
400 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getStrings"); | |
401 }; | 411 }; |
402 | 412 |
403 // Retrieve property information for multiple files, returning a list of the | 413 // Retrieve property information for multiple files, returning a list of the |
404 // same length as the input list of file URLs. If a particular file has an | 414 // same length as the input list of file URLs. If a particular file has an |
405 // error, then return a dictionary with the key "error" set to the error number | 415 // error, then return a dictionary with the key "error" set to the error number |
406 // (base::PlatformFileError) for that entry in the returned list. | 416 // (base::PlatformFileError) for that entry in the returned list. |
407 class GetGDataFilePropertiesFunction : public FileBrowserFunction { | 417 class GetGDataFilePropertiesFunction : public FileBrowserFunction { |
408 public: | 418 public: |
| 419 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getGDataFileProperties"); |
| 420 |
409 GetGDataFilePropertiesFunction(); | 421 GetGDataFilePropertiesFunction(); |
410 | 422 |
411 protected: | 423 protected: |
| 424 virtual ~GetGDataFilePropertiesFunction(); |
| 425 |
412 void GetNextFileProperties(); | 426 void GetNextFileProperties(); |
413 void CompleteGetFileProperties(); | 427 void CompleteGetFileProperties(); |
414 | 428 |
415 virtual ~GetGDataFilePropertiesFunction(); | |
416 | |
417 // Virtual function that can be overridden to do operations on each virtual | 429 // Virtual function that can be overridden to do operations on each virtual |
418 // file path and update its the properties. | 430 // file path and update its the properties. |
419 virtual void DoOperation(const FilePath& file_path, | 431 virtual void DoOperation(const FilePath& file_path, |
420 base::DictionaryValue* properties, | 432 base::DictionaryValue* properties, |
421 scoped_ptr<gdata::GDataFileProto> file_proto); | 433 scoped_ptr<gdata::GDataFileProto> file_proto); |
422 | 434 |
423 void OnOperationComplete(const FilePath& file_path, | 435 void OnOperationComplete(const FilePath& file_path, |
424 base::DictionaryValue* properties, | 436 base::DictionaryValue* properties, |
425 base::PlatformFileError error, | 437 base::PlatformFileError error, |
426 scoped_ptr<gdata::GDataFileProto> file_proto); | 438 scoped_ptr<gdata::GDataFileProto> file_proto); |
(...skipping 10 matching lines...) Expand all Loading... |
437 base::PlatformFileError error, | 449 base::PlatformFileError error, |
438 scoped_ptr<gdata::GDataFileProto> file_proto); | 450 scoped_ptr<gdata::GDataFileProto> file_proto); |
439 | 451 |
440 void CacheStateReceived(base::DictionaryValue* property_dict, | 452 void CacheStateReceived(base::DictionaryValue* property_dict, |
441 base::PlatformFileError error, | 453 base::PlatformFileError error, |
442 int cache_state); | 454 int cache_state); |
443 | 455 |
444 size_t current_index_; | 456 size_t current_index_; |
445 base::ListValue* path_list_; | 457 base::ListValue* path_list_; |
446 scoped_ptr<base::ListValue> file_properties_; | 458 scoped_ptr<base::ListValue> file_properties_; |
447 | |
448 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getGDataFileProperties"); | |
449 }; | 459 }; |
450 | 460 |
451 // Pin/unpin multiple files in the cache, returning a list of file | 461 // Pin/unpin multiple files in the cache, returning a list of file |
452 // properties with the updated cache state. The returned array is the | 462 // properties with the updated cache state. The returned array is the |
453 // same length as the input list of file URLs. If a particular file | 463 // same length as the input list of file URLs. If a particular file |
454 // has an error, then return a dictionary with the key "error" set to | 464 // has an error, then return a dictionary with the key "error" set to |
455 // the error number (base::PlatformFileError) for that entry in the | 465 // the error number (base::PlatformFileError) for that entry in the |
456 // returned list. | 466 // returned list. |
457 class PinGDataFileFunction : public GetGDataFilePropertiesFunction { | 467 class PinGDataFileFunction : public GetGDataFilePropertiesFunction { |
458 public: | 468 public: |
| 469 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.pinGDataFile"); |
| 470 |
459 PinGDataFileFunction(); | 471 PinGDataFileFunction(); |
460 | 472 |
461 protected: | 473 protected: |
462 virtual ~PinGDataFileFunction(); | 474 virtual ~PinGDataFileFunction(); |
463 | 475 |
464 // AsyncExtensionFunction overrides. | 476 // AsyncExtensionFunction overrides. |
465 virtual bool RunImpl() OVERRIDE; | 477 virtual bool RunImpl() OVERRIDE; |
466 | 478 |
467 private: | 479 private: |
468 // Actually do the pinning/unpinning of each file. | 480 // Actually do the pinning/unpinning of each file. |
469 virtual void DoOperation( | 481 virtual void DoOperation( |
470 const FilePath& file_path, | 482 const FilePath& file_path, |
471 base::DictionaryValue* properties, | 483 base::DictionaryValue* properties, |
472 scoped_ptr<gdata::GDataFileProto> file_proto) OVERRIDE; | 484 scoped_ptr<gdata::GDataFileProto> file_proto) OVERRIDE; |
473 | 485 |
474 // Callback for SetPinState. Updates properties with error. | 486 // Callback for SetPinState. Updates properties with error. |
475 void OnPinStateSet(const FilePath& path, | 487 void OnPinStateSet(const FilePath& path, |
476 base::DictionaryValue* properties, | 488 base::DictionaryValue* properties, |
477 scoped_ptr<gdata::GDataFileProto> file_proto, | 489 scoped_ptr<gdata::GDataFileProto> file_proto, |
478 base::PlatformFileError error, | 490 base::PlatformFileError error, |
479 const std::string& resource_id, | 491 const std::string& resource_id, |
480 const std::string& md5); | 492 const std::string& md5); |
481 | 493 |
482 // True for pin, false for unpin. | 494 // True for pin, false for unpin. |
483 bool set_pin_; | 495 bool set_pin_; |
484 | |
485 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.pinGDataFile"); | |
486 }; | 496 }; |
487 | 497 |
488 // Get file locations for the given list of file URLs. Returns a list of | 498 // Get file locations for the given list of file URLs. Returns a list of |
489 // location idenfitiers, like ['drive', 'local'], where 'drive' means the | 499 // location idenfitiers, like ['drive', 'local'], where 'drive' means the |
490 // file is on gdata, and 'local' means the file is on the local drive. | 500 // file is on gdata, and 'local' means the file is on the local drive. |
491 class GetFileLocationsFunction : public FileBrowserFunction { | 501 class GetFileLocationsFunction : public FileBrowserFunction { |
492 public: | 502 public: |
| 503 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getFileLocations"); |
| 504 |
493 GetFileLocationsFunction(); | 505 GetFileLocationsFunction(); |
494 | 506 |
495 protected: | 507 protected: |
496 virtual ~GetFileLocationsFunction(); | 508 virtual ~GetFileLocationsFunction(); |
497 | 509 |
498 // AsyncExtensionFunction overrides. | 510 // AsyncExtensionFunction overrides. |
499 virtual bool RunImpl() OVERRIDE; | 511 virtual bool RunImpl() OVERRIDE; |
500 | 512 |
501 private: | 513 private: |
502 // A callback method to handle the result of | 514 // A callback method to handle the result of |
503 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. | 515 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. |
504 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); | 516 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); |
505 | |
506 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getFileLocations"); | |
507 }; | 517 }; |
508 | 518 |
509 // Get gdata files for the given list of file URLs. Initiate downloading of | 519 // Get gdata files for the given list of file URLs. Initiate downloading of |
510 // gdata files if these are not cached. Return a list of local file names. | 520 // gdata files if these are not cached. Return a list of local file names. |
511 // This function puts empty strings instead of local paths for files could | 521 // This function puts empty strings instead of local paths for files could |
512 // not be obtained. For instance, this can happen if the user specifies a new | 522 // not be obtained. For instance, this can happen if the user specifies a new |
513 // file name to save a file on gdata. There may be other reasons to fail. The | 523 // file name to save a file on gdata. There may be other reasons to fail. The |
514 // file manager should check if the local paths returned from getGDataFiles() | 524 // file manager should check if the local paths returned from getGDataFiles() |
515 // contain empty paths. | 525 // contain empty paths. |
516 // TODO(satorux): Should we propagate error types to the JavasScript layer? | 526 // TODO(satorux): Should we propagate error types to the JavasScript layer? |
517 class GetGDataFilesFunction : public FileBrowserFunction { | 527 class GetGDataFilesFunction : public FileBrowserFunction { |
518 public: | 528 public: |
| 529 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getGDataFiles"); |
| 530 |
519 GetGDataFilesFunction(); | 531 GetGDataFilesFunction(); |
520 | 532 |
521 protected: | 533 protected: |
522 virtual ~GetGDataFilesFunction(); | 534 virtual ~GetGDataFilesFunction(); |
523 | 535 |
524 // AsyncExtensionFunction overrides. | 536 // AsyncExtensionFunction overrides. |
525 virtual bool RunImpl() OVERRIDE; | 537 virtual bool RunImpl() OVERRIDE; |
526 | 538 |
527 private: | 539 private: |
528 // A callback method to handle the result of | 540 // A callback method to handle the result of |
529 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. | 541 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. |
530 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); | 542 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); |
531 | 543 |
532 // Gets the file on the top of the |remaining_gdata_paths_| or sends the | 544 // Gets the file on the top of the |remaining_gdata_paths_| or sends the |
533 // response if the queue is empty. | 545 // response if the queue is empty. |
534 void GetFileOrSendResponse(); | 546 void GetFileOrSendResponse(); |
535 | 547 |
536 // Called by GDataFileSystem::GetFile(). Pops the file from | 548 // Called by GDataFileSystem::GetFile(). Pops the file from |
537 // |remaining_gdata_paths_|, and calls GetFileOrSendResponse(). | 549 // |remaining_gdata_paths_|, and calls GetFileOrSendResponse(). |
538 void OnFileReady(base::PlatformFileError error, | 550 void OnFileReady(base::PlatformFileError error, |
539 const FilePath& local_path, | 551 const FilePath& local_path, |
540 const std::string& unused_mime_type, | 552 const std::string& unused_mime_type, |
541 gdata::GDataFileType file_type); | 553 gdata::GDataFileType file_type); |
542 | 554 |
543 std::queue<FilePath> remaining_gdata_paths_; | 555 std::queue<FilePath> remaining_gdata_paths_; |
544 ListValue* local_paths_; | 556 ListValue* local_paths_; |
545 | |
546 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getGDataFiles"); | |
547 }; | 557 }; |
548 | 558 |
549 // Implements the chrome.fileBrowserPrivate.executeTask method. | 559 // Implements the chrome.fileBrowserPrivate.executeTask method. |
550 class GetFileTransfersFunction : public AsyncExtensionFunction { | 560 class GetFileTransfersFunction : public AsyncExtensionFunction { |
551 public: | 561 public: |
| 562 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getFileTransfers"); |
| 563 |
552 GetFileTransfersFunction(); | 564 GetFileTransfersFunction(); |
| 565 |
| 566 protected: |
553 virtual ~GetFileTransfersFunction(); | 567 virtual ~GetFileTransfersFunction(); |
554 | 568 |
555 protected: | |
556 // AsyncExtensionFunction overrides. | 569 // AsyncExtensionFunction overrides. |
557 virtual bool RunImpl() OVERRIDE; | 570 virtual bool RunImpl() OVERRIDE; |
558 | 571 |
559 private: | 572 private: |
560 ListValue* GetFileTransfersList(); | 573 ListValue* GetFileTransfersList(); |
561 | |
562 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getFileTransfers"); | |
563 }; | 574 }; |
564 | 575 |
565 // Implements the chrome.fileBrowserPrivate.cancelFileTransfers method. | 576 // Implements the chrome.fileBrowserPrivate.cancelFileTransfers method. |
566 class CancelFileTransfersFunction : public FileBrowserFunction { | 577 class CancelFileTransfersFunction : public FileBrowserFunction { |
567 public: | 578 public: |
| 579 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.cancelFileTransfers"); |
| 580 |
568 CancelFileTransfersFunction(); | 581 CancelFileTransfersFunction(); |
| 582 |
| 583 protected: |
569 virtual ~CancelFileTransfersFunction(); | 584 virtual ~CancelFileTransfersFunction(); |
570 | 585 |
571 protected: | |
572 // AsyncExtensionFunction overrides. | 586 // AsyncExtensionFunction overrides. |
573 virtual bool RunImpl() OVERRIDE; | 587 virtual bool RunImpl() OVERRIDE; |
574 | 588 |
575 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); | 589 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); |
576 private: | |
577 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.cancelFileTransfers"); | |
578 }; | 590 }; |
579 | 591 |
580 // Implements the chrome.fileBrowserPrivate.transferFile method. | 592 // Implements the chrome.fileBrowserPrivate.transferFile method. |
581 class TransferFileFunction : public FileBrowserFunction { | 593 class TransferFileFunction : public FileBrowserFunction { |
582 public: | 594 public: |
| 595 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.transferFile"); |
| 596 |
583 TransferFileFunction(); | 597 TransferFileFunction(); |
| 598 |
| 599 protected: |
584 virtual ~TransferFileFunction(); | 600 virtual ~TransferFileFunction(); |
585 | 601 |
586 protected: | |
587 // AsyncExtensionFunction overrides. | 602 // AsyncExtensionFunction overrides. |
588 virtual bool RunImpl() OVERRIDE; | 603 virtual bool RunImpl() OVERRIDE; |
589 | 604 |
590 private: | 605 private: |
591 // Helper callback for handling response from | 606 // Helper callback for handling response from |
592 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread() | 607 // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread() |
593 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); | 608 void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); |
594 | 609 |
595 // Helper callback for handling response from GDataFileSystem::TransferFile(). | 610 // Helper callback for handling response from GDataFileSystem::TransferFile(). |
596 void OnTransferCompleted(base::PlatformFileError error); | 611 void OnTransferCompleted(base::PlatformFileError error); |
597 | |
598 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.transferFile"); | |
599 }; | 612 }; |
600 | 613 |
601 // Read setting value. | 614 // Read setting value. |
602 class GetGDataPreferencesFunction : public SyncExtensionFunction { | 615 class GetGDataPreferencesFunction : public SyncExtensionFunction { |
| 616 public: |
| 617 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getGDataPreferences"); |
| 618 |
603 protected: | 619 protected: |
| 620 virtual ~GetGDataPreferencesFunction() {} |
| 621 |
604 virtual bool RunImpl() OVERRIDE; | 622 virtual bool RunImpl() OVERRIDE; |
605 private: | |
606 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getGDataPreferences"); | |
607 }; | 623 }; |
608 | 624 |
609 // Write setting value. | 625 // Write setting value. |
610 class SetGDataPreferencesFunction : public SyncExtensionFunction { | 626 class SetGDataPreferencesFunction : public SyncExtensionFunction { |
| 627 public: |
| 628 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.setGDataPreferences"); |
| 629 |
611 protected: | 630 protected: |
| 631 virtual ~SetGDataPreferencesFunction() {} |
| 632 |
612 virtual bool RunImpl() OVERRIDE; | 633 virtual bool RunImpl() OVERRIDE; |
613 private: | |
614 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.setGDataPreferences"); | |
615 }; | 634 }; |
616 | 635 |
617 class GetPathForDriveSearchResultFunction : public AsyncExtensionFunction { | 636 class GetPathForDriveSearchResultFunction : public AsyncExtensionFunction { |
| 637 public: |
| 638 DECLARE_EXTENSION_FUNCTION_NAME( |
| 639 "fileBrowserPrivate.getPathForDriveSearchResult"); |
| 640 |
618 protected: | 641 protected: |
| 642 virtual ~GetPathForDriveSearchResultFunction() {} |
| 643 |
619 virtual bool RunImpl() OVERRIDE; | 644 virtual bool RunImpl() OVERRIDE; |
620 | 645 |
621 void OnEntryFound(base::PlatformFileError error, | 646 void OnEntryFound(base::PlatformFileError error, |
622 const FilePath& entry_path, | 647 const FilePath& entry_path, |
623 scoped_ptr<gdata::GDataEntryProto> entry_proto); | 648 scoped_ptr<gdata::GDataEntryProto> entry_proto); |
624 | |
625 private: | |
626 DECLARE_EXTENSION_FUNCTION_NAME( | |
627 "fileBrowserPrivate.getPathForDriveSearchResult"); | |
628 }; | 649 }; |
629 | 650 |
630 class SearchDriveFunction : public AsyncExtensionFunction { | 651 class SearchDriveFunction : public AsyncExtensionFunction { |
| 652 public: |
| 653 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.searchGData"); |
| 654 |
631 protected: | 655 protected: |
| 656 virtual ~SearchDriveFunction() {} |
| 657 |
632 virtual bool RunImpl() OVERRIDE; | 658 virtual bool RunImpl() OVERRIDE; |
633 | 659 |
634 private: | 660 private: |
635 // Callback fo OpenFileSystem called from RunImpl. | 661 // Callback fo OpenFileSystem called from RunImpl. |
636 void OnFileSystemOpened(base::PlatformFileError result, | 662 void OnFileSystemOpened(base::PlatformFileError result, |
637 const std::string& file_system_name, | 663 const std::string& file_system_name, |
638 const GURL& file_system_url); | 664 const GURL& file_system_url); |
639 // Callback for gdata::SearchAsync called after file system is opened. | 665 // Callback for gdata::SearchAsync called after file system is opened. |
640 void OnSearch(base::PlatformFileError error, | 666 void OnSearch(base::PlatformFileError error, |
641 scoped_ptr<std::vector<gdata::SearchResultInfo> > result_paths); | 667 scoped_ptr<std::vector<gdata::SearchResultInfo> > result_paths); |
642 | 668 |
643 // Query for which the search is being performed. | 669 // Query for which the search is being performed. |
644 std::string query_; | 670 std::string query_; |
645 // Information about remote file system we will need to create file entries | 671 // Information about remote file system we will need to create file entries |
646 // to represent search results. | 672 // to represent search results. |
647 std::string file_system_name_; | 673 std::string file_system_name_; |
648 GURL file_system_url_; | 674 GURL file_system_url_; |
649 | |
650 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.searchGData"); | |
651 }; | 675 }; |
652 | 676 |
653 // Implements the chrome.fileBrowserPrivate.getNetworkConnectionState method. | 677 // Implements the chrome.fileBrowserPrivate.getNetworkConnectionState method. |
654 class GetNetworkConnectionStateFunction : public SyncExtensionFunction { | 678 class GetNetworkConnectionStateFunction : public SyncExtensionFunction { |
655 protected: | 679 public: |
656 virtual bool RunImpl() OVERRIDE; | |
657 private: | |
658 DECLARE_EXTENSION_FUNCTION_NAME( | 680 DECLARE_EXTENSION_FUNCTION_NAME( |
659 "fileBrowserPrivate.getNetworkConnectionState"); | 681 "fileBrowserPrivate.getNetworkConnectionState"); |
| 682 |
| 683 protected: |
| 684 virtual ~GetNetworkConnectionStateFunction() {} |
| 685 |
| 686 virtual bool RunImpl() OVERRIDE; |
660 }; | 687 }; |
661 | 688 |
662 // Implements the chrome.fileBrowserPrivate.requestDirectoryRefresh method. | 689 // Implements the chrome.fileBrowserPrivate.requestDirectoryRefresh method. |
663 class RequestDirectoryRefreshFunction : public SyncExtensionFunction { | 690 class RequestDirectoryRefreshFunction : public SyncExtensionFunction { |
664 protected: | 691 public: |
665 virtual bool RunImpl() OVERRIDE; | |
666 private: | |
667 DECLARE_EXTENSION_FUNCTION_NAME( | 692 DECLARE_EXTENSION_FUNCTION_NAME( |
668 "fileBrowserPrivate.requestDirectoryRefresh"); | 693 "fileBrowserPrivate.requestDirectoryRefresh"); |
| 694 |
| 695 protected: |
| 696 virtual ~RequestDirectoryRefreshFunction() {} |
| 697 |
| 698 virtual bool RunImpl() OVERRIDE; |
669 }; | 699 }; |
670 | 700 |
671 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_PRIVATE_API_H_ | 701 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_PRIVATE_API_H_ |
OLD | NEW |