Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Unified Diff: content/browser/notifications/platform_notification_context.h

Issue 1008003003: Teach the PlatformNotificationContext how to delete notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-db-PlatformNotificationContext
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/notifications/platform_notification_context.h
diff --git a/content/browser/notifications/platform_notification_context.h b/content/browser/notifications/platform_notification_context.h
index e5a634fd4f3e0fef8d4e6e3dba1226dcb1ae4092..08e088070d47dadc4ecb45a3bde14a386caba6d5 100644
--- a/content/browser/notifications/platform_notification_context.h
+++ b/content/browser/notifications/platform_notification_context.h
@@ -43,6 +43,8 @@ class CONTENT_EXPORT PlatformNotificationContext
base::Callback<void(bool /* success */,
int64_t /* notification_id */)>;
+ using DeleteResultCallback = base::Callback<void(bool /* success */)>;
+
// Reads the data associated with |notification_id| belonging to |origin|
// from the database. |callback| will be invoked with the success status
// and a reference to the notification database data when completed.
@@ -57,6 +59,13 @@ class CONTENT_EXPORT PlatformNotificationContext
const NotificationDatabaseData& database_data,
const WriteResultCallback& callback);
+ // Deletes all data associated with |notification_id| belonging to |origin|
+ // from the database. |callback| will be invoked with the success status
+ // when the operation has completed.
+ void DeleteNotificationData(int64_t notification_id,
+ const GURL& origin,
+ const DeleteResultCallback& callback);
+
private:
friend class base::RefCountedThreadSafe<PlatformNotificationContext>;
friend class PlatformNotificationContextTest;
@@ -77,19 +86,26 @@ class CONTENT_EXPORT PlatformNotificationContext
const base::Closure& failure_closure);
// Actually reads the notification data from the database. Must only be
- // called on the |task_runner_| thread. Will post a task to |callback| on
- // the IO thread when the operation has completed.
+ // called on the |task_runner_| thread. Will post a task to the IO thread
+ // for invoking |callback| on when the operation has completed.
johnme 2015/03/16 16:55:18 Nit: While you're re-wording this, why not just "W
Peter Beverloo 2015/03/16 18:16:51 Because it won't invoke, it'll post a task to invo
johnme 2015/03/16 19:34:46 Fair. Maybe say "|callback| will be invoked on the
void DoReadNotificationData(int64_t notification_id,
const GURL& origin,
const ReadResultCallback& callback);
// Actually writes the notification database to the database. Must only be
- // called on the |task_runner_| thread. Will post a task to |callback| on
- // the IO thread when the operation has completed.
+ // called on the |task_runner_| thread. Will post a task to the IO thread
+ // for invoking |callback| on when the operation has completed.
void DoWriteNotificationData(const GURL& origin,
const NotificationDatabaseData& database_data,
const WriteResultCallback& callback);
+ // Actually deletes the notification information from the database. Must only
+ // be called on the |task_runner_| thread. Will post a task to the IO thread
+ // for invoking |callback| on when the operation has completed.
+ void DoDeleteNotificationData(int64_t notification_id,
+ const GURL& origin,
+ const DeleteResultCallback& callback);
+
// Returns the path in which the database should be initialized. May be empty.
base::FilePath GetDatabasePath() const;

Powered by Google App Engine
This is Rietveld 408576698