| 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 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> |
| 11 | 11 |
| 12 #include "base/platform_file.h" | 12 #include "base/platform_file.h" |
| 13 #include "chrome/browser/chromeos/drive/file_errors.h" | 13 #include "chrome/browser/chromeos/drive/file_errors.h" |
| 14 #include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h" | 14 #include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h" |
| 15 | 15 |
| 16 class GURL; | 16 class GURL; |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class FilePath; | 19 class FilePath; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace fileapi { | 22 namespace fileapi { |
| 23 class FileSystemContext; | 23 class FileSystemContext; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace file_manager { | 26 namespace extensions { |
| 27 | 27 |
| 28 // Implements the chrome.fileBrowserPrivate.requestFileSystem method. | 28 // Implements the chrome.fileBrowserPrivate.requestFileSystem method. |
| 29 class RequestFileSystemFunction : public LoggedAsyncExtensionFunction { | 29 class RequestFileSystemFunction |
| 30 : public file_manager::LoggedAsyncExtensionFunction { |
| 30 public: | 31 public: |
| 31 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.requestFileSystem", | 32 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.requestFileSystem", |
| 32 FILEBROWSERPRIVATE_REQUESTFILESYSTEM) | 33 FILEBROWSERPRIVATE_REQUESTFILESYSTEM) |
| 33 | 34 |
| 34 RequestFileSystemFunction(); | 35 RequestFileSystemFunction(); |
| 35 | 36 |
| 36 protected: | 37 protected: |
| 37 virtual ~RequestFileSystemFunction(); | 38 virtual ~RequestFileSystemFunction(); |
| 38 | 39 |
| 39 // AsyncExtensionFunction overrides. | 40 // AsyncExtensionFunction overrides. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 59 // |child_id|. | 60 // |child_id|. |
| 60 bool SetupFileSystemAccessPermissions( | 61 bool SetupFileSystemAccessPermissions( |
| 61 scoped_refptr<fileapi::FileSystemContext> file_system_context, | 62 scoped_refptr<fileapi::FileSystemContext> file_system_context, |
| 62 int child_id, | 63 int child_id, |
| 63 scoped_refptr<const extensions::Extension> extension); | 64 scoped_refptr<const extensions::Extension> extension); |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 // Base class for AddFileWatchFunction and RemoveFileWatchFunction. Although | 67 // Base class for AddFileWatchFunction and RemoveFileWatchFunction. Although |
| 67 // it's called "FileWatch", the class and its sub classes are used only for | 68 // it's called "FileWatch", the class and its sub classes are used only for |
| 68 // watching changes in directories. | 69 // watching changes in directories. |
| 69 class FileWatchFunctionBase : public LoggedAsyncExtensionFunction { | 70 class FileWatchFunctionBase |
| 71 : public file_manager::LoggedAsyncExtensionFunction { |
| 70 public: | 72 public: |
| 71 FileWatchFunctionBase(); | 73 FileWatchFunctionBase(); |
| 72 | 74 |
| 73 protected: | 75 protected: |
| 74 virtual ~FileWatchFunctionBase(); | 76 virtual ~FileWatchFunctionBase(); |
| 75 | 77 |
| 76 // Performs a file watch operation (ex. adds or removes a file watch). | 78 // Performs a file watch operation (ex. adds or removes a file watch). |
| 77 virtual void PerformFileWatchOperation( | 79 virtual void PerformFileWatchOperation( |
| 78 const base::FilePath& local_path, | 80 const base::FilePath& local_path, |
| 79 const base::FilePath& virtual_path, | 81 const base::FilePath& virtual_path, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 122 |
| 121 // FileWatchFunctionBase override. | 123 // FileWatchFunctionBase override. |
| 122 virtual void PerformFileWatchOperation( | 124 virtual void PerformFileWatchOperation( |
| 123 const base::FilePath& local_path, | 125 const base::FilePath& local_path, |
| 124 const base::FilePath& virtual_path, | 126 const base::FilePath& virtual_path, |
| 125 const std::string& extension_id) OVERRIDE; | 127 const std::string& extension_id) OVERRIDE; |
| 126 }; | 128 }; |
| 127 | 129 |
| 128 // Implements the chrome.fileBrowserPrivate.setLastModified method. | 130 // Implements the chrome.fileBrowserPrivate.setLastModified method. |
| 129 // Sets last modified date in seconds of local file | 131 // Sets last modified date in seconds of local file |
| 130 class SetLastModifiedFunction : public LoggedAsyncExtensionFunction { | 132 class SetLastModifiedFunction |
| 133 : public file_manager::LoggedAsyncExtensionFunction { |
| 131 public: | 134 public: |
| 132 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.setLastModified", | 135 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.setLastModified", |
| 133 FILEBROWSERPRIVATE_SETLASTMODIFIED) | 136 FILEBROWSERPRIVATE_SETLASTMODIFIED) |
| 134 | 137 |
| 135 SetLastModifiedFunction(); | 138 SetLastModifiedFunction(); |
| 136 | 139 |
| 137 protected: | 140 protected: |
| 138 virtual ~SetLastModifiedFunction(); | 141 virtual ~SetLastModifiedFunction(); |
| 139 | 142 |
| 140 // AsyncExtensionFunction overrides. | 143 // AsyncExtensionFunction overrides. |
| 141 virtual bool RunImpl() OVERRIDE; | 144 virtual bool RunImpl() OVERRIDE; |
| 142 }; | 145 }; |
| 143 | 146 |
| 144 // Implements the chrome.fileBrowserPrivate.getSizeStats method. | 147 // Implements the chrome.fileBrowserPrivate.getSizeStats method. |
| 145 class GetSizeStatsFunction : public LoggedAsyncExtensionFunction { | 148 class GetSizeStatsFunction |
| 149 : public file_manager::LoggedAsyncExtensionFunction { |
| 146 public: | 150 public: |
| 147 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getSizeStats", | 151 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getSizeStats", |
| 148 FILEBROWSERPRIVATE_GETSIZESTATS) | 152 FILEBROWSERPRIVATE_GETSIZESTATS) |
| 149 | 153 |
| 150 GetSizeStatsFunction(); | 154 GetSizeStatsFunction(); |
| 151 | 155 |
| 152 protected: | 156 protected: |
| 153 virtual ~GetSizeStatsFunction(); | 157 virtual ~GetSizeStatsFunction(); |
| 154 | 158 |
| 155 // AsyncExtensionFunction overrides. | 159 // AsyncExtensionFunction overrides. |
| 156 virtual bool RunImpl() OVERRIDE; | 160 virtual bool RunImpl() OVERRIDE; |
| 157 | 161 |
| 158 private: | 162 private: |
| 159 void GetDriveAvailableSpaceCallback(drive::FileError error, | 163 void GetDriveAvailableSpaceCallback(drive::FileError error, |
| 160 int64 bytes_total, | 164 int64 bytes_total, |
| 161 int64 bytes_used); | 165 int64 bytes_used); |
| 162 | 166 |
| 163 void GetSizeStatsCallback(const uint64* total_size, | 167 void GetSizeStatsCallback(const uint64* total_size, |
| 164 const uint64* remaining_size); | 168 const uint64* remaining_size); |
| 165 }; | 169 }; |
| 166 | 170 |
| 167 // Implements the chrome.fileBrowserPrivate.getVolumeMetadata method. | 171 // Implements the chrome.fileBrowserPrivate.getVolumeMetadata method. |
| 168 // Retrieves devices meta-data. Expects volume's device path as an argument. | 172 // Retrieves devices meta-data. Expects volume's device path as an argument. |
| 169 class GetVolumeMetadataFunction : public LoggedAsyncExtensionFunction { | 173 class GetVolumeMetadataFunction |
| 174 : public file_manager::LoggedAsyncExtensionFunction { |
| 170 public: | 175 public: |
| 171 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getVolumeMetadata", | 176 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getVolumeMetadata", |
| 172 FILEBROWSERPRIVATE_GETVOLUMEMETADATA) | 177 FILEBROWSERPRIVATE_GETVOLUMEMETADATA) |
| 173 | 178 |
| 174 GetVolumeMetadataFunction(); | 179 GetVolumeMetadataFunction(); |
| 175 | 180 |
| 176 protected: | 181 protected: |
| 177 virtual ~GetVolumeMetadataFunction(); | 182 virtual ~GetVolumeMetadataFunction(); |
| 178 | 183 |
| 179 // AsyncExtensionFunction overrides. | 184 // AsyncExtensionFunction overrides. |
| 180 virtual bool RunImpl() OVERRIDE; | 185 virtual bool RunImpl() OVERRIDE; |
| 181 }; | 186 }; |
| 182 | 187 |
| 183 // Implements the chrome.fileBrowserPrivate.validatePathNameLength method. | 188 // Implements the chrome.fileBrowserPrivate.validatePathNameLength method. |
| 184 class ValidatePathNameLengthFunction : public LoggedAsyncExtensionFunction { | 189 class ValidatePathNameLengthFunction |
| 190 : public file_manager::LoggedAsyncExtensionFunction { |
| 185 public: | 191 public: |
| 186 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.validatePathNameLength", | 192 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.validatePathNameLength", |
| 187 FILEBROWSERPRIVATE_VALIDATEPATHNAMELENGTH) | 193 FILEBROWSERPRIVATE_VALIDATEPATHNAMELENGTH) |
| 188 | 194 |
| 189 ValidatePathNameLengthFunction(); | 195 ValidatePathNameLengthFunction(); |
| 190 | 196 |
| 191 protected: | 197 protected: |
| 192 virtual ~ValidatePathNameLengthFunction(); | 198 virtual ~ValidatePathNameLengthFunction(); |
| 193 | 199 |
| 194 void OnFilePathLimitRetrieved(size_t current_length, size_t max_length); | 200 void OnFilePathLimitRetrieved(size_t current_length, size_t max_length); |
| 195 | 201 |
| 196 // AsyncExtensionFunction overrides. | 202 // AsyncExtensionFunction overrides. |
| 197 virtual bool RunImpl() OVERRIDE; | 203 virtual bool RunImpl() OVERRIDE; |
| 198 }; | 204 }; |
| 199 | 205 |
| 200 // Implements the chrome.fileBrowserPrivate.formatDevice method. | 206 // Implements the chrome.fileBrowserPrivate.formatDevice method. |
| 201 // Formats Device given its mount path. | 207 // Formats Device given its mount path. |
| 202 class FormatDeviceFunction : public LoggedAsyncExtensionFunction { | 208 class FormatDeviceFunction : public file_manager::LoggedAsyncExtensionFunction { |
| 203 public: | 209 public: |
| 204 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.formatDevice", | 210 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.formatDevice", |
| 205 FILEBROWSERPRIVATE_FORMATDEVICE) | 211 FILEBROWSERPRIVATE_FORMATDEVICE) |
| 206 | 212 |
| 207 FormatDeviceFunction(); | 213 FormatDeviceFunction(); |
| 208 | 214 |
| 209 protected: | 215 protected: |
| 210 virtual ~FormatDeviceFunction(); | 216 virtual ~FormatDeviceFunction(); |
| 211 | 217 |
| 212 // AsyncExtensionFunction overrides. | 218 // AsyncExtensionFunction overrides. |
| 213 virtual bool RunImpl() OVERRIDE; | 219 virtual bool RunImpl() OVERRIDE; |
| 214 }; | 220 }; |
| 215 | 221 |
| 216 } // namespace file_manager | 222 } // namespace extensions |
| 217 | 223 |
| 218 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_FILE_SYST
EM_H_ | 224 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_FILE_SYST
EM_H_ |
| OLD | NEW |