Browse Source

revert: reply notifs sometimes destroyed too early (#26084)

This reverts commit 75b9ab7050abbaef72b13a48704ae455ddd3acb1.
Samuel Attard 4 years ago
parent
commit
1d383c0613

+ 1 - 4
shell/browser/notifications/mac/notification_center_delegate.mm

@@ -42,10 +42,7 @@
     // https://developer.apple.com/documentation/foundation/nsusernotificationactivationtype?language=objc
     if (notif.activationType ==
         NSUserNotificationActivationTypeContentsClicked) {
-      // If a notification with a reply button is clicked and the user has not
-      // yet replied, we do not want to destroy the notification.
-      bool should_destroy = ![notif hasReplyButton];
-      notification->NotificationClicked(should_destroy);
+      notification->NotificationClicked();
     } else if (notif.activationType ==
                NSUserNotificationActivationTypeActionButtonClicked) {
       notification->NotificationActivated();

+ 2 - 4
shell/browser/notifications/notification.cc

@@ -21,12 +21,10 @@ Notification::~Notification() {
     delegate()->NotificationDestroyed();
 }
 
-void Notification::NotificationClicked(bool should_destroy) {
+void Notification::NotificationClicked() {
   if (delegate())
     delegate()->NotificationClick();
-
-  if (should_destroy)
-    Destroy();
+  Destroy();
 }
 
 void Notification::NotificationDismissed() {

+ 1 - 1
shell/browser/notifications/notification.h

@@ -54,7 +54,7 @@ class Notification {
   virtual void Dismiss() = 0;
 
   // Should be called by derived classes.
-  void NotificationClicked(bool should_destroy = true);
+  void NotificationClicked();
   void NotificationDismissed();
   void NotificationFailed();
 

+ 1 - 1
shell/browser/notifications/win/windows_toast_notification.cc

@@ -476,7 +476,7 @@ IFACEMETHODIMP ToastEventHandler::Invoke(
     IInspectable* args) {
   base::PostTask(
       FROM_HERE, {content::BrowserThread::UI},
-      base::BindOnce(&Notification::NotificationClicked, notification_, true));
+      base::BindOnce(&Notification::NotificationClicked, notification_));
   if (IsDebuggingNotifications())
     LOG(INFO) << "Notification clicked";