| Index: content/browser/notifications/platform_notification_context_impl.cc
|
| diff --git a/content/browser/notifications/platform_notification_context_impl.cc b/content/browser/notifications/platform_notification_context_impl.cc
|
| index fa5c1387e1ccacdb81ebfc43ce707dca5e069afe..775bc9b8f94e610afa34e423280def1190362b70 100644
|
| --- a/content/browser/notifications/platform_notification_context_impl.cc
|
| +++ b/content/browser/notifications/platform_notification_context_impl.cc
|
| @@ -202,6 +202,17 @@ void PlatformNotificationContextImpl::
|
| const ReadAllResultCallback& callback) {
|
| DCHECK(task_runner_->RunsTasksOnCurrentThread());
|
|
|
| + PlatformNotificationService* service =
|
| + GetContentClient()->browser()->GetPlatformNotificationService();
|
| +
|
| + // Ask the underlying implementation what notifications are still being
|
| + // displayed.
|
| + std::set<std::string> displayed_notifications;
|
| + bool notification_synchronization_supported =
|
| + service &&
|
| + service->GetDisplayedPersistentNotifications(browser_context_,
|
| + &displayed_notifications);
|
| +
|
| std::vector<NotificationDatabaseData> notification_datas;
|
|
|
| NotificationDatabase::Status status =
|
| @@ -212,6 +223,17 @@ void PlatformNotificationContextImpl::
|
| status, NotificationDatabase::STATUS_COUNT);
|
|
|
| if (status == NotificationDatabase::STATUS_OK) {
|
| + if (notification_synchronization_supported) {
|
| + // Filter out notifications that are not actually on display anymore.
|
| + for (auto it = notification_datas.begin();
|
| + it != notification_datas.end();) {
|
| + if (displayed_notifications.count(it->notification_id))
|
| + ++it;
|
| + else
|
| + it = notification_datas.erase(it);
|
| + }
|
| + }
|
| +
|
| BrowserThread::PostTask(
|
| BrowserThread::IO, FROM_HERE,
|
| base::Bind(callback, true /* success */, notification_datas));
|
|
|