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

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

Issue 2749453002: Make GetDisplayedNotifications asynchronous. (Closed)
Patch Set: - 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..76bb5a0e12eb40ede3eab042dda4c78aa4649afe 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,16 @@ void MessageCenterDisplayService::Close(
NotificationUIManager::GetProfileID(profile_));
}
-bool MessageCenterDisplayService::GetDisplayed(
- std::set<std::string>* notifications) const {
- DCHECK(notifications);
+void MessageCenterDisplayService::GetDisplayed(
+ const NotificationResultCallback& callback) const {
+ std::unique_ptr<std::set<std::string>> displayed_notifications =
+ base::MakeUnique<std::set<std::string>>();
Peter Beverloo 2017/03/15 18:07:50 note: I think `auto` is a reasonable thing for thi
Miguel Garcia 2017/03/16 14:57:42 Done.
for (auto notification_id : ui_manager_->GetAllIdsByProfile(
NotificationUIManager::GetProfileID(profile_))) {
- notifications->insert(notification_id);
+ displayed_notifications->insert(notification_id);
}
- 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