| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/platform_file.h" | 13 #include "base/platform_file.h" |
| 14 #include "chrome/browser/extensions/extension_function.h" | 14 #include "chrome/browser/extensions/extension_function.h" |
| 15 #include "chrome/browser/ui/shell_dialogs.h" | 15 #include "chrome/browser/ui/shell_dialogs.h" |
| 16 #include "googleurl/src/url_util.h" | 16 #include "googleurl/src/url_util.h" |
| 17 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 17 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
| 18 | 18 |
| 19 #ifdef OS_CHROMEOS | 19 #ifdef OS_CHROMEOS |
| 20 #include "chrome/browser/chromeos/cros/mount_library.h" | 20 #include "chrome/browser/chromeos/disks/disk_mount_manager.h" |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 class GURL; | 23 class GURL; |
| 24 | 24 |
| 25 // Implements the chrome.fileBrowserPrivate.requestLocalFileSystem method. | 25 // Implements the chrome.fileBrowserPrivate.requestLocalFileSystem method. |
| 26 class RequestLocalFileSystemFunction : public AsyncExtensionFunction { | 26 class RequestLocalFileSystemFunction : public AsyncExtensionFunction { |
| 27 protected: | 27 protected: |
| 28 friend class LocalFileSystemCallbackDispatcher; | 28 friend class LocalFileSystemCallbackDispatcher; |
| 29 // AsyncExtensionFunction overrides. | 29 // AsyncExtensionFunction overrides. |
| 30 virtual bool RunImpl() OVERRIDE; | 30 virtual bool RunImpl() OVERRIDE; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(const FilePathList& files, | 232 virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files, |
| 233 void* context) OVERRIDE; | 233 void* context) OVERRIDE; |
| 234 | 234 |
| 235 private: | 235 private: |
| 236 #if defined(OS_CHROMEOS) | |
| 237 struct MountParamaters { | |
| 238 MountParamaters(const std::string& type, | |
| 239 const chromeos::MountPathOptions& options) | |
| 240 : mount_type(type), mount_options(options) {} | |
| 241 ~MountParamaters() {} | |
| 242 std::string mount_type; | |
| 243 chromeos::MountPathOptions mount_options; | |
| 244 }; | |
| 245 #endif | |
| 246 | |
| 247 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.addMount"); | 236 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.addMount"); |
| 248 }; | 237 }; |
| 249 | 238 |
| 250 // Unmounts selected device. Expects mount point path as an argument. | 239 // Unmounts selected device. Expects mount point path as an argument. |
| 251 class RemoveMountFunction | 240 class RemoveMountFunction |
| 252 : public FileBrowserFunction { | 241 : public FileBrowserFunction { |
| 253 public: | 242 public: |
| 254 RemoveMountFunction(); | 243 RemoveMountFunction(); |
| 255 | 244 |
| 256 protected: | 245 protected: |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 294 |
| 306 protected: | 295 protected: |
| 307 virtual ~GetSizeStatsFunction(); | 296 virtual ~GetSizeStatsFunction(); |
| 308 | 297 |
| 309 // FileBrowserFunction overrides. | 298 // FileBrowserFunction overrides. |
| 310 virtual bool RunImpl() OVERRIDE; | 299 virtual bool RunImpl() OVERRIDE; |
| 311 virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files, | 300 virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files, |
| 312 void* context) OVERRIDE; | 301 void* context) OVERRIDE; |
| 313 | 302 |
| 314 private: | 303 private: |
| 315 void GetSizeStatsCallbackOnUIThread(const char* mount_path, | 304 void GetSizeStatsCallbackOnUIThread(const std::string& mount_path, |
| 316 size_t total_size_kb, | 305 size_t total_size_kb, |
| 317 size_t remaining_size_kb); | 306 size_t remaining_size_kb); |
| 318 void CallGetSizeStatsOnFileThread(const char* mount_path); | 307 void CallGetSizeStatsOnFileThread(const std::string& mount_path); |
| 319 | 308 |
| 320 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getSizeStats"); | 309 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getSizeStats"); |
| 321 }; | 310 }; |
| 322 | 311 |
| 323 // Retrieves devices meta-data. Expects volume's device path as an argument. | 312 // Retrieves devices meta-data. Expects volume's device path as an argument. |
| 324 class GetVolumeMetadataFunction | 313 class GetVolumeMetadataFunction |
| 325 : public SyncExtensionFunction { | 314 : public SyncExtensionFunction { |
| 326 public: | 315 public: |
| 327 GetVolumeMetadataFunction(); | 316 GetVolumeMetadataFunction(); |
| 328 | 317 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 348 virtual ~FileDialogStringsFunction() {} | 337 virtual ~FileDialogStringsFunction() {} |
| 349 | 338 |
| 350 // SyncExtensionFunction overrides. | 339 // SyncExtensionFunction overrides. |
| 351 virtual bool RunImpl() OVERRIDE; | 340 virtual bool RunImpl() OVERRIDE; |
| 352 | 341 |
| 353 private: | 342 private: |
| 354 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getStrings"); | 343 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getStrings"); |
| 355 }; | 344 }; |
| 356 | 345 |
| 357 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_ | 346 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_ |
| OLD | NEW |