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; |
} |
void PlatformNotificationServiceImpl::OnClickEventDispatchComplete( |