OLD | NEW |
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_badge_controller.h" | 5 #include "chrome/browser/ui/toolbar/app_menu_badge_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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 #endif | 97 #endif |
98 } | 98 } |
99 | 99 |
100 AppMenuBadgeController::~AppMenuBadgeController() { | 100 AppMenuBadgeController::~AppMenuBadgeController() { |
101 } | 101 } |
102 | 102 |
103 void AppMenuBadgeController::UpdateDelegate() { | 103 void AppMenuBadgeController::UpdateDelegate() { |
104 if (ShouldShowUpgradeRecommended()) { | 104 if (ShouldShowUpgradeRecommended()) { |
105 UpgradeDetector::UpgradeNotificationAnnoyanceLevel level = | 105 UpgradeDetector::UpgradeNotificationAnnoyanceLevel level = |
106 UpgradeDetector::GetInstance()->upgrade_notification_stage(); | 106 UpgradeDetector::GetInstance()->upgrade_notification_stage(); |
107 delegate_->UpdateBadgeSeverity(BADGE_TYPE_UPGRADE_NOTIFICATION, | 107 delegate_->UpdateBadgeSeverity(BadgeType::UPGRADE_NOTIFICATION, |
108 SeverityFromUpgradeLevel(level), | 108 SeverityFromUpgradeLevel(level), |
109 ShouldAnimateUpgradeLevel(level)); | 109 ShouldAnimateUpgradeLevel(level)); |
110 return; | 110 return; |
111 } | 111 } |
112 | 112 |
113 if (ShouldShowIncompatibilityWarning()) { | 113 if (ShouldShowIncompatibilityWarning()) { |
114 delegate_->UpdateBadgeSeverity(BADGE_TYPE_INCOMPATIBILITY_WARNING, | 114 delegate_->UpdateBadgeSeverity(BadgeType::INCOMPATIBILITY_WARNING, |
115 AppMenuIconPainter::SEVERITY_MEDIUM, true); | 115 AppMenuIconPainter::SEVERITY_MEDIUM, true); |
116 return; | 116 return; |
117 } | 117 } |
118 | 118 |
119 if (GlobalErrorServiceFactory::GetForProfile(profile_)-> | 119 if (GlobalErrorServiceFactory::GetForProfile(profile_)-> |
120 GetHighestSeverityGlobalErrorWithAppMenuItem()) { | 120 GetHighestSeverityGlobalErrorWithAppMenuItem()) { |
121 // If you change the severity here, make sure to also change the menu icon | 121 // If you change the severity here, make sure to also change the menu icon |
122 // and the bubble icon. | 122 // and the bubble icon. |
123 delegate_->UpdateBadgeSeverity(BADGE_TYPE_GLOBAL_ERROR, | 123 delegate_->UpdateBadgeSeverity(BadgeType::GLOBAL_ERROR, |
124 AppMenuIconPainter::SEVERITY_MEDIUM, true); | 124 AppMenuIconPainter::SEVERITY_MEDIUM, true); |
125 return; | 125 return; |
126 } | 126 } |
127 | 127 |
128 delegate_->UpdateBadgeSeverity(BADGE_TYPE_NONE, | 128 delegate_->UpdateBadgeSeverity(BadgeType::NONE, |
129 AppMenuIconPainter::SEVERITY_NONE, true); | 129 AppMenuIconPainter::SEVERITY_NONE, true); |
130 } | 130 } |
131 | 131 |
132 void AppMenuBadgeController::Observe( | 132 void AppMenuBadgeController::Observe( |
133 int type, | 133 int type, |
134 const content::NotificationSource& source, | 134 const content::NotificationSource& source, |
135 const content::NotificationDetails& details) { | 135 const content::NotificationDetails& details) { |
136 UpdateDelegate(); | 136 UpdateDelegate(); |
137 } | 137 } |
OLD | NEW |