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

Side by Side Diff: ui/message_center/views/message_center_view.cc

Issue 2853783004: Retrieve pinned flag directly from Notification class (Closed)
Patch Set: Created 3 years, 7 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
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/views/message_center_view.h" 5 #include "ui/message_center/views/message_center_view.h"
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 button_bar_->SetTitle(GetButtonBarTitle()); 636 button_bar_->SetTitle(GetButtonBarTitle());
637 637
638 if (!is_locked_) 638 if (!is_locked_)
639 EnableCloseAllIfAppropriate(); 639 EnableCloseAllIfAppropriate();
640 } 640 }
641 641
642 void MessageCenterView::EnableCloseAllIfAppropriate() { 642 void MessageCenterView::EnableCloseAllIfAppropriate() {
643 if (mode_ == Mode::NOTIFICATIONS) { 643 if (mode_ == Mode::NOTIFICATIONS) {
644 bool no_closable_views = true; 644 bool no_closable_views = true;
645 for (const auto& view : notification_views_) { 645 for (const auto& view : notification_views_) {
646 if (!view.second->IsPinned()) { 646 if (!view.second->pinned()) {
647 no_closable_views = false; 647 no_closable_views = false;
648 break; 648 break;
649 } 649 }
650 } 650 }
651 button_bar_->SetCloseAllButtonEnabled(!no_closable_views); 651 button_bar_->SetCloseAllButtonEnabled(!no_closable_views);
652 } else { 652 } else {
653 // Disable the close-all button since no notification is visible. 653 // Disable the close-all button since no notification is visible.
654 button_bar_->SetCloseAllButtonEnabled(false); 654 button_bar_->SetCloseAllButtonEnabled(false);
655 } 655 }
656 } 656 }
(...skipping 12 matching lines...) Expand all
669 // TODO(dimich): add MessageCenter::GetVisibleNotificationById(id) 669 // TODO(dimich): add MessageCenter::GetVisibleNotificationById(id)
670 MessageView* view = view_iter->second; 670 MessageView* view = view_iter->second;
671 const NotificationList::Notifications& notifications = 671 const NotificationList::Notifications& notifications =
672 message_center_->GetVisibleNotifications(); 672 message_center_->GetVisibleNotifications();
673 for (NotificationList::Notifications::const_iterator iter = 673 for (NotificationList::Notifications::const_iterator iter =
674 notifications.begin(); 674 notifications.begin();
675 iter != notifications.end(); ++iter) { 675 iter != notifications.end(); ++iter) {
676 if ((*iter)->id() == id) { 676 if ((*iter)->id() == id) {
677 int old_width = view->width(); 677 int old_width = view->width();
678 int old_height = view->height(); 678 int old_height = view->height();
679 bool old_pinned = view->IsPinned(); 679 bool old_pinned = view->pinned();
680 message_list_view_->UpdateNotification(view, **iter); 680 message_list_view_->UpdateNotification(view, **iter);
681 if (view->GetHeightForWidth(old_width) != old_height) { 681 if (view->GetHeightForWidth(old_width) != old_height) {
682 Update(true /* animate */); 682 Update(true /* animate */);
683 } else if (view->IsPinned() != old_pinned) { 683 } else if (view->pinned() != old_pinned) {
684 // Animate flag is false, since the pinned flag transition doesn't need 684 // Animate flag is false, since the pinned flag transition doesn't need
685 // animation. 685 // animation.
686 Update(false /* animate */); 686 Update(false /* animate */);
687 } 687 }
688 break; 688 break;
689 } 689 }
690 } 690 }
691 691
692 // Notify accessibility that the contents have changed. 692 // Notify accessibility that the contents have changed.
693 view->NotifyAccessibilityEvent(ui::AX_EVENT_CHILDREN_CHANGED, false); 693 view->NotifyAccessibilityEvent(ui::AX_EVENT_CHILDREN_CHANGED, false);
694 } 694 }
695 695
696 } // namespace message_center 696 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/views/custom_notification_view_unittest.cc ('k') | ui/message_center/views/message_list_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698