OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 typedef std::vector<GURL> UrlList; | 127 typedef std::vector<GURL> UrlList; |
128 typedef std::vector<FilePath> FilePathList; | 128 typedef std::vector<FilePath> FilePathList; |
129 | 129 |
130 virtual ~FileBrowserFunction(); | 130 virtual ~FileBrowserFunction(); |
131 | 131 |
132 // Convert virtual paths to local paths on the file thread. | 132 // Convert virtual paths to local paths on the file thread. |
133 void GetLocalPathsOnFileThread(const UrlList& file_urls, | 133 void GetLocalPathsOnFileThread(const UrlList& file_urls, |
134 void* context); | 134 void* context); |
135 | 135 |
136 // Callback with converted local paths. | 136 // Callback with converted local paths. |
137 virtual void GetLocalPathsResponseOnUIThread( | 137 virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files, |
138 const FilePathList& files, void* context) {} | 138 void* context) {} |
139 | 139 |
140 // Figure out the tab_id of the hosting tab. | 140 // Figure out the tab_id of the hosting tab. |
141 int32 GetTabId() const; | 141 int32 GetTabId() const; |
142 }; | 142 }; |
143 | 143 |
144 // Select a single file. Closes the dialog window. | 144 // Select a single file. Closes the dialog window. |
145 class SelectFileFunction | 145 class SelectFileFunction |
146 : public FileBrowserFunction { | 146 : public FileBrowserFunction { |
147 public: | 147 public: |
148 SelectFileFunction() {} | 148 SelectFileFunction() {} |
(...skipping 18 matching lines...) Expand all Loading... |
167 public: | 167 public: |
168 ViewFilesFunction(); | 168 ViewFilesFunction(); |
169 | 169 |
170 protected: | 170 protected: |
171 virtual ~ViewFilesFunction(); | 171 virtual ~ViewFilesFunction(); |
172 | 172 |
173 // AsyncExtensionFunction overrides. | 173 // AsyncExtensionFunction overrides. |
174 virtual bool RunImpl() OVERRIDE; | 174 virtual bool RunImpl() OVERRIDE; |
175 | 175 |
176 // FileBrowserFunction overrides. | 176 // FileBrowserFunction overrides. |
177 virtual void GetLocalPathsResponseOnUIThread( | 177 virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files, |
178 const FilePathList& files, void* context) OVERRIDE; | 178 void* context) OVERRIDE; |
179 | 179 |
180 private: | 180 private: |
181 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.viewFiles"); | 181 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.viewFiles"); |
182 }; | 182 }; |
183 | 183 |
184 // Select multiple files. Closes the dialog window. | 184 // Select multiple files. Closes the dialog window. |
185 class SelectFilesFunction | 185 class SelectFilesFunction |
186 : public FileBrowserFunction { | 186 : public FileBrowserFunction { |
187 public: | 187 public: |
188 SelectFilesFunction(); | 188 SelectFilesFunction(); |
189 | 189 |
190 protected: | 190 protected: |
191 virtual ~SelectFilesFunction(); | 191 virtual ~SelectFilesFunction(); |
192 | 192 |
193 // AsyncExtensionFunction overrides. | 193 // AsyncExtensionFunction overrides. |
194 virtual bool RunImpl() OVERRIDE; | 194 virtual bool RunImpl() OVERRIDE; |
195 | 195 |
196 // FileBrowserFunction overrides. | 196 // FileBrowserFunction overrides. |
197 virtual void GetLocalPathsResponseOnUIThread( | 197 virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files, |
198 const FilePathList& files, void* context) OVERRIDE; | 198 void* context) OVERRIDE; |
199 | 199 |
200 private: | 200 private: |
201 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.selectFiles"); | 201 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.selectFiles"); |
202 }; | 202 }; |
203 | 203 |
204 // Cancel file selection Dialog. Closes the dialog window. | 204 // Cancel file selection Dialog. Closes the dialog window. |
205 class CancelFileDialogFunction | 205 class CancelFileDialogFunction |
206 : public FileBrowserFunction { | 206 : public FileBrowserFunction { |
207 public: | 207 public: |
208 CancelFileDialogFunction() {} | 208 CancelFileDialogFunction() {} |
(...skipping 13 matching lines...) Expand all Loading... |
222 : public FileBrowserFunction { | 222 : public FileBrowserFunction { |
223 public: | 223 public: |
224 AddMountFunction(); | 224 AddMountFunction(); |
225 | 225 |
226 protected: | 226 protected: |
227 virtual ~AddMountFunction(); | 227 virtual ~AddMountFunction(); |
228 | 228 |
229 virtual bool RunImpl() OVERRIDE; | 229 virtual bool RunImpl() OVERRIDE; |
230 | 230 |
231 // FileBrowserFunction overrides. | 231 // FileBrowserFunction overrides. |
232 virtual void GetLocalPathsResponseOnUIThread( | 232 virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files, |
233 const FilePathList& files, void* context) OVERRIDE; | 233 void* context) OVERRIDE; |
234 | 234 |
235 private: | 235 private: |
236 struct MountParamaters { | 236 struct MountParamaters { |
237 MountParamaters(const std::string& type, | 237 MountParamaters(const std::string& type, |
238 const chromeos::MountPathOptions& options) | 238 const chromeos::MountPathOptions& options) |
239 : mount_type(type), mount_options(options) {} | 239 : mount_type(type), mount_options(options) {} |
240 ~MountParamaters() {} | 240 ~MountParamaters() {} |
241 std::string mount_type; | 241 std::string mount_type; |
242 chromeos::MountPathOptions mount_options; | 242 chromeos::MountPathOptions mount_options; |
243 }; | 243 }; |
244 | 244 |
245 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.addMount"); | 245 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.addMount"); |
246 }; | 246 }; |
247 | 247 |
248 // Unmounts selected device. Expects mount point path as an argument. | 248 // Unmounts selected device. Expects mount point path as an argument. |
249 class RemoveMountFunction | 249 class RemoveMountFunction |
250 : public FileBrowserFunction { | 250 : public FileBrowserFunction { |
251 public: | 251 public: |
252 RemoveMountFunction(); | 252 RemoveMountFunction(); |
253 | 253 |
254 protected: | 254 protected: |
255 virtual ~RemoveMountFunction(); | 255 virtual ~RemoveMountFunction(); |
256 | 256 |
257 // FileBrowserFunction overrides. | 257 // FileBrowserFunction overrides. |
258 virtual bool RunImpl() OVERRIDE; | 258 virtual bool RunImpl() OVERRIDE; |
259 virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files, | 259 virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files, |
260 void* context) OVERRIDE; | 260 void* context) OVERRIDE; |
261 | 261 |
262 private: | 262 private: |
263 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.removeMount"); | 263 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.removeMount"); |
264 }; | 264 }; |
265 | 265 |
266 class GetMountPointsFunction | 266 class GetMountPointsFunction |
267 : public AsyncExtensionFunction { | 267 : public AsyncExtensionFunction { |
268 public: | 268 public: |
269 GetMountPointsFunction(); | 269 GetMountPointsFunction(); |
270 | 270 |
271 protected: | 271 protected: |
272 virtual ~GetMountPointsFunction(); | 272 virtual ~GetMountPointsFunction(); |
273 | 273 |
274 virtual bool RunImpl() OVERRIDE; | 274 virtual bool RunImpl() OVERRIDE; |
275 | 275 |
276 private: | 276 private: |
277 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getMountPoints"); | 277 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getMountPoints"); |
278 }; | 278 }; |
279 | 279 |
280 // Formats Device given its mount path. | 280 // Formats Device given its mount path. |
281 class FormatDeviceFunction | 281 class FormatDeviceFunction |
282 : public SyncExtensionFunction { | 282 : public FileBrowserFunction { |
283 public: | 283 public: |
284 FormatDeviceFunction(); | 284 FormatDeviceFunction(); |
285 | 285 |
286 protected: | 286 protected: |
287 virtual ~FormatDeviceFunction(); | 287 virtual ~FormatDeviceFunction(); |
288 | 288 |
289 virtual bool RunImpl() OVERRIDE; | 289 virtual bool RunImpl() OVERRIDE; |
290 | 290 |
| 291 // FileBrowserFunction overrides. |
| 292 virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files, |
| 293 void* context) OVERRIDE; |
| 294 |
291 private: | 295 private: |
292 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.formatDevice"); | 296 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.formatDevice"); |
293 }; | 297 }; |
294 | 298 |
295 // Retrieves devices meta-data. Expects volume's device path as an argument. | 299 // Retrieves devices meta-data. Expects volume's device path as an argument. |
296 class GetVolumeMetadataFunction | 300 class GetVolumeMetadataFunction |
297 : public SyncExtensionFunction { | 301 : public SyncExtensionFunction { |
298 public: | 302 public: |
299 GetVolumeMetadataFunction(); | 303 GetVolumeMetadataFunction(); |
300 | 304 |
(...skipping 19 matching lines...) Expand all Loading... |
320 virtual ~FileDialogStringsFunction() {} | 324 virtual ~FileDialogStringsFunction() {} |
321 | 325 |
322 // SyncExtensionFunction overrides. | 326 // SyncExtensionFunction overrides. |
323 virtual bool RunImpl() OVERRIDE; | 327 virtual bool RunImpl() OVERRIDE; |
324 | 328 |
325 private: | 329 private: |
326 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getStrings"); | 330 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getStrings"); |
327 }; | 331 }; |
328 | 332 |
329 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_ | 333 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_ |
OLD | NEW |