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 3cc13058b69224b052a853d9f67f8f80d53f12de..6b3c20dc60e789395257adb0ddd1f115608ac000 100644 |
--- a/chrome/browser/notifications/notification_platform_bridge_mac.mm |
+++ b/chrome/browser/notifications/notification_platform_bridge_mac.mm |
@@ -48,7 +48,6 @@ |
// Site settings button is implemented as NSUserNotification's action button |
// Not easy to implement: |
// -notification.requireInteraction |
-// -The event associated to the close button |
// TODO(miguelg) implement the following features |
// - Sound names can be implemented by setting soundName in NSUserNotification |
@@ -88,6 +87,7 @@ |
const std::string& notification_id, |
int32_t button_index) { |
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
+ |
ProfileManager* profileManager = g_browser_process->profile_manager(); |
DCHECK(profileManager); |
@@ -378,6 +378,20 @@ |
notificationResponse); |
} |
+// Overriden from _NSUserNotificationCenterDelegatePrivate. |
+// Emitted when a user clicks the "Close" button in the notification. |
+// It not is emitted if the notification is closed from the notification |
+// center or if the app is not running at the time the Close button is |
+// pressed so it's essentially just a best effort way to detect |
+// notifications closed by the user. |
+- (void)userNotificationCenter:(NSUserNotificationCenter*)center |
+ didDismissAlert:(NSUserNotification*)notification { |
+ NSDictionary* notificationResponse = |
+ [NotificationResponseBuilder buildDictionary:notification]; |
+ NotificationPlatformBridgeMac::ProcessNotificationResponse( |
+ notificationResponse); |
+} |
+ |
- (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center |
shouldPresentNotification:(NSUserNotification*)nsNotification { |
// Always display notifications, regardless of whether the app is foreground. |