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

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

Issue 2534443002: Use notification display service to collect persistent notifications. (Closed)
Patch Set: revert unit test Created 4 years 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 2f79b35ba28726a7a4df6c89f2a6657713a91913..1562b95f04994f887cb3c79e52a6bbfcad2fed0c 100644
--- a/chrome/browser/notifications/platform_notification_service_impl.cc
+++ b/chrome/browser/notifications/platform_notification_service_impl.cc
@@ -31,6 +31,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/desktop_notification_delegate.h"
#include "content/public/browser/notification_event_dispatcher.h"
+#include "content/public/browser/notification_id_verifier.h"
#include "content/public/browser/permission_type.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/common/notification_resources.h"
@@ -370,9 +371,20 @@ bool PlatformNotificationServiceImpl::GetDisplayedPersistentNotifications(
if (!profile || profile->AsTestingProfile())
return false; // Tests will not have a message center.
- // TODO(peter): Filter for persistent notifications only.
- return GetNotificationDisplayService(profile)->GetDisplayed(
- displayed_notifications);
+ // Filter out non persistent notifications.
+ if (GetNotificationDisplayService(profile)->GetDisplayed(
+ displayed_notifications)) {
+ for (auto it = displayed_notifications->begin();
+ it != displayed_notifications->end();) {
+ if (content::NotificationIdVerifier::IsNonPersistentNotification(*it)) {
+ it = displayed_notifications->erase(it);
+ } else {
+ ++it;
+ }
+ }
+ return true;
+ }
+ return false;
Peter Beverloo 2016/12/02 13:43:34 I think we should dismiss the previous TODO and ju
Miguel Garcia 2016/12/06 12:01:18 That's a good plan, I renamed the method in the pr
}
void PlatformNotificationServiceImpl::OnClickEventDispatchComplete(

Powered by Google App Engine
This is Rietveld 408576698