| 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_APP_NOTIFICATION_STORAGE_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_APP_NOTIFICATION_STORAGE_H__ |
| 6 #define CHROME_BROWSER_EXTENSIONS_APP_NOTIFICATION_STORAGE_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_APP_NOTIFICATION_STORAGE_H__ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "chrome/browser/extensions/app_notification.h" | 10 #include "chrome/browser/extensions/app_notification.h" |
| 11 | 11 |
| 12 namespace base { |
| 12 class FilePath; | 13 class FilePath; |
| 14 } |
| 13 | 15 |
| 14 namespace extensions { | 16 namespace extensions { |
| 15 | 17 |
| 16 // Represents storage for app notifications for a particular extension id. | 18 // Represents storage for app notifications for a particular extension id. |
| 17 // | 19 // |
| 18 // IMPORTANT NOTE: Instances of this class should only be used on the FILE | 20 // IMPORTANT NOTE: Instances of this class should only be used on the FILE |
| 19 // thread. | 21 // thread. |
| 20 class AppNotificationStorage { | 22 class AppNotificationStorage { |
| 21 public: | 23 public: |
| 22 // Must be called on the FILE thread. The storage will be created at |path|. | 24 // Must be called on the FILE thread. The storage will be created at |path|. |
| 23 static AppNotificationStorage* Create(const FilePath& path); | 25 static AppNotificationStorage* Create(const base::FilePath& path); |
| 24 | 26 |
| 25 virtual ~AppNotificationStorage(); | 27 virtual ~AppNotificationStorage(); |
| 26 | 28 |
| 27 // Get the set of extension id's that have entries, putting them into | 29 // Get the set of extension id's that have entries, putting them into |
| 28 // |result|. | 30 // |result|. |
| 29 virtual bool GetExtensionIds(std::set<std::string>* result) = 0; | 31 virtual bool GetExtensionIds(std::set<std::string>* result) = 0; |
| 30 | 32 |
| 31 // Gets the list of stored notifications for extension_id. On success, writes | 33 // Gets the list of stored notifications for extension_id. On success, writes |
| 32 // results into |result|. On error, returns false. | 34 // results into |result|. On error, returns false. |
| 33 virtual bool Get(const std::string& extension_id, | 35 virtual bool Get(const std::string& extension_id, |
| 34 AppNotificationList* result) = 0; | 36 AppNotificationList* result) = 0; |
| 35 | 37 |
| 36 // Writes the |list| for |extension_id| into storage. | 38 // Writes the |list| for |extension_id| into storage. |
| 37 virtual bool Set(const std::string& extension_id, | 39 virtual bool Set(const std::string& extension_id, |
| 38 const AppNotificationList& list) = 0; | 40 const AppNotificationList& list) = 0; |
| 39 | 41 |
| 40 // Deletes all data for |extension_id|. | 42 // Deletes all data for |extension_id|. |
| 41 virtual bool Delete(const std::string& extension_id) = 0; | 43 virtual bool Delete(const std::string& extension_id) = 0; |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 } // namespace extensions | 46 } // namespace extensions |
| 45 | 47 |
| 46 #endif // CHROME_BROWSER_EXTENSIONS_APP_NOTIFICATION_STORAGE_H__ | 48 #endif // CHROME_BROWSER_EXTENSIONS_APP_NOTIFICATION_STORAGE_H__ |
| OLD | NEW |