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 488006a8abd12f197404953645df20371690619e..39e679270cac5c22c050d97ce4e5a29d5cd114db 100644 |
--- a/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm |
+++ b/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm |
@@ -113,4 +113,27 @@ crashpad::SimpleStringDictionary* GetCrashpadAnnotations() { |
[transactionHandler_ closeTransactionIfNeeded]; |
} |
+- (void)getDisplayedAlertsForProfileId:(NSString*)profileId |
+ andIncognito:(BOOL)incognito |
+ 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]; |
+ BOOL incognitoNotification = [[toast.userInfo |
+ objectForKey:notification_constants::kNotificationIncognito] boolValue]; |
+ if ([candidateProfileId isEqualToString:profileId] && |
+ incognito == incognitoNotification) { |
+ [notificationIds |
+ addObject:[toast.userInfo |
+ objectForKey:notification_constants::kNotificationId]]; |
+ } |
+ } |
+ reply(notificationIds); |
+} |
+ |
@end |