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 522d42a935ba63e658ac3f69f2299258903fec4f..466bd1ab83e041551083da4fe493809d42668a6a 100644 |
--- a/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm |
+++ b/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm |
@@ -6,6 +6,7 @@ |
#import "base/mac/scoped_nsobject.h" |
#import "chrome/browser/ui/cocoa/notifications/notification_builder_mac.h" |
+#include "chrome/browser/ui/cocoa/notifications/notification_constants_mac.h" |
@class NSUserNotificationCenter; |
@@ -21,4 +22,28 @@ |
deliverNotification:toast]; |
} |
+- (void)closeNotification:(NSString*)notificationId |
+ withProfile:(NSString*)profileId { |
+ NSUserNotificationCenter* notificationCenter = |
+ [NSUserNotificationCenter defaultUserNotificationCenter]; |
+ for (NSUserNotification* candidate in |
+ [notificationCenter deliveredNotifications]) { |
+ NSString* candidateId = [candidate.userInfo |
+ objectForKey:notification_constants::kNotificationId]; |
+ |
+ NSString* candidateProfileId = [candidate.userInfo |
+ objectForKey:notification_constants::kNotificationProfileId]; |
+ |
+ if ([candidateId isEqualToString:notificationId] && |
+ [profileId isEqualToString:candidateProfileId]) { |
+ [notificationCenter removeDeliveredNotification:candidate]; |
+ } |
+ } |
+} |
+ |
+- (void)closeAllNotifications { |
+ [[NSUserNotificationCenter defaultUserNotificationCenter] |
+ removeAllDeliveredNotifications]; |
+} |
+ |
@end |