| OLD | NEW |
| 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 task related API functions. | 5 // This file provides task related API functions. |
| 6 | 6 |
| 7 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MOUNT_H_ | 7 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MOUNT_H_ |
| 8 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MOUNT_H_ | 8 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MOUNT_H_ |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "chrome/browser/chromeos/drive/file_errors.h" | 14 #include "chrome/browser/chromeos/drive/file_errors.h" |
| 15 #include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h" | 15 #include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h" |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 struct SelectedFileInfo; | 18 struct SelectedFileInfo; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace file_manager { | 21 namespace extensions { |
| 22 | 22 |
| 23 // Implements chrome.fileBrowserPrivate.addMount method. | 23 // Implements chrome.fileBrowserPrivate.addMount method. |
| 24 // Mounts a device or a file. | 24 // Mounts a device or a file. |
| 25 class AddMountFunction : public LoggedAsyncExtensionFunction { | 25 class AddMountFunction : public file_manager::LoggedAsyncExtensionFunction { |
| 26 public: | 26 public: |
| 27 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.addMount", | 27 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.addMount", |
| 28 FILEBROWSERPRIVATE_ADDMOUNT) | 28 FILEBROWSERPRIVATE_ADDMOUNT) |
| 29 | 29 |
| 30 AddMountFunction(); | 30 AddMountFunction(); |
| 31 | 31 |
| 32 protected: | 32 protected: |
| 33 virtual ~AddMountFunction(); | 33 virtual ~AddMountFunction(); |
| 34 | 34 |
| 35 // AsyncExtensionFunction overrides. | 35 // AsyncExtensionFunction overrides. |
| 36 virtual bool RunImpl() OVERRIDE; | 36 virtual bool RunImpl() OVERRIDE; |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 // A callback method to handle the result of MarkCacheAsMounted. | 39 // A callback method to handle the result of MarkCacheAsMounted. |
| 40 void OnMountedStateSet(const std::string& mount_type, | 40 void OnMountedStateSet(const std::string& mount_type, |
| 41 const base::FilePath::StringType& file_name, | 41 const base::FilePath::StringType& file_name, |
| 42 drive::FileError error, | 42 drive::FileError error, |
| 43 const base::FilePath& file_path); | 43 const base::FilePath& file_path); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 // Implements chrome.fileBrowserPrivate.removeMount method. | 46 // Implements chrome.fileBrowserPrivate.removeMount method. |
| 47 // Unmounts selected device. Expects mount point path as an argument. | 47 // Unmounts selected device. Expects mount point path as an argument. |
| 48 class RemoveMountFunction : public LoggedAsyncExtensionFunction { | 48 class RemoveMountFunction : public file_manager::LoggedAsyncExtensionFunction { |
| 49 public: | 49 public: |
| 50 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.removeMount", | 50 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.removeMount", |
| 51 FILEBROWSERPRIVATE_REMOVEMOUNT) | 51 FILEBROWSERPRIVATE_REMOVEMOUNT) |
| 52 | 52 |
| 53 RemoveMountFunction(); | 53 RemoveMountFunction(); |
| 54 | 54 |
| 55 protected: | 55 protected: |
| 56 virtual ~RemoveMountFunction(); | 56 virtual ~RemoveMountFunction(); |
| 57 | 57 |
| 58 // AsyncExtensionFunction overrides. | 58 // AsyncExtensionFunction overrides. |
| 59 virtual bool RunImpl() OVERRIDE; | 59 virtual bool RunImpl() OVERRIDE; |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 // A callback method to handle the result of GetSelectedFileInfo. | 62 // A callback method to handle the result of GetSelectedFileInfo. |
| 63 void GetSelectedFileInfoResponse( | 63 void GetSelectedFileInfoResponse( |
| 64 const std::vector<ui::SelectedFileInfo>& files); | 64 const std::vector<ui::SelectedFileInfo>& files); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 // Implements chrome.fileBrowserPrivate.getMountPoints method. | 67 // Implements chrome.fileBrowserPrivate.getMountPoints method. |
| 68 class GetMountPointsFunction : public LoggedAsyncExtensionFunction { | 68 class GetMountPointsFunction |
| 69 : public file_manager::LoggedAsyncExtensionFunction { |
| 69 public: | 70 public: |
| 70 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getMountPoints", | 71 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getMountPoints", |
| 71 FILEBROWSERPRIVATE_GETMOUNTPOINTS) | 72 FILEBROWSERPRIVATE_GETMOUNTPOINTS) |
| 72 | 73 |
| 73 GetMountPointsFunction(); | 74 GetMountPointsFunction(); |
| 74 | 75 |
| 75 protected: | 76 protected: |
| 76 virtual ~GetMountPointsFunction(); | 77 virtual ~GetMountPointsFunction(); |
| 77 | 78 |
| 78 // AsyncExtensionFunction overrides. | 79 // AsyncExtensionFunction overrides. |
| 79 virtual bool RunImpl() OVERRIDE; | 80 virtual bool RunImpl() OVERRIDE; |
| 80 }; | 81 }; |
| 81 | 82 |
| 82 } // namespace file_manager | 83 } // namespace extensions |
| 83 | 84 |
| 84 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MOUNT_H_ | 85 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MOUNT_H_ |
| OLD | NEW |