Chromium Code Reviews| Index: content/browser/notifications/platform_notification_context.cc |
| diff --git a/content/browser/notifications/platform_notification_context.cc b/content/browser/notifications/platform_notification_context.cc |
| index 242f38994fb67fef1b2336f4297e4a83b3aa8c03..1245b61ca7d4b1d6cfa3b88c8f266e4b12b8383f 100644 |
| --- a/content/browser/notifications/platform_notification_context.cc |
| +++ b/content/browser/notifications/platform_notification_context.cc |
| @@ -114,6 +114,36 @@ void PlatformNotificationContext::DoWriteNotificationData( |
| base::Bind(callback, false /* success */, 0 /* notification_id */)); |
| } |
| +void PlatformNotificationContext::DeleteNotificationData( |
| + int64_t notification_id, |
| + const GURL& origin, |
| + const DeleteResultCallback& callback) { |
| + DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| + LazyInitialize( |
| + base::Bind(&PlatformNotificationContext::DoDeleteNotificationData, |
| + this, notification_id, origin, callback), |
| + base::Bind(callback, false /* success */)); |
| +} |
| + |
| +void PlatformNotificationContext::DoDeleteNotificationData( |
| + int64_t notification_id, |
| + const GURL& origin, |
| + const DeleteResultCallback& callback) { |
| + DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
| + |
| + NotificationDatabase::Status status = |
| + database_->DeleteNotificationData(notification_id, origin); |
| + |
| + const bool success = status == NotificationDatabase::STATUS_OK; |
|
johnme
2015/03/16 16:55:18
It doesn't seem ideal to treat STATUS_ERROR_NOT_FO
johnme
2015/03/16 16:55:18
It doesn't seem ideal to treat STATUS_ERROR_NOT_FO
Peter Beverloo
2015/03/16 18:16:51
This is not the case anymore per new semantics in
|
| + |
| + // TODO(peter): Record UMA on |status| for reading from the database. |
| + // TODO(peter): Do the DeleteAndStartOver dance for STATUS_ERROR_CORRUPTED. |
| + |
| + BrowserThread::PostTask(BrowserThread::IO, |
| + FROM_HERE, |
| + base::Bind(callback, success)); |
| +} |
| + |
| void PlatformNotificationContext::LazyInitialize( |
| const base::Closure& success_closure, |
| const base::Closure& failure_closure) { |