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

Unified Diff: chrome/browser/notifications/platform_notification_service_impl.cc

Issue 1619703002: Implement notificationclose event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nits Created 4 years, 11 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: 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 2bb49e3accf09a8d63279b1221ca4cb3ee6b5a12..360840444c8aef59257ed9cbd9b0bffc65b70a6c 100644
--- a/chrome/browser/notifications/platform_notification_service_impl.cc
+++ b/chrome/browser/notifications/platform_notification_service_impl.cc
@@ -69,22 +69,24 @@ 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) {
+ UMA_HISTOGRAM_ENUMERATION(
+ "Notifications.PersistentWebNotificationCloseResult", status,
+ content::PersistentNotificationStatus::
+ PERSISTENT_NOTIFICATION_STATUS_MAX);
+}
+
void CancelNotification(const std::string& id, ProfileID profile_id) {
PlatformNotificationServiceImpl::GetInstance()
->GetNotificationUIManager()->CancelById(id, profile_id);
@@ -205,11 +207,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 +224,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

Powered by Google App Engine
This is Rietveld 408576698