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

Side by Side Diff: ui/message_center/message_center_impl.cc

Issue 2750853005: Fix crash when removing all notifications by "Clear all" button. (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « ui/arc/notification/arc_custom_notification_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 if (!notifications.empty()) { 649 if (!notifications.empty()) {
650 notification_cache_.Rebuild( 650 notification_cache_.Rebuild(
651 notification_list_->GetVisibleNotifications(blockers_)); 651 notification_list_->GetVisibleNotifications(blockers_));
652 } 652 }
653 } 653 }
654 654
655 void MessageCenterImpl::RemoveAllNotifications(bool by_user, RemoveType type) { 655 void MessageCenterImpl::RemoveAllNotifications(bool by_user, RemoveType type) {
656 bool remove_pinned = (type == RemoveType::ALL); 656 bool remove_pinned = (type == RemoveType::ALL);
657 657
658 const NotificationBlockers& blockers = 658 const NotificationBlockers& blockers =
659 (type == RemoveType::ALL ? NotificationBlockers() /* empty blockers */ 659 remove_pinned ? NotificationBlockers() /* empty blockers */
660 : blockers_ /* use default blockers */); 660 : blockers_; /* use default blockers */
661 661
662 const NotificationList::Notifications notifications = 662 const NotificationList::Notifications notifications =
663 notification_list_->GetVisibleNotifications(blockers); 663 notification_list_->GetVisibleNotifications(blockers);
664 std::set<std::string> ids; 664 std::set<std::string> ids;
665 for (auto* notification : notifications) { 665 for (auto* notification : notifications) {
666 if (!remove_pinned && notification->pinned()) 666 if (!remove_pinned && notification->pinned())
667 continue; 667 continue;
668 668
669 ids.insert(notification->id()); 669 ids.insert(notification->id());
670 scoped_refptr<NotificationDelegate> delegate = notification->delegate(); 670 scoped_refptr<NotificationDelegate> delegate = notification->delegate();
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 } 899 }
900 900
901 void MessageCenterImpl::EnableChangeQueueForTest(bool enable) { 901 void MessageCenterImpl::EnableChangeQueueForTest(bool enable) {
902 if (enable) 902 if (enable)
903 notification_queue_.reset(new internal::ChangeQueue()); 903 notification_queue_.reset(new internal::ChangeQueue());
904 else 904 else
905 notification_queue_.reset(); 905 notification_queue_.reset();
906 } 906 }
907 907
908 } // namespace message_center 908 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/arc/notification/arc_custom_notification_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698