| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/message_center/message_center_impl.h" | 5 #include "ui/message_center/message_center_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 notification_list_->GetNotificationsByNotifierId(notifier_id); | 643 notification_list_->GetNotificationsByNotifierId(notifier_id); |
| 644 for (auto* notification : notifications) | 644 for (auto* notification : notifications) |
| 645 RemoveNotification(notification->id(), false); | 645 RemoveNotification(notification->id(), false); |
| 646 if (!notifications.empty()) { | 646 if (!notifications.empty()) { |
| 647 notification_cache_.Rebuild( | 647 notification_cache_.Rebuild( |
| 648 notification_list_->GetVisibleNotifications(blockers_)); | 648 notification_list_->GetVisibleNotifications(blockers_)); |
| 649 } | 649 } |
| 650 } | 650 } |
| 651 | 651 |
| 652 void MessageCenterImpl::RemoveAllNotifications(bool by_user, RemoveType type) { | 652 void MessageCenterImpl::RemoveAllNotifications(bool by_user, RemoveType type) { |
| 653 bool remove_pinned = (type == RemoveType::NON_PINNED); | 653 bool remove_pinned = (type == RemoveType::ALL); |
| 654 | 654 |
| 655 const NotificationBlockers& blockers = | 655 const NotificationBlockers& blockers = |
| 656 (type == RemoveType::ALL ? NotificationBlockers() /* empty blockers */ | 656 (type == RemoveType::ALL ? NotificationBlockers() /* empty blockers */ |
| 657 : blockers_ /* use default blockers */); | 657 : blockers_ /* use default blockers */); |
| 658 | 658 |
| 659 const NotificationList::Notifications notifications = | 659 const NotificationList::Notifications notifications = |
| 660 notification_list_->GetVisibleNotifications(blockers); | 660 notification_list_->GetVisibleNotifications(blockers); |
| 661 std::set<std::string> ids; | 661 std::set<std::string> ids; |
| 662 for (auto* notification : notifications) { | 662 for (auto* notification : notifications) { |
| 663 if (!remove_pinned && notification->pinned()) | 663 if (!remove_pinned && notification->pinned()) |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 } | 901 } |
| 902 | 902 |
| 903 void MessageCenterImpl::EnableChangeQueueForTest(bool enable) { | 903 void MessageCenterImpl::EnableChangeQueueForTest(bool enable) { |
| 904 if (enable) | 904 if (enable) |
| 905 notification_queue_.reset(new internal::ChangeQueue()); | 905 notification_queue_.reset(new internal::ChangeQueue()); |
| 906 else | 906 else |
| 907 notification_queue_.reset(); | 907 notification_queue_.reset(); |
| 908 } | 908 } |
| 909 | 909 |
| 910 } // namespace message_center | 910 } // namespace message_center |
| OLD | NEW |