Index: content/browser/notifications/notification_database.h |
diff --git a/content/browser/notifications/notification_database.h b/content/browser/notifications/notification_database.h |
index 85b855a0bd56dd433f9d661edaa0ec22bfb24e64..6c2d87e33f7f540c8110b241dbe54e18e7533241 100644 |
--- a/content/browser/notifications/notification_database.h |
+++ b/content/browser/notifications/notification_database.h |
@@ -12,6 +12,8 @@ |
#include "base/sequence_checker.h" |
#include "content/common/content_export.h" |
+class GURL; |
+ |
namespace leveldb { |
class DB; |
class Env; |
@@ -20,6 +22,8 @@ class WriteBatch; |
namespace content { |
+struct NotificationDatabaseData; |
+ |
// Implementation of the persistent notification database. |
// |
// This class can be constructed on any thread, but method calls must only be |
@@ -32,8 +36,8 @@ class CONTENT_EXPORT NotificationDatabase { |
enum Status { |
STATUS_OK = 0, |
- // The database, or the key associated with the operation, could not be |
- // found. |
+ // The database, a notification, or a LevelDB key associated with the |
+ // operation could not be found. |
STATUS_ERROR_NOT_FOUND = 1, |
// The database, or data in the database, could not be parsed as valid data. |
@@ -56,6 +60,27 @@ class CONTENT_EXPORT NotificationDatabase { |
// stores the id in |notification_id| if the read was successful. |
Status GetNextNotificationId(int64_t* notification_id) const; |
+ // Reads the notification data for the notification identified by |
+ // |notification_id| and belonging to |origin| from the database, and stores |
+ // it in |notification_database_data|. Returns the status code. |
+ Status ReadNotificationData( |
+ int64_t notification_id, |
+ const GURL& origin, |
+ NotificationDatabaseData* notification_database_data) const; |
+ |
+ // Writes the |notification_database_data| for the notification identified by |
+ // |notification_id| and belonging to |origin| to the database, and returns |
+ // the status code of the writing operation. |
+ Status WriteNotificationData( |
+ int64_t notification_id, |
+ const GURL& origin, |
+ const NotificationDatabaseData& notification_database_data); |
+ |
+ // Deletes all data associated with the notification identified by |
+ // |notification_id| belonging to |origin| from the database. Returns the |
+ // status code of the deletion operation. |
+ Status DeleteNotificationData(int64_t notification_id, const GURL& origin); |
+ |
// Completely destroys the contents of this database. |
Status Destroy(); |
@@ -70,10 +95,6 @@ class CONTENT_EXPORT NotificationDatabase { |
STATE_DISABLED, |
}; |
- // Writes the next available notification id as a put operation to |batch|. |
- void WriteNextNotificationId(leveldb::WriteBatch* batch, |
- int64_t next_notification_id) const; |
- |
// Returns whether the database has been opened. |
bool IsOpen() const { return db_ != nullptr; } |