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_INTERFACE_H_ |
| 6 #define EXTENSIONS_BROWSER_API_FILE_SYSTEM_SAVED_FILES_SERVICE_INTERFACE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/files/file_path.h" |
| 11 |
| 12 namespace extensions { |
| 13 |
| 14 struct SavedFileEntry; |
| 15 |
| 16 // Provides an LRU of saved file entries that persist across app reloads. |
| 17 class SavedFilesServiceInterface { |
| 18 public: |
| 19 virtual ~SavedFilesServiceInterface() {} |
| 20 |
| 21 // Registers a file entry with the saved files service, making it eligible to |
| 22 // be put into the queue. File entries that are in the retained files queue at |
| 23 // object construction are automatically registered. |
| 24 virtual void RegisterFileEntry(const std::string& extension_id, |
| 25 const std::string& id, |
| 26 const base::FilePath& file_path, |
| 27 bool is_directory) = 0; |
| 28 |
| 29 // If the file with |id| is not in the queue of files to be retained |
| 30 // permanently, adds the file to the back of the queue, evicting the least |
| 31 // recently used entry at the front of the queue if it is full. If it is |
| 32 // already present, moves it to the back of the queue. The |id| must have been |
| 33 // registered. |
| 34 virtual void EnqueueFileEntry(const std::string& extension_id, |
| 35 const std::string& id) = 0; |
| 36 |
| 37 // Returns whether the file entry with the given |id| has been registered. |
| 38 virtual bool IsRegistered(const std::string& extension_id, |
| 39 const std::string& id) = 0; |
| 40 |
| 41 // Gets a borrowed pointer to the file entry with the specified |id|. Returns |
| 42 // nullptr if the file entry has not been registered. |
| 43 virtual const SavedFileEntry* GetFileEntry(const std::string& extension_id, |
| 44 const std::string& id) = 0; |
| 45 }; |
| 46 |
| 47 } // namespace extensions |
| 48 |
| 49 #endif // EXTENSIONS_BROWSER_API_FILE_SYSTEM_SAVED_FILES_SERVICE_INTERFACE_H_ |
OLD | NEW |