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

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

Issue 2749453002: Make GetDisplayedNotifications asynchronous. (Closed)
Patch Set: review 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/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 6c70a2ced43d75a2728f84068b6f68685dfc4d7c..c33074c8a9f3c2c316074dc6efb1dd41b99b1112 100644
--- a/chrome/browser/notifications/platform_notification_service_impl.cc
+++ b/chrome/browser/notifications/platform_notification_service_impl.cc
@@ -379,18 +379,20 @@ void PlatformNotificationServiceImpl::ClosePersistentNotification(
notification_id);
}
-bool PlatformNotificationServiceImpl::GetDisplayedNotifications(
+void PlatformNotificationServiceImpl::GetDisplayedNotifications(
BrowserContext* browser_context,
- std::set<std::string>* displayed_notifications) {
- DCHECK(displayed_notifications);
+ const DisplayedNotificationsCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
Profile* profile = Profile::FromBrowserContext(browser_context);
- if (!profile || profile->AsTestingProfile())
- return false; // Tests will not have a message center.
-
- return GetNotificationDisplayService(profile)->GetDisplayed(
- displayed_notifications);
+ // Tests will not have a message center.
+ if (!profile || profile->AsTestingProfile()) {
+ auto displayed_notifications = base::MakeUnique<std::set<std::string>>();
+ callback.Run(std::move(displayed_notifications),
+ false /* supports_synchronization */);
+ return;
+ }
+ GetNotificationDisplayService(profile)->GetDisplayed(callback);
}
void PlatformNotificationServiceImpl::OnClickEventDispatchComplete(

Powered by Google App Engine
This is Rietveld 408576698