Fire a click event when a notification is clicked

This commit is contained in:
Adam Roben 2013-03-29 09:02:40 -04:00
parent c1463f9799
commit e59c549e62

View file

@ -83,6 +83,16 @@ void NotificationPresenterMac::ShowNotification(
host->DesktopNotificationPostDisplay(ID.notification_id); host->DesktopNotificationPostDisplay(ID.notification_id);
} }
- (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification {
auto ID = brightray::GetID(notification);
auto host = content::RenderViewHost::FromID(ID.render_process_id, ID.render_view_id);
if (!host)
return;
host->DesktopNotificationPostClick(ID.notification_id);
}
- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification { - (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification {
// Display notifications even if the app is active. // Display notifications even if the app is active.
return YES; return YES;