| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 Profile* const profile_; | 137 Profile* const profile_; |
| 138 content::RenderFrameHost* const host_; | 138 content::RenderFrameHost* const host_; |
| 139 | 139 |
| 140 DISALLOW_COPY_AND_ASSIGN(ConsentProviderDelegate); | 140 DISALLOW_COPY_AND_ASSIGN(ConsentProviderDelegate); |
| 141 }; | 141 }; |
| 142 #endif | 142 #endif |
| 143 | 143 |
| 144 } // namespace file_system_api | 144 } // namespace file_system_api |
| 145 | 145 |
| 146 class FileSystemGetDisplayPathFunction : public ChromeSyncExtensionFunction { | 146 class FileSystemGetDisplayPathFunction : public UIThreadExtensionFunction { |
| 147 public: | 147 public: |
| 148 DECLARE_EXTENSION_FUNCTION("fileSystem.getDisplayPath", | 148 DECLARE_EXTENSION_FUNCTION("fileSystem.getDisplayPath", |
| 149 FILESYSTEM_GETDISPLAYPATH) | 149 FILESYSTEM_GETDISPLAYPATH) |
| 150 | 150 |
| 151 protected: | 151 protected: |
| 152 ~FileSystemGetDisplayPathFunction() override {} | 152 ~FileSystemGetDisplayPathFunction() override {} |
| 153 bool RunSync() override; | 153 ResponseAction Run() override; |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 class FileSystemEntryFunction : public ChromeAsyncExtensionFunction { | 156 class FileSystemEntryFunction : public ChromeAsyncExtensionFunction { |
| 157 protected: | 157 protected: |
| 158 FileSystemEntryFunction(); | 158 FileSystemEntryFunction(); |
| 159 | 159 |
| 160 ~FileSystemEntryFunction() override {} | 160 ~FileSystemEntryFunction() override {} |
| 161 | 161 |
| 162 // This is called when writable file entries are being returned. The function | 162 // This is called when writable file entries are being returned. The function |
| 163 // will ensure the files exist, creating them if necessary, and also check | 163 // will ensure the files exist, creating them if necessary, and also check |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 bool RunAsync() override; | 199 bool RunAsync() override; |
| 200 | 200 |
| 201 private: | 201 private: |
| 202 void CheckPermissionAndSendResponse(); | 202 void CheckPermissionAndSendResponse(); |
| 203 void SetIsDirectoryOnFileThread(); | 203 void SetIsDirectoryOnFileThread(); |
| 204 | 204 |
| 205 // The path to the file for which a writable entry has been requested. | 205 // The path to the file for which a writable entry has been requested. |
| 206 base::FilePath path_; | 206 base::FilePath path_; |
| 207 }; | 207 }; |
| 208 | 208 |
| 209 class FileSystemIsWritableEntryFunction : public ChromeSyncExtensionFunction { | 209 class FileSystemIsWritableEntryFunction : public UIThreadExtensionFunction { |
| 210 public: | 210 public: |
| 211 DECLARE_EXTENSION_FUNCTION("fileSystem.isWritableEntry", | 211 DECLARE_EXTENSION_FUNCTION("fileSystem.isWritableEntry", |
| 212 FILESYSTEM_ISWRITABLEENTRY) | 212 FILESYSTEM_ISWRITABLEENTRY) |
| 213 | 213 |
| 214 protected: | 214 protected: |
| 215 ~FileSystemIsWritableEntryFunction() override {} | 215 ~FileSystemIsWritableEntryFunction() override {} |
| 216 bool RunSync() override; | 216 ResponseAction Run() override; |
| 217 }; | 217 }; |
| 218 | 218 |
| 219 class FileSystemChooseEntryFunction : public FileSystemEntryFunction { | 219 class FileSystemChooseEntryFunction : public FileSystemEntryFunction { |
| 220 public: | 220 public: |
| 221 // Allow picker UI to be skipped in testing. | 221 // Allow picker UI to be skipped in testing. |
| 222 static void SkipPickerAndAlwaysSelectPathForTest(base::FilePath* path); | 222 static void SkipPickerAndAlwaysSelectPathForTest(base::FilePath* path); |
| 223 static void SkipPickerAndAlwaysSelectPathsForTest( | 223 static void SkipPickerAndAlwaysSelectPathsForTest( |
| 224 std::vector<base::FilePath>* paths); | 224 std::vector<base::FilePath>* paths); |
| 225 static void SkipPickerAndSelectSuggestedPathForTest(); | 225 static void SkipPickerAndSelectSuggestedPathForTest(); |
| 226 static void SkipPickerAndAlwaysCancelForTest(); | 226 static void SkipPickerAndAlwaysCancelForTest(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 private: | 292 private: |
| 293 // Retains the file entry referenced by |entry_id| in apps::SavedFilesService. | 293 // Retains the file entry referenced by |entry_id| in apps::SavedFilesService. |
| 294 // |entry_id| must refer to an entry in an isolated file system. |path| is a | 294 // |entry_id| must refer to an entry in an isolated file system. |path| is a |
| 295 // path of the entry. |file_info| is base::File::Info of the entry if it can | 295 // path of the entry. |file_info| is base::File::Info of the entry if it can |
| 296 // be obtained. | 296 // be obtained. |
| 297 void RetainFileEntry(const std::string& entry_id, | 297 void RetainFileEntry(const std::string& entry_id, |
| 298 const base::FilePath& path, | 298 const base::FilePath& path, |
| 299 std::unique_ptr<base::File::Info> file_info); | 299 std::unique_ptr<base::File::Info> file_info); |
| 300 }; | 300 }; |
| 301 | 301 |
| 302 class FileSystemIsRestorableFunction : public ChromeSyncExtensionFunction { | 302 class FileSystemIsRestorableFunction : public UIThreadExtensionFunction { |
| 303 public: | 303 public: |
| 304 DECLARE_EXTENSION_FUNCTION("fileSystem.isRestorable", FILESYSTEM_ISRESTORABLE) | 304 DECLARE_EXTENSION_FUNCTION("fileSystem.isRestorable", FILESYSTEM_ISRESTORABLE) |
| 305 | 305 |
| 306 protected: | 306 protected: |
| 307 ~FileSystemIsRestorableFunction() override {} | 307 ~FileSystemIsRestorableFunction() override {} |
| 308 bool RunSync() override; | 308 ResponseAction Run() override; |
| 309 }; | 309 }; |
| 310 | 310 |
| 311 class FileSystemRestoreEntryFunction : public FileSystemEntryFunction { | 311 class FileSystemRestoreEntryFunction : public FileSystemEntryFunction { |
| 312 public: | 312 public: |
| 313 DECLARE_EXTENSION_FUNCTION("fileSystem.restoreEntry", FILESYSTEM_RESTOREENTRY) | 313 DECLARE_EXTENSION_FUNCTION("fileSystem.restoreEntry", FILESYSTEM_RESTOREENTRY) |
| 314 | 314 |
| 315 protected: | 315 protected: |
| 316 ~FileSystemRestoreEntryFunction() override {} | 316 ~FileSystemRestoreEntryFunction() override {} |
| 317 bool RunAsync() override; | 317 bool RunAsync() override; |
| 318 }; | 318 }; |
| 319 | 319 |
| 320 class FileSystemObserveDirectoryFunction : public ChromeSyncExtensionFunction { | 320 class FileSystemObserveDirectoryFunction : public UIThreadExtensionFunction { |
| 321 public: | 321 public: |
| 322 DECLARE_EXTENSION_FUNCTION("fileSystem.observeDirectory", | 322 DECLARE_EXTENSION_FUNCTION("fileSystem.observeDirectory", |
| 323 FILESYSTEM_OBSERVEDIRECTORY) | 323 FILESYSTEM_OBSERVEDIRECTORY) |
| 324 | 324 |
| 325 protected: | 325 protected: |
| 326 ~FileSystemObserveDirectoryFunction() override {} | 326 ~FileSystemObserveDirectoryFunction() override {} |
| 327 bool RunSync() override; | 327 ResponseAction Run() override; |
| 328 }; | 328 }; |
| 329 | 329 |
| 330 class FileSystemUnobserveEntryFunction : public ChromeSyncExtensionFunction { | 330 class FileSystemUnobserveEntryFunction : public UIThreadExtensionFunction { |
| 331 public: | 331 public: |
| 332 DECLARE_EXTENSION_FUNCTION("fileSystem.unobserveEntry", | 332 DECLARE_EXTENSION_FUNCTION("fileSystem.unobserveEntry", |
| 333 FILESYSTEM_UNOBSERVEENTRY) | 333 FILESYSTEM_UNOBSERVEENTRY) |
| 334 | 334 |
| 335 protected: | 335 protected: |
| 336 ~FileSystemUnobserveEntryFunction() override {} | 336 ~FileSystemUnobserveEntryFunction() override {} |
| 337 bool RunSync() override; | 337 ResponseAction Run() override; |
| 338 }; | 338 }; |
| 339 | 339 |
| 340 class FileSystemGetObservedEntriesFunction | 340 class FileSystemGetObservedEntriesFunction : public UIThreadExtensionFunction { |
| 341 : public ChromeSyncExtensionFunction { | |
| 342 public: | 341 public: |
| 343 DECLARE_EXTENSION_FUNCTION("fileSystem.getObservedEntries", | 342 DECLARE_EXTENSION_FUNCTION("fileSystem.getObservedEntries", |
| 344 FILESYSTEM_GETOBSERVEDENTRIES); | 343 FILESYSTEM_GETOBSERVEDENTRIES); |
| 345 | 344 |
| 346 protected: | 345 protected: |
| 347 ~FileSystemGetObservedEntriesFunction() override {} | 346 ~FileSystemGetObservedEntriesFunction() override {} |
| 348 bool RunSync() override; | 347 ResponseAction Run() override; |
| 349 }; | 348 }; |
| 350 | 349 |
| 351 #if !defined(OS_CHROMEOS) | 350 #if !defined(OS_CHROMEOS) |
| 352 // Stub for non Chrome OS operating systems. | 351 // Stub for non Chrome OS operating systems. |
| 353 class FileSystemRequestFileSystemFunction : public UIThreadExtensionFunction { | 352 class FileSystemRequestFileSystemFunction : public UIThreadExtensionFunction { |
| 354 public: | 353 public: |
| 355 DECLARE_EXTENSION_FUNCTION("fileSystem.requestFileSystem", | 354 DECLARE_EXTENSION_FUNCTION("fileSystem.requestFileSystem", |
| 356 FILESYSTEM_REQUESTFILESYSTEM); | 355 FILESYSTEM_REQUESTFILESYSTEM); |
| 357 | 356 |
| 358 protected: | 357 protected: |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 ExtensionFunction::ResponseAction Run() override; | 412 ExtensionFunction::ResponseAction Run() override; |
| 414 | 413 |
| 415 private: | 414 private: |
| 416 ChromeExtensionFunctionDetails chrome_details_; | 415 ChromeExtensionFunctionDetails chrome_details_; |
| 417 }; | 416 }; |
| 418 #endif | 417 #endif |
| 419 | 418 |
| 420 } // namespace extensions | 419 } // namespace extensions |
| 421 | 420 |
| 422 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ | 421 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ |
| OLD | NEW |