OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "chrome/browser/ui/views/toolbar_view.h" | 5 #include "chrome/browser/ui/views/toolbar_view.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/i18n/number_formatting.h" | 8 #include "base/i18n/number_formatting.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 | 808 |
809 void ToolbarView::UpdateWrenchButtonSeverity() { | 809 void ToolbarView::UpdateWrenchButtonSeverity() { |
810 // Keep track of whether we were showing the badge before, so we don't send | 810 // Keep track of whether we were showing the badge before, so we don't send |
811 // multiple UMA events for example when multiple Chrome windows are open. | 811 // multiple UMA events for example when multiple Chrome windows are open. |
812 static bool incompatibility_badge_showing = false; | 812 static bool incompatibility_badge_showing = false; |
813 // Save the old value before resetting it. | 813 // Save the old value before resetting it. |
814 bool was_showing = incompatibility_badge_showing; | 814 bool was_showing = incompatibility_badge_showing; |
815 incompatibility_badge_showing = false; | 815 incompatibility_badge_showing = false; |
816 | 816 |
817 if (ShouldShowUpgradeRecommended()) { | 817 if (ShouldShowUpgradeRecommended()) { |
818 app_menu_->SetSeverity(WrenchIconPainter::SeverityFromUpgradeLevel( | 818 UpgradeDetector::UpgradeNotificationAnnoyanceLevel level = |
819 UpgradeDetector::GetInstance()->upgrade_notification_stage())); | 819 UpgradeDetector::GetInstance()->upgrade_notification_stage(); |
| 820 app_menu_->SetSeverity(WrenchIconPainter::SeverityFromUpgradeLevel(level), |
| 821 WrenchIconPainter::ShouldAnimateUpgradeLevel(level)); |
820 return; | 822 return; |
821 } | 823 } |
822 | 824 |
823 if (ShouldShowIncompatibilityWarning()) { | 825 if (ShouldShowIncompatibilityWarning()) { |
824 if (!was_showing) | 826 if (!was_showing) |
825 content::RecordAction(UserMetricsAction("ConflictBadge")); | 827 content::RecordAction(UserMetricsAction("ConflictBadge")); |
826 app_menu_->SetSeverity(WrenchIconPainter::SEVERITY_HIGH); | 828 app_menu_->SetSeverity(WrenchIconPainter::SEVERITY_HIGH, true); |
827 incompatibility_badge_showing = true; | 829 incompatibility_badge_showing = true; |
828 return; | 830 return; |
829 } | 831 } |
830 | 832 |
831 GlobalErrorService* service = | 833 GlobalErrorService* service = |
832 GlobalErrorServiceFactory::GetForProfile(browser_->profile()); | 834 GlobalErrorServiceFactory::GetForProfile(browser_->profile()); |
833 GlobalError* error = | 835 GlobalError* error = |
834 service->GetHighestSeverityGlobalErrorWithWrenchMenuItem(); | 836 service->GetHighestSeverityGlobalErrorWithWrenchMenuItem(); |
835 if (error) { | 837 if (error) { |
836 app_menu_->SetSeverity(WrenchIconPainter::SeverityFromGlobalErrorSeverity( | 838 app_menu_->SetSeverity(WrenchIconPainter::SeverityFromGlobalErrorSeverity( |
837 error->GetSeverity())); | 839 error->GetSeverity()), true); |
838 return; | 840 return; |
839 } | 841 } |
840 | 842 |
841 app_menu_->SetSeverity(WrenchIconPainter::SEVERITY_NONE); | 843 app_menu_->SetSeverity(WrenchIconPainter::SEVERITY_NONE, true); |
842 } | 844 } |
843 | 845 |
844 void ToolbarView::OnShowHomeButtonChanged() { | 846 void ToolbarView::OnShowHomeButtonChanged() { |
845 Layout(); | 847 Layout(); |
846 SchedulePaint(); | 848 SchedulePaint(); |
847 } | 849 } |
848 | 850 |
849 int ToolbarView::content_shadow_height() const { | 851 int ToolbarView::content_shadow_height() const { |
850 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? | 852 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? |
851 kContentShadowHeightAsh : kContentShadowHeight; | 853 kContentShadowHeightAsh : kContentShadowHeight; |
852 } | 854 } |
OLD | NEW |