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

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: Remove unnecessary property. Created 4 years, 10 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
« no previous file with comments | « ui/message_center/message_center_impl.h ('k') | ui/message_center/message_center_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..07cbe104ca0da353108a32a70453364311efb145 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 remove_pinned = (type == RemoveType::NON_PINNED);
-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 (!remove_pinned && notification->pinned())
+ continue;
+
ids.insert(notification->id());
scoped_refptr<NotificationDelegate> delegate = notification->delegate();
if (delegate.get())
« no previous file with comments | « ui/message_center/message_center_impl.h ('k') | ui/message_center/message_center_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698