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

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

Issue 2371693002: Not remove a pinned notification by user action (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | 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 <utility> 9 #include <utility>
10 10
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 if (notification_queue_ && !by_user && visible_) { 609 if (notification_queue_ && !by_user && visible_) {
610 notification_queue_->EraseNotification(id, by_user); 610 notification_queue_->EraseNotification(id, by_user);
611 return; 611 return;
612 } 612 }
613 613
614 RemoveNotificationImmediately(id, by_user); 614 RemoveNotificationImmediately(id, by_user);
615 } 615 }
616 616
617 void MessageCenterImpl::RemoveNotificationImmediately( 617 void MessageCenterImpl::RemoveNotificationImmediately(
618 const std::string& id, bool by_user) { 618 const std::string& id, bool by_user) {
619 if (FindVisibleNotificationById(id) == NULL) 619 message_center::Notification* notification = FindVisibleNotificationById(id);
xiyuan 2016/09/28 19:27:40 nit: "message_center::" is not necessary.
yoshiki 2016/09/30 04:56:10 Done.
620 if (notification == NULL)
621 return;
622
623 if (by_user && notification->pinned())
620 return; 624 return;
621 625
622 // In many cases |id| is a reference to an existing notification instance 626 // In many cases |id| is a reference to an existing notification instance
623 // but the instance can be destructed in this method. Hence copies the id 627 // but the instance can be destructed in this method. Hence copies the id
624 // explicitly here. 628 // explicitly here.
625 std::string copied_id(id); 629 std::string copied_id(id);
626 630
627 scoped_refptr<NotificationDelegate> delegate = 631 scoped_refptr<NotificationDelegate> delegate =
628 notification_list_->GetNotificationDelegate(copied_id); 632 notification_list_->GetNotificationDelegate(copied_id);
629 if (delegate.get()) 633 if (delegate.get())
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 } 905 }
902 906
903 void MessageCenterImpl::EnableChangeQueueForTest(bool enable) { 907 void MessageCenterImpl::EnableChangeQueueForTest(bool enable) {
904 if (enable) 908 if (enable)
905 notification_queue_.reset(new internal::ChangeQueue()); 909 notification_queue_.reset(new internal::ChangeQueue());
906 else 910 else
907 notification_queue_.reset(); 911 notification_queue_.reset();
908 } 912 }
909 913
910 } // namespace message_center 914 } // namespace message_center
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698