| 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> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 class FileManagerPrivateRequestFileSystemFunction | 35 class FileManagerPrivateRequestFileSystemFunction |
| 36 : public LoggedAsyncExtensionFunction { | 36 : public LoggedAsyncExtensionFunction { |
| 37 public: | 37 public: |
| 38 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.requestFileSystem", | 38 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.requestFileSystem", |
| 39 FILEMANAGERPRIVATE_REQUESTFILESYSTEM) | 39 FILEMANAGERPRIVATE_REQUESTFILESYSTEM) |
| 40 | 40 |
| 41 protected: | 41 protected: |
| 42 virtual ~FileManagerPrivateRequestFileSystemFunction() {} | 42 virtual ~FileManagerPrivateRequestFileSystemFunction() {} |
| 43 | 43 |
| 44 // AsyncExtensionFunction overrides. | 44 // AsyncExtensionFunction overrides. |
| 45 virtual bool RunAsync() OVERRIDE; | 45 virtual bool RunAsync() override; |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 void RespondSuccessOnUIThread(const std::string& name, | 48 void RespondSuccessOnUIThread(const std::string& name, |
| 49 const GURL& root_url); | 49 const GURL& root_url); |
| 50 void RespondFailedOnUIThread(base::File::Error error_code); | 50 void RespondFailedOnUIThread(base::File::Error error_code); |
| 51 | 51 |
| 52 // Called when something goes wrong. Records the error to |error_| per the | 52 // Called when something goes wrong. Records the error to |error_| per the |
| 53 // error code and reports that the private API function failed. | 53 // error code and reports that the private API function failed. |
| 54 void DidFail(base::File::Error error_code); | 54 void DidFail(base::File::Error error_code); |
| 55 | 55 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 74 protected: | 74 protected: |
| 75 virtual ~FileWatchFunctionBase() {} | 75 virtual ~FileWatchFunctionBase() {} |
| 76 | 76 |
| 77 // Performs a file watch operation (ex. adds or removes a file watch). | 77 // Performs a file watch operation (ex. adds or removes a file watch). |
| 78 virtual void PerformFileWatchOperation( | 78 virtual void PerformFileWatchOperation( |
| 79 const base::FilePath& local_path, | 79 const base::FilePath& local_path, |
| 80 const base::FilePath& virtual_path, | 80 const base::FilePath& virtual_path, |
| 81 const std::string& extension_id) = 0; | 81 const std::string& extension_id) = 0; |
| 82 | 82 |
| 83 // AsyncExtensionFunction overrides. | 83 // AsyncExtensionFunction overrides. |
| 84 virtual bool RunAsync() OVERRIDE; | 84 virtual bool RunAsync() override; |
| 85 | 85 |
| 86 // Calls SendResponse() with |success| converted to base::Value. | 86 // Calls SendResponse() with |success| converted to base::Value. |
| 87 void Respond(bool success); | 87 void Respond(bool success); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 // Implements the chrome.fileManagerPrivate.addFileWatch method. | 90 // Implements the chrome.fileManagerPrivate.addFileWatch method. |
| 91 // Starts watching changes in directories. | 91 // Starts watching changes in directories. |
| 92 class FileManagerPrivateAddFileWatchFunction : public FileWatchFunctionBase { | 92 class FileManagerPrivateAddFileWatchFunction : public FileWatchFunctionBase { |
| 93 public: | 93 public: |
| 94 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.addFileWatch", | 94 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.addFileWatch", |
| 95 FILEMANAGERPRIVATE_ADDFILEWATCH) | 95 FILEMANAGERPRIVATE_ADDFILEWATCH) |
| 96 | 96 |
| 97 protected: | 97 protected: |
| 98 virtual ~FileManagerPrivateAddFileWatchFunction() {} | 98 virtual ~FileManagerPrivateAddFileWatchFunction() {} |
| 99 | 99 |
| 100 // FileWatchFunctionBase override. | 100 // FileWatchFunctionBase override. |
| 101 virtual void PerformFileWatchOperation( | 101 virtual void PerformFileWatchOperation( |
| 102 const base::FilePath& local_path, | 102 const base::FilePath& local_path, |
| 103 const base::FilePath& virtual_path, | 103 const base::FilePath& virtual_path, |
| 104 const std::string& extension_id) OVERRIDE; | 104 const std::string& extension_id) override; |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 | 107 |
| 108 // Implements the chrome.fileManagerPrivate.removeFileWatch method. | 108 // Implements the chrome.fileManagerPrivate.removeFileWatch method. |
| 109 // Stops watching changes in directories. | 109 // Stops watching changes in directories. |
| 110 class FileManagerPrivateRemoveFileWatchFunction : public FileWatchFunctionBase { | 110 class FileManagerPrivateRemoveFileWatchFunction : public FileWatchFunctionBase { |
| 111 public: | 111 public: |
| 112 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.removeFileWatch", | 112 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.removeFileWatch", |
| 113 FILEMANAGERPRIVATE_REMOVEFILEWATCH) | 113 FILEMANAGERPRIVATE_REMOVEFILEWATCH) |
| 114 | 114 |
| 115 protected: | 115 protected: |
| 116 virtual ~FileManagerPrivateRemoveFileWatchFunction() {} | 116 virtual ~FileManagerPrivateRemoveFileWatchFunction() {} |
| 117 | 117 |
| 118 // FileWatchFunctionBase override. | 118 // FileWatchFunctionBase override. |
| 119 virtual void PerformFileWatchOperation( | 119 virtual void PerformFileWatchOperation( |
| 120 const base::FilePath& local_path, | 120 const base::FilePath& local_path, |
| 121 const base::FilePath& virtual_path, | 121 const base::FilePath& virtual_path, |
| 122 const std::string& extension_id) OVERRIDE; | 122 const std::string& extension_id) override; |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 // Implements the chrome.fileManagerPrivate.getSizeStats method. | 125 // Implements the chrome.fileManagerPrivate.getSizeStats method. |
| 126 class FileManagerPrivateGetSizeStatsFunction | 126 class FileManagerPrivateGetSizeStatsFunction |
| 127 : public LoggedAsyncExtensionFunction { | 127 : public LoggedAsyncExtensionFunction { |
| 128 public: | 128 public: |
| 129 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getSizeStats", | 129 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getSizeStats", |
| 130 FILEMANAGERPRIVATE_GETSIZESTATS) | 130 FILEMANAGERPRIVATE_GETSIZESTATS) |
| 131 | 131 |
| 132 protected: | 132 protected: |
| 133 virtual ~FileManagerPrivateGetSizeStatsFunction() {} | 133 virtual ~FileManagerPrivateGetSizeStatsFunction() {} |
| 134 | 134 |
| 135 // AsyncExtensionFunction overrides. | 135 // AsyncExtensionFunction overrides. |
| 136 virtual bool RunAsync() OVERRIDE; | 136 virtual bool RunAsync() override; |
| 137 | 137 |
| 138 private: | 138 private: |
| 139 void GetDriveAvailableSpaceCallback(drive::FileError error, | 139 void GetDriveAvailableSpaceCallback(drive::FileError error, |
| 140 int64 bytes_total, | 140 int64 bytes_total, |
| 141 int64 bytes_used); | 141 int64 bytes_used); |
| 142 | 142 |
| 143 void GetSizeStatsCallback(const uint64* total_size, | 143 void GetSizeStatsCallback(const uint64* total_size, |
| 144 const uint64* remaining_size); | 144 const uint64* remaining_size); |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 // Implements the chrome.fileManagerPrivate.validatePathNameLength method. | 147 // Implements the chrome.fileManagerPrivate.validatePathNameLength method. |
| 148 class FileManagerPrivateValidatePathNameLengthFunction | 148 class FileManagerPrivateValidatePathNameLengthFunction |
| 149 : public LoggedAsyncExtensionFunction { | 149 : public LoggedAsyncExtensionFunction { |
| 150 public: | 150 public: |
| 151 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.validatePathNameLength", | 151 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.validatePathNameLength", |
| 152 FILEMANAGERPRIVATE_VALIDATEPATHNAMELENGTH) | 152 FILEMANAGERPRIVATE_VALIDATEPATHNAMELENGTH) |
| 153 | 153 |
| 154 protected: | 154 protected: |
| 155 virtual ~FileManagerPrivateValidatePathNameLengthFunction() {} | 155 virtual ~FileManagerPrivateValidatePathNameLengthFunction() {} |
| 156 | 156 |
| 157 void OnFilePathLimitRetrieved(size_t current_length, size_t max_length); | 157 void OnFilePathLimitRetrieved(size_t current_length, size_t max_length); |
| 158 | 158 |
| 159 // AsyncExtensionFunction overrides. | 159 // AsyncExtensionFunction overrides. |
| 160 virtual bool RunAsync() OVERRIDE; | 160 virtual bool RunAsync() override; |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 // Implements the chrome.fileManagerPrivate.formatVolume method. | 163 // Implements the chrome.fileManagerPrivate.formatVolume method. |
| 164 // Formats Volume given its mount path. | 164 // Formats Volume given its mount path. |
| 165 class FileManagerPrivateFormatVolumeFunction | 165 class FileManagerPrivateFormatVolumeFunction |
| 166 : public LoggedAsyncExtensionFunction { | 166 : public LoggedAsyncExtensionFunction { |
| 167 public: | 167 public: |
| 168 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.formatVolume", | 168 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.formatVolume", |
| 169 FILEMANAGERPRIVATE_FORMATVOLUME) | 169 FILEMANAGERPRIVATE_FORMATVOLUME) |
| 170 | 170 |
| 171 protected: | 171 protected: |
| 172 virtual ~FileManagerPrivateFormatVolumeFunction() {} | 172 virtual ~FileManagerPrivateFormatVolumeFunction() {} |
| 173 | 173 |
| 174 // AsyncExtensionFunction overrides. | 174 // AsyncExtensionFunction overrides. |
| 175 virtual bool RunAsync() OVERRIDE; | 175 virtual bool RunAsync() override; |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 // Implements the chrome.fileManagerPrivate.startCopy method. | 178 // Implements the chrome.fileManagerPrivate.startCopy method. |
| 179 class FileManagerPrivateStartCopyFunction | 179 class FileManagerPrivateStartCopyFunction |
| 180 : public LoggedAsyncExtensionFunction { | 180 : public LoggedAsyncExtensionFunction { |
| 181 public: | 181 public: |
| 182 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.startCopy", | 182 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.startCopy", |
| 183 FILEMANAGERPRIVATE_STARTCOPY) | 183 FILEMANAGERPRIVATE_STARTCOPY) |
| 184 | 184 |
| 185 protected: | 185 protected: |
| 186 virtual ~FileManagerPrivateStartCopyFunction() {} | 186 virtual ~FileManagerPrivateStartCopyFunction() {} |
| 187 | 187 |
| 188 // AsyncExtensionFunction overrides. | 188 // AsyncExtensionFunction overrides. |
| 189 virtual bool RunAsync() OVERRIDE; | 189 virtual bool RunAsync() override; |
| 190 | 190 |
| 191 private: | 191 private: |
| 192 // Part of RunAsync(). Called after Copy() is started on IO thread. | 192 // Part of RunAsync(). Called after Copy() is started on IO thread. |
| 193 void RunAfterStartCopy(int operation_id); | 193 void RunAfterStartCopy(int operation_id); |
| 194 }; | 194 }; |
| 195 | 195 |
| 196 // Implements the chrome.fileManagerPrivate.cancelCopy method. | 196 // Implements the chrome.fileManagerPrivate.cancelCopy method. |
| 197 class FileManagerPrivateCancelCopyFunction | 197 class FileManagerPrivateCancelCopyFunction |
| 198 : public LoggedAsyncExtensionFunction { | 198 : public LoggedAsyncExtensionFunction { |
| 199 public: | 199 public: |
| 200 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.cancelCopy", | 200 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.cancelCopy", |
| 201 FILEMANAGERPRIVATE_CANCELCOPY) | 201 FILEMANAGERPRIVATE_CANCELCOPY) |
| 202 | 202 |
| 203 protected: | 203 protected: |
| 204 virtual ~FileManagerPrivateCancelCopyFunction() {} | 204 virtual ~FileManagerPrivateCancelCopyFunction() {} |
| 205 | 205 |
| 206 // AsyncExtensionFunction overrides. | 206 // AsyncExtensionFunction overrides. |
| 207 virtual bool RunAsync() OVERRIDE; | 207 virtual bool RunAsync() override; |
| 208 }; | 208 }; |
| 209 | 209 |
| 210 // Implements the chrome.fileManagerPrivateInternal.resolveIsolatedEntries | 210 // Implements the chrome.fileManagerPrivateInternal.resolveIsolatedEntries |
| 211 // method. | 211 // method. |
| 212 class FileManagerPrivateInternalResolveIsolatedEntriesFunction | 212 class FileManagerPrivateInternalResolveIsolatedEntriesFunction |
| 213 : public ChromeAsyncExtensionFunction { | 213 : public ChromeAsyncExtensionFunction { |
| 214 public: | 214 public: |
| 215 DECLARE_EXTENSION_FUNCTION( | 215 DECLARE_EXTENSION_FUNCTION( |
| 216 "fileManagerPrivateInternal.resolveIsolatedEntries", | 216 "fileManagerPrivateInternal.resolveIsolatedEntries", |
| 217 FILEMANAGERPRIVATE_RESOLVEISOLATEDENTRIES) | 217 FILEMANAGERPRIVATE_RESOLVEISOLATEDENTRIES) |
| 218 | 218 |
| 219 protected: | 219 protected: |
| 220 virtual ~FileManagerPrivateInternalResolveIsolatedEntriesFunction() {} | 220 virtual ~FileManagerPrivateInternalResolveIsolatedEntriesFunction() {} |
| 221 | 221 |
| 222 // AsyncExtensionFunction overrides. | 222 // AsyncExtensionFunction overrides. |
| 223 virtual bool RunAsync() OVERRIDE; | 223 virtual bool RunAsync() override; |
| 224 | 224 |
| 225 private: | 225 private: |
| 226 void RunAsyncAfterConvertFileDefinitionListToEntryDefinitionList(scoped_ptr< | 226 void RunAsyncAfterConvertFileDefinitionListToEntryDefinitionList(scoped_ptr< |
| 227 file_manager::util::EntryDefinitionList> entry_definition_list); | 227 file_manager::util::EntryDefinitionList> entry_definition_list); |
| 228 }; | 228 }; |
| 229 | 229 |
| 230 } // namespace extensions | 230 } // namespace extensions |
| 231 | 231 |
| 232 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_FILE_SYST
EM_H_ | 232 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_FILE_SYST
EM_H_ |
| OLD | NEW |