Chromium Code Reviews| Index: chrome/browser/notifications/platform_notification_service_impl.cc |
| diff --git a/chrome/browser/notifications/platform_notification_service_impl.cc b/chrome/browser/notifications/platform_notification_service_impl.cc |
| index a0b73024259df3397785b7fa8b6701e1bbda12c9..2fc750cbdaf987fae43d8f01e4736da4f9f79ea0 100644 |
| --- a/chrome/browser/notifications/platform_notification_service_impl.cc |
| +++ b/chrome/browser/notifications/platform_notification_service_impl.cc |
| @@ -69,22 +69,22 @@ namespace { |
| // permission without having an associated renderer process yet. |
| const int kInvalidRenderProcessId = -1; |
| -// Callback to provide when deleting the data associated with persistent Web |
| -// Notifications from the notification database. |
| -void OnPersistentNotificationDataDeleted(bool success) { |
| - UMA_HISTOGRAM_BOOLEAN("Notifications.PersistentNotificationDataDeleted", |
| - success); |
| -} |
| - |
| // Persistent notifications fired through the delegate do not care about the |
| // lifetime of the Service Worker responsible for executing the event. |
| -void OnEventDispatchComplete(content::PersistentNotificationStatus status) { |
| +void OnClickEventDispatchComplete( |
| + content::PersistentNotificationStatus status) { |
| UMA_HISTOGRAM_ENUMERATION( |
| "Notifications.PersistentWebNotificationClickResult", status, |
| content::PersistentNotificationStatus:: |
| PERSISTENT_NOTIFICATION_STATUS_MAX); |
| } |
| +void OnCloseEventDispatchComplete( |
| + content::PersistentNotificationStatus status) { |
| + // TODO(nsatragno): add Notifications.PersistentWebNotificationCloseResult |
| + // metric. |
|
Peter Beverloo
2016/01/27 19:03:57
We'll probably want these to be included in the fi
Nina
2016/01/28 11:59:01
Done.
|
| +} |
| + |
| void CancelNotification(const std::string& id, ProfileID profile_id) { |
| PlatformNotificationServiceImpl::GetInstance() |
| ->GetNotificationUIManager()->CancelById(id, profile_id); |
| @@ -205,11 +205,8 @@ void PlatformNotificationServiceImpl::OnPersistentNotificationClick( |
| content::NotificationEventDispatcher::GetInstance() |
| ->DispatchNotificationClickEvent( |
| - browser_context, |
| - persistent_notification_id, |
| - origin, |
| - action_index, |
| - base::Bind(&OnEventDispatchComplete)); |
| + browser_context, persistent_notification_id, origin, action_index, |
| + base::Bind(&OnClickEventDispatchComplete)); |
| } |
| void PlatformNotificationServiceImpl::OnPersistentNotificationClose( |
| @@ -225,19 +222,10 @@ void PlatformNotificationServiceImpl::OnPersistentNotificationClose( |
| content::RecordAction(base::UserMetricsAction( |
| "Notifications.Persistent.ClosedProgrammatically")); |
| } |
| - |
| - PlatformNotificationContext* context = |
| - BrowserContext::GetStoragePartitionForSite(browser_context, origin) |
| - ->GetPlatformNotificationContext(); |
| - |
| - BrowserThread::PostTask( |
| - BrowserThread::IO, |
| - FROM_HERE, |
| - base::Bind(&PlatformNotificationContext::DeleteNotificationData, |
| - context, |
| - persistent_notification_id, |
| - origin, |
| - base::Bind(&OnPersistentNotificationDataDeleted))); |
| + content::NotificationEventDispatcher::GetInstance() |
| + ->DispatchNotificationCloseEvent( |
| + browser_context, persistent_notification_id, origin, by_user, |
| + base::Bind(&OnCloseEventDispatchComplete)); |
| } |
| blink::WebNotificationPermission |