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

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

Issue 2749453002: Make GetDisplayedNotifications asynchronous. (Closed)
Patch Set: revert early bailout if there is no service Created 3 years, 9 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/message_center_display_service.cc
diff --git a/chrome/browser/notifications/message_center_display_service.cc b/chrome/browser/notifications/message_center_display_service.cc
index 4ff6195539679db6630ccdf322ab00255048b322..4e7dfd9e9ce147e59cf9b49ab48a2a7b3096a097 100644
--- a/chrome/browser/notifications/message_center_display_service.cc
+++ b/chrome/browser/notifications/message_center_display_service.cc
@@ -7,6 +7,7 @@
#include "chrome/browser/notifications/notification.h"
#include "chrome/browser/notifications/notification_ui_manager.h"
#include "chrome/browser/profiles/profile.h"
+#include "content/public/browser/browser_thread.h"
MessageCenterDisplayService::MessageCenterDisplayService(
Profile* profile,
@@ -32,12 +33,15 @@ void MessageCenterDisplayService::Close(
NotificationUIManager::GetProfileID(profile_));
}
-bool MessageCenterDisplayService::GetDisplayed(
- std::set<std::string>* notifications) const {
- DCHECK(notifications);
+void MessageCenterDisplayService::GetDisplayed(
+ const DisplayedNotificationsCallback& callback) const {
+ auto displayed_notifications = base::MakeUnique<std::set<std::string>>();
for (auto notification_id : ui_manager_->GetAllIdsByProfile(
NotificationUIManager::GetProfileID(profile_))) {
- notifications->insert(notification_id);
+ displayed_notifications->insert(notification_id);
}
Peter Beverloo 2017/03/17 15:46:04 Sorry that I missed this before -- GetAllIdsByProf
Miguel Garcia 2017/03/20 14:11:20 Done.
- return true;
+ content::BrowserThread::PostTask(
+ content::BrowserThread::UI, FROM_HERE,
+ base::Bind(callback, base::Passed(&displayed_notifications),
+ true /* supports sync */));
}

Powered by Google App Engine
This is Rietveld 408576698