| 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/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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 | 614 |
| 615 void MessageCenterView::UpdateButtonBarStatus() { | 615 void MessageCenterView::UpdateButtonBarStatus() { |
| 616 // Disables all buttons during animation of cleaning of all notifications. | 616 // Disables all buttons during animation of cleaning of all notifications. |
| 617 if (is_clearing_) { | 617 if (is_clearing_) { |
| 618 button_bar_->SetSettingsAndQuietModeButtonsEnabled(false); | 618 button_bar_->SetSettingsAndQuietModeButtonsEnabled(false); |
| 619 button_bar_->SetCloseAllButtonEnabled(false); | 619 button_bar_->SetCloseAllButtonEnabled(false); |
| 620 return; | 620 return; |
| 621 } | 621 } |
| 622 | 622 |
| 623 button_bar_->SetBackArrowVisible(mode_ == Mode::SETTINGS); | 623 button_bar_->SetBackArrowVisible(mode_ == Mode::SETTINGS); |
| 624 button_bar_->SetSettingsAndQuietModeButtonsEnabled(!is_locked_); | 624 button_bar_->SetButtonsVisible(!is_locked_); |
| 625 button_bar_->SetTitle(GetButtonBarTitle()); | 625 button_bar_->SetTitle(GetButtonBarTitle()); |
| 626 | 626 |
| 627 if (!is_locked_) |
| 628 EnableCloseAllIfAppropriate(); |
| 629 } |
| 630 |
| 631 void MessageCenterView::EnableCloseAllIfAppropriate() { |
| 627 if (mode_ == Mode::NOTIFICATIONS) { | 632 if (mode_ == Mode::NOTIFICATIONS) { |
| 628 bool no_closable_views = true; | 633 bool no_closable_views = true; |
| 629 for (const auto& view : notification_views_) { | 634 for (const auto& view : notification_views_) { |
| 630 if (!view.second->IsPinned()) { | 635 if (!view.second->IsPinned()) { |
| 631 no_closable_views = false; | 636 no_closable_views = false; |
| 632 break; | 637 break; |
| 633 } | 638 } |
| 634 } | 639 } |
| 635 button_bar_->SetCloseAllButtonEnabled(!no_closable_views); | 640 button_bar_->SetCloseAllButtonEnabled(!no_closable_views); |
| 636 } else { | 641 } else { |
| 637 // Disable the close-all button since no notification is visible. | 642 // Disable the close-all button since no notification is visible. |
| 638 button_bar_->SetCloseAllButtonEnabled(false); | 643 button_bar_->SetCloseAllButtonEnabled(false); |
| 639 } | 644 } |
| 640 } | 645 } |
| 641 | 646 |
| 642 void MessageCenterView::SetNotificationViewForTest(MessageView* view) { | 647 void MessageCenterView::SetNotificationViewForTest(MessageView* view) { |
| 643 message_list_view_->AddNotificationAt(view, 0); | 648 message_list_view_->AddNotificationAt(view, 0); |
| 644 } | 649 } |
| 645 | 650 |
| 646 } // namespace message_center | 651 } // namespace message_center |
| OLD | NEW |