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 4edd70ba27455560e8dd8e587cb83eec00304c9f..0391ea92be4c05c1a8e07bc2dbad5a6973719e9d 100644 |
--- a/chrome/browser/notifications/platform_notification_service_impl.cc |
+++ b/chrome/browser/notifications/platform_notification_service_impl.cc |
@@ -67,22 +67,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. |
+} |
+ |
void CancelNotification(const std::string& id, ProfileID profile_id) { |
PlatformNotificationServiceImpl::GetInstance() |
->GetNotificationUIManager()->CancelById(id, profile_id); |
@@ -203,11 +203,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( |
@@ -219,23 +216,15 @@ void PlatformNotificationServiceImpl::OnPersistentNotificationClose( |
if (by_user) { |
content::RecordAction(base::UserMetricsAction( |
"Notifications.Persistent.ClosedByUser")); |
+ |
+ content::NotificationEventDispatcher::GetInstance() |
+ ->DispatchNotificationCloseEvent( |
+ browser_context, persistent_notification_id, origin, |
+ base::Bind(&OnCloseEventDispatchComplete)); |
} else { |
content::RecordAction(base::UserMetricsAction( |
Peter Beverloo
2016/01/26 16:13:45
Even when a notification was clicked by the user,
Nina
2016/01/27 18:48:58
Good catch - I think this became an issue when I m
|
"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))); |
} |
blink::WebNotificationPermission |