OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef EXTENSIONS_BROWSER_API_FILE_SYSTEM_SAVED_FILES_SERVICE_DELEGATE_H_ |
| 6 #define EXTENSIONS_BROWSER_API_FILE_SYSTEM_SAVED_FILES_SERVICE_DELEGATE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/files/file_path.h" |
| 11 |
| 12 namespace extensions { |
| 13 namespace file_system_api { |
| 14 |
| 15 // TODO(michaelpg): These methods are abstracted into a delegate only because |
| 16 // any real implementation will be dependent on apps::SavedFilesService, which |
| 17 // the extensions module must not depend on. Ideally, the chrome.fileSystem API |
| 18 // itself would be implemented in //apps and we wouldn't have this problem. |
| 19 class SavedFilesServiceDelegate { |
| 20 public: |
| 21 // Basic information about a registered file. |
| 22 struct File { |
| 23 std::string id; |
| 24 base::FilePath path; |
| 25 bool is_directory; |
| 26 }; |
| 27 |
| 28 virtual ~SavedFilesServiceDelegate(){}; |
| 29 |
| 30 // Returns whether the file with the given |id| has been registered. |
| 31 virtual bool IsRegistered(const std::string& extension_id, |
| 32 const std::string& id) = 0; |
| 33 |
| 34 // Registers a file with the saved files service. |
| 35 virtual void RegisterFileEntry(const std::string& extension_id, |
| 36 const File& file) = 0; |
| 37 |
| 38 // If the file is registered, populates |file| with its information and |
| 39 // returns true. |
| 40 virtual bool GetRegisteredFileInfo(const std::string& extension_id, |
| 41 const std::string& id, |
| 42 File* file) = 0; |
| 43 |
| 44 // Moves or adds |id| to the back of the queue of files to be retained. |
| 45 virtual void EnqueueFileEntry(const std::string& extension_id, |
| 46 const std::string& id) = 0; |
| 47 }; |
| 48 |
| 49 } // namespace file_system_api |
| 50 } // namespace extensions |
| 51 |
| 52 #endif // EXTENSIONS_BROWSER_API_FILE_SYSTEM_SAVED_FILES_SERVICE_DELEGATE_H_ |
OLD | NEW |