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

Side by Side Diff: chrome/browser/ui/views/toolbar_view.cc

Issue 14245003: Wrench Icon: Only animate low severity status once (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
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
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 WrenchIconPainter::Severity severity =
819 UpgradeDetector::GetInstance()->upgrade_notification_stage())); 819 WrenchIconPainter::SeverityFromUpgradeLevel(
820 UpgradeDetector::GetInstance()->upgrade_notification_stage());
821 bool animate = true;
822 if (severity == WrenchIconPainter::SEVERITY_LOW) {
sky 2013/04/15 13:50:28 Could we consolidate this code in WrenchIconPainte
sail 2013/04/15 15:58:49 It's difficult to do because WrenchIconPainter can
sky 2013/04/15 16:54:55 Isn't this the only place that calls into WrenchIc
sail 2013/04/15 17:00:40 Right. We would still need to plumb extra informat
sail 2013/04/15 21:38:43 Actually, moving this to a static function in Wren
823 // Only animate low severity upgrades once.
824 static bool s_should_animate = true;
825 animate = s_should_animate;
826 s_should_animate = false;
827 }
828 app_menu_->SetSeverity(severity, animate);
820 return; 829 return;
821 } 830 }
822 831
823 if (ShouldShowIncompatibilityWarning()) { 832 if (ShouldShowIncompatibilityWarning()) {
824 if (!was_showing) 833 if (!was_showing)
825 content::RecordAction(UserMetricsAction("ConflictBadge")); 834 content::RecordAction(UserMetricsAction("ConflictBadge"));
826 app_menu_->SetSeverity(WrenchIconPainter::SEVERITY_HIGH); 835 app_menu_->SetSeverity(WrenchIconPainter::SEVERITY_HIGH, true);
827 incompatibility_badge_showing = true; 836 incompatibility_badge_showing = true;
828 return; 837 return;
829 } 838 }
830 839
831 GlobalErrorService* service = 840 GlobalErrorService* service =
832 GlobalErrorServiceFactory::GetForProfile(browser_->profile()); 841 GlobalErrorServiceFactory::GetForProfile(browser_->profile());
833 GlobalError* error = 842 GlobalError* error =
834 service->GetHighestSeverityGlobalErrorWithWrenchMenuItem(); 843 service->GetHighestSeverityGlobalErrorWithWrenchMenuItem();
835 if (error) { 844 if (error) {
836 app_menu_->SetSeverity(WrenchIconPainter::SeverityFromGlobalErrorSeverity( 845 app_menu_->SetSeverity(WrenchIconPainter::SeverityFromGlobalErrorSeverity(
837 error->GetSeverity())); 846 error->GetSeverity()), true);
838 return; 847 return;
839 } 848 }
840 849
841 app_menu_->SetSeverity(WrenchIconPainter::SEVERITY_NONE); 850 app_menu_->SetSeverity(WrenchIconPainter::SEVERITY_NONE, true);
842 } 851 }
843 852
844 void ToolbarView::OnShowHomeButtonChanged() { 853 void ToolbarView::OnShowHomeButtonChanged() {
845 Layout(); 854 Layout();
846 SchedulePaint(); 855 SchedulePaint();
847 } 856 }
848 857
849 int ToolbarView::content_shadow_height() const { 858 int ToolbarView::content_shadow_height() const {
850 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? 859 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ?
851 kContentShadowHeightAsh : kContentShadowHeight; 860 kContentShadowHeightAsh : kContentShadowHeight;
852 } 861 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/wrench_icon_painter_unittest.cc ('k') | chrome/browser/ui/views/wrench_toolbar_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698