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

Unified Diff: chrome/browser/notifications/platform_notification_service_impl.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/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..36c7cb4afc9c1903ba7c660703cdac5c8f6b007b 100644
--- a/chrome/browser/notifications/platform_notification_service_impl.cc
+++ b/chrome/browser/notifications/platform_notification_service_impl.cc
@@ -379,18 +379,23 @@ void PlatformNotificationServiceImpl::ClosePersistentNotification(
notification_id);
}
-bool PlatformNotificationServiceImpl::GetDisplayedNotifications(
+void PlatformNotificationServiceImpl::GetDisplayedNotifications(
BrowserContext* browser_context,
- std::set<std::string>* displayed_notifications) {
- DCHECK(displayed_notifications);
+ const NotificationResultCallback& 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()) {
+ std::unique_ptr<std::set<std::string>> displayedNotifications =
Peter Beverloo 2017/03/15 18:07:50 displayed_notifications or delete per the comment
Miguel Garcia 2017/03/16 14:57:42 Done.
+ base::MakeUnique<std::set<std::string>>();
+ content::BrowserThread::PostTask(
+ content::BrowserThread::UI, FROM_HERE,
+ base::Bind(callback, base::Passed(&displayedNotifications),
+ false /* supports getting displayed notifications */));
Peter Beverloo 2017/03/15 18:07:50 I'd just take the easy path here and use: callb
Miguel Garcia 2017/03/16 14:57:42 Done.
+ return;
+ }
+ GetNotificationDisplayService(profile)->GetDisplayed(callback);
}
void PlatformNotificationServiceImpl::OnClickEventDispatchComplete(

Powered by Google App Engine
This is Rietveld 408576698