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

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

Issue 1071773003: Remove persistent notifications from the database when they close. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-db-Integrate
Patch Set: Created 5 years, 8 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/notification_ui_manager_android.cc
diff --git a/chrome/browser/notifications/notification_ui_manager_android.cc b/chrome/browser/notifications/notification_ui_manager_android.cc
index aa5984cf9515cb91bc8f980498f6da65da1cd80b..640ffbfa8ab3ab6e84984e44c10b4625bba78061 100644
--- a/chrome/browser/notifications/notification_ui_manager_android.cc
+++ b/chrome/browser/notifications/notification_ui_manager_android.cc
@@ -95,8 +95,20 @@ bool NotificationUIManagerAndroid::OnNotificationClosed(
jlong persistent_notification_id,
jstring java_origin,
jstring java_tag) {
- // TODO(peter): Implement handling when a notification has been closed. The
- // notification database has to reflect this in its own state.
+ GURL origin(ConvertJavaStringToUTF8(env, java_origin));
+ std::string tag = ConvertJavaStringToUTF8(env, java_tag);
+
+ // The notification was closed by the platform, so clear all local state.
+ regenerated_notification_infos_.erase(persistent_notification_id);
+
+ // TODO(peter): Rather than assuming that the last used profile is the
dewittj 2015/04/10 17:18:30 can this happen sooner rather than later? Or do a
Peter Beverloo 2015/04/20 16:47:20 Chrome for Android only supports a single profile,
+ // appropriate one for this notification, the used profile should be
+ // stored as part of the notification's data. See https://crbug.com/437574.
+ PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClose(
+ ProfileManager::GetLastUsedProfile(),
+ persistent_notification_id,
+ origin);
+
return true;
}

Powered by Google App Engine
This is Rietveld 408576698