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

Side by Side Diff: chrome/browser/ui/toolbar/app_menu_icon_controller.cc

Issue 2789203003: [Views] App Menu Animated Icon (Closed)
Patch Set: Cleaned up Created 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/toolbar/app_menu_icon_controller.h" 5 #include "chrome/browser/ui/toolbar/app_menu_icon_controller.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/ui/global_error/global_error_service.h" 10 #include "chrome/browser/ui/global_error/global_error_service.h"
(...skipping 22 matching lines...) Expand all
33 case UpgradeDetector::UPGRADE_ANNOYANCE_CRITICAL: 33 case UpgradeDetector::UPGRADE_ANNOYANCE_CRITICAL:
34 return AppMenuIconController::Severity::HIGH; 34 return AppMenuIconController::Severity::HIGH;
35 } 35 }
36 NOTREACHED(); 36 NOTREACHED();
37 return AppMenuIconController::Severity::NONE; 37 return AppMenuIconController::Severity::NONE;
38 } 38 }
39 39
40 // Checks if the app menu icon should be animated for the given upgrade level. 40 // Checks if the app menu icon should be animated for the given upgrade level.
41 bool ShouldAnimateUpgradeLevel( 41 bool ShouldAnimateUpgradeLevel(
42 UpgradeDetector::UpgradeNotificationAnnoyanceLevel level) { 42 UpgradeDetector::UpgradeNotificationAnnoyanceLevel level) {
43 bool should_animate = true; 43 return level != UpgradeDetector::UPGRADE_ANNOYANCE_NONE;
44 if (level == UpgradeDetector::UPGRADE_ANNOYANCE_LOW) {
45 // Only animate low severity upgrades once.
46 static bool should_animate_low_severity = true;
47 should_animate = should_animate_low_severity;
48 should_animate_low_severity = false;
49 }
50 return should_animate;
51 } 44 }
52 45
53 // Returns true if we should show the upgrade recommended icon. 46 // Returns true if we should show the upgrade recommended icon.
54 bool ShouldShowUpgradeRecommended() { 47 bool ShouldShowUpgradeRecommended() {
55 #if defined(OS_CHROMEOS) 48 #if defined(OS_CHROMEOS)
56 // In chromeos, the update recommendation is shown in the system tray. So it 49 // In chromeos, the update recommendation is shown in the system tray. So it
57 // should not be displayed in the app menu. 50 // should not be displayed in the app menu.
58 return false; 51 return false;
59 #else 52 #else
60 return UpgradeDetector::GetInstance()->notify_upgrade(); 53 return UpgradeDetector::GetInstance()->notify_upgrade();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 107
115 if (GlobalErrorServiceFactory::GetForProfile(profile_) 108 if (GlobalErrorServiceFactory::GetForProfile(profile_)
116 ->GetHighestSeverityGlobalErrorWithAppMenuItem()) { 109 ->GetHighestSeverityGlobalErrorWithAppMenuItem()) {
117 // If you change the severity here, make sure to also change the menu icon 110 // If you change the severity here, make sure to also change the menu icon
118 // and the bubble icon. 111 // and the bubble icon.
119 delegate_->UpdateSeverity(IconType::GLOBAL_ERROR, 112 delegate_->UpdateSeverity(IconType::GLOBAL_ERROR,
120 Severity::MEDIUM, true); 113 Severity::MEDIUM, true);
121 return; 114 return;
122 } 115 }
123 116
124 delegate_->UpdateSeverity(IconType::NONE, 117 delegate_->UpdateSeverity(IconType::NONE, Severity::NONE, false);
msw 2017/04/11 17:34:13 Why change |animate| true->false here?
spqchan 2017/04/12 19:42:09 The |animate| param was actually dead code before
125 Severity::NONE, true);
126 } 118 }
127 119
128 #if defined(OS_WIN) 120 #if defined(OS_WIN)
129 void AppMenuIconController::OnScanCompleted() { 121 void AppMenuIconController::OnScanCompleted() {
130 UpdateDelegate(); 122 UpdateDelegate();
131 } 123 }
132 124
133 void AppMenuIconController::OnConflictsAcknowledged() { 125 void AppMenuIconController::OnConflictsAcknowledged() {
134 UpdateDelegate(); 126 UpdateDelegate();
135 } 127 }
136 #endif 128 #endif
137 129
138 void AppMenuIconController::Observe( 130 void AppMenuIconController::Observe(
139 int type, 131 int type,
140 const content::NotificationSource& source, 132 const content::NotificationSource& source,
141 const content::NotificationDetails& details) { 133 const content::NotificationDetails& details) {
142 UpdateDelegate(); 134 UpdateDelegate();
143 } 135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698