Index: ui/message_center/message_center_impl.cc |
diff --git a/ui/message_center/message_center_impl.cc b/ui/message_center/message_center_impl.cc |
index ada49c8abafbe5c558df1392f7540f087e8bcf6b..72eaf3b3331d4364ee7353d177745f5c133d60dd 100644 |
--- a/ui/message_center/message_center_impl.cc |
+++ b/ui/message_center/message_center_impl.cc |
@@ -646,20 +646,34 @@ void MessageCenterImpl::RemoveNotificationsForNotifierId( |
void MessageCenterImpl::RemoveAllNotifications(bool by_user) { |
// Using not |blockers_| but an empty list since it wants to remove literally |
// all notifications. |
- RemoveNotifications(by_user, NotificationBlockers()); |
+ RemoveNotifications(by_user, |
+ false /* closable only */, |
+ NotificationBlockers()); |
} |
void MessageCenterImpl::RemoveAllVisibleNotifications(bool by_user) { |
- RemoveNotifications(by_user, blockers_); |
+ RemoveNotifications(by_user, |
+ false /* closable only */, |
+ blockers_); |
+} |
+ |
+void MessageCenterImpl::RemoveAllClosableNotifications(bool by_user) { |
+ RemoveNotifications(by_user, |
+ true /* closable only */, |
+ blockers_); |
} |
void MessageCenterImpl::RemoveNotifications( |
bool by_user, |
+ bool only_closable, |
const NotificationBlockers& blockers) { |
const NotificationList::Notifications notifications = |
notification_list_->GetVisibleNotifications(blockers); |
std::set<std::string> ids; |
for (const auto& notification : notifications) { |
+ if (only_closable && !notification->closable()) |
+ continue; |
+ |
ids.insert(notification->id()); |
scoped_refptr<NotificationDelegate> delegate = notification->delegate(); |
if (delegate.get()) |