Chromium Code Reviews| Index: content/browser/notifications/notification_database.h |
| diff --git a/content/browser/notifications/notification_database.h b/content/browser/notifications/notification_database.h |
| index 1d9a0d7623f2d1268c51879d69590172e57ca316..d4db4dafd3422debcf84918c3c4472a46d935017 100644 |
| --- a/content/browser/notifications/notification_database.h |
| +++ b/content/browser/notifications/notification_database.h |
| @@ -6,6 +6,8 @@ |
| #define CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_DATABASE_H_ |
| #include <stdint.h> |
| +#include <set> |
| +#include <vector> |
| #include "base/files/file_path.h" |
| #include "base/sequence_checker.h" |
| @@ -67,6 +69,27 @@ class CONTENT_EXPORT NotificationDatabase { |
| const GURL& origin, |
| NotificationDatabaseData* notification_database_data) const; |
| + // Reads all notification data for all origins from the database, and appends |
| + // the data to |notification_data_vector|. Returns the status code of the |
| + // reading operation. |
| + Status ReadAllNotificationData( |
| + std::vector<NotificationDatabaseData>* notification_data_vector) const; |
| + |
| + // Reads all notification data associated with |origin| from the database, and |
| + // appends the data to |notification_data_vector|. Returns the status code of |
| + // the reading operation. |
| + Status ReadAllNotificationDataForOrigin( |
| + const GURL& origin, |
| + std::vector<NotificationDatabaseData>* notification_data_vector) const; |
| + |
| + // Reads all notification data associated to |service_worker_registration_id| |
| + // belonging to |origin| from the database, and appends the data to the |
| + // |notification_data_vector|. Returns the status code. |
| + Status ReadAllNotificationDataForServiceWorkerRegistration( |
| + const GURL& origin, |
| + int64_t service_worker_registration_id, |
| + std::vector<NotificationDatabaseData>* notification_data_vector) const; |
| + |
| // Writes the |notification_database_data| for a new notification belonging to |
| // |origin| to the database, and returns the status code of the writing |
| // operation. The id of the new notification will be set in |notification_id|. |
| @@ -81,6 +104,22 @@ class CONTENT_EXPORT NotificationDatabase { |
| // failure if the to-be-deleted notification does not exist. |
| Status DeleteNotificationData(int64_t notification_id, const GURL& origin); |
| + // Deletes all data associated with |origin| from the database, and appends |
| + // the deleted notification ids to |deleted_notification_ids|. Returns the |
| + // status code of the deletion operation. |
| + Status DeleteAllNotificationDataForOrigin( |
| + const GURL& origin, |
| + std::set<int64_t>* deleted_notification_ids); |
| + |
| + // Deletes all data associated with the |service_worker_registration_id| |
| + // belonging to |origin| from the database, and appends the deleted |
| + // notification ids to |deleted_notification_ids|. Returns the status code |
| + // of the deletion operation. |
| + Status DeleteAllNotificationDataForServiceWorkerRegistration( |
| + const GURL& origin, |
| + int64_t service_worker_registration_id, |
| + std::set<int64_t>* deleted_notification_ids); |
| + |
| // Completely destroys the contents of this database. |
| Status Destroy(); |
| @@ -100,6 +139,26 @@ class CONTENT_EXPORT NotificationDatabase { |
| // the |next_notification_id_| member. |
| Status ReadNextNotificationId(); |
| + // Reads all notification data with the given constraints. |origin| may be |
| + // empty to read all notification data from all origins. If |origin| is |
| + // set, but |service_worker_registration_id| is invalid, then all notification |
| + // data for |origin| will be read. If both are set, then all notification data |
| + // for the given |service_worker_registration_id| will be read. |
| + Status ReadAllNotificationDataInternal( |
| + const GURL& origin, |
| + int64_t service_worker_registration_id, |
| + std::vector<NotificationDatabaseData>* notification_data_vector) const; |
| + |
| + // Delets all notification data with the given constraints. |origin| must |
|
cmumford
2015/03/18 22:41:21
s/Delets/Deletes/
Peter Beverloo
2015/03/19 14:35:52
Done.
|
| + // always be set - use Destroy() when the goal is to empty the database. If |
| + // |service_worker_registration_id| is invalid, all notification data for the |
| + // |origin| will be deleted. |
| + // All deleted notification ids will be written to |deleted_notification_ids|. |
| + Status DeleteAllNotificationDataInternal( |
| + const GURL& origin, |
| + int64_t service_worker_registration_id, |
| + std::set<int64_t>* deleted_notification_ids); |
| + |
| // Returns whether the database has been opened. |
| bool IsOpen() const { return db_ != nullptr; } |