Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: ui/message_center/message_center_impl.cc

Issue 1645843003: Implement Non-Closable Notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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())

Powered by Google App Engine
This is Rietveld 408576698