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..8ca837bed111d9f6ceafeae3e813cff82b2ab757 100644 |
--- a/ui/message_center/message_center_impl.cc |
+++ b/ui/message_center/message_center_impl.cc |
@@ -643,23 +643,20 @@ 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()); |
-} |
+void MessageCenterImpl::RemoveAllNotifications(bool by_user, RemoveType type) { |
+ bool only_closable = (type == RemoveType::CLOSABLE); |
-void MessageCenterImpl::RemoveAllVisibleNotifications(bool by_user) { |
- RemoveNotifications(by_user, blockers_); |
-} |
+ const NotificationBlockers& blockers = |
+ (type == RemoveType::ALL ? NotificationBlockers() /* empty blockers */ |
+ : blockers_ /* use default blockers */); |
-void MessageCenterImpl::RemoveNotifications( |
- bool by_user, |
- 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()) |