Index: chrome/browser/ui/cocoa/notifications/alert_notification_service.mm |
diff --git a/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm b/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm |
index 528e198b6fad9f6c0d3a80010173a5109f479bd5..c9f7c3f67b798bab6749c7f2c81b596dee2fa05d 100644 |
--- a/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm |
+++ b/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm |
@@ -83,4 +83,23 @@ |
[transactionHandler_ closeTransactionIfNeeded]; |
} |
+- (void)getDisplayedAlertsForProfileId:(NSString*)profileId |
+ withReply:(void (^)(NSArray*))reply { |
+ NSUserNotificationCenter* notificationCenter = |
+ [NSUserNotificationCenter defaultUserNotificationCenter]; |
+ NSMutableArray* notificationIds = [NSMutableArray |
+ arrayWithCapacity:[[notificationCenter deliveredNotifications] count]]; |
+ for (NSUserNotification* toast in |
+ [notificationCenter deliveredNotifications]) { |
+ NSString* candidateProfileId = [toast.userInfo |
+ objectForKey:notification_constants::kNotificationProfileId]; |
+ if ([candidateProfileId isEqualToString:profileId]) { |
+ [notificationIds |
+ addObject:[toast.userInfo |
+ objectForKey:notification_constants::kNotificationId]]; |
+ } |
+ } |
+ reply(notificationIds); |
+} |
+ |
@end |