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

Unified Diff: chrome/browser/notifications/notification_platform_bridge_mac.mm

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/notification_platform_bridge_mac.mm
diff --git a/chrome/browser/notifications/notification_platform_bridge_mac.mm b/chrome/browser/notifications/notification_platform_bridge_mac.mm
index 29277e13da0fd4a6712a8d6530ad8a0a15d2c625..60d4861accd0956156b45b4fef17304e0760dd15 100644
--- a/chrome/browser/notifications/notification_platform_bridge_mac.mm
+++ b/chrome/browser/notifications/notification_platform_bridge_mac.mm
@@ -273,23 +273,26 @@ void NotificationPlatformBridgeMac::Close(const std::string& profile_id,
#endif // ENABLE_XPC_NOTIFICATIONS
}
-bool NotificationPlatformBridgeMac::GetDisplayed(
+void NotificationPlatformBridgeMac::GetDisplayed(
const std::string& profile_id,
bool incognito,
- std::set<std::string>* notifications) const {
- DCHECK(notifications);
-
+ const NotificationResultCallback& callback) const {
+ std::unique_ptr<std::set<std::string>> displayed_notifications =
+ base::MakeUnique<std::set<std::string>>();
NSString* current_profile_id = base::SysUTF8ToNSString(profile_id);
for (NSUserNotification* toast in
[notification_center_ deliveredNotifications]) {
NSString* toast_profile_id = [toast.userInfo
objectForKey:notification_constants::kNotificationProfileId];
if ([toast_profile_id isEqualToString:current_profile_id]) {
- notifications->insert(base::SysNSStringToUTF8([toast.userInfo
+ displayed_notifications->insert(base::SysNSStringToUTF8([toast.userInfo
objectForKey:notification_constants::kNotificationId]));
}
}
- return true;
+ content::BrowserThread::PostTask(
+ content::BrowserThread::UI, FROM_HERE,
+ base::Bind(callback, base::Passed(&displayed_notifications),
+ true /* supports sync */));
}
// static

Powered by Google App Engine
This is Rietveld 408576698