Chromium Code Reviews| Index: chrome/browser/ui/toolbar/app_menu_icon_controller.cc |
| diff --git a/chrome/browser/ui/toolbar/app_menu_badge_controller.cc b/chrome/browser/ui/toolbar/app_menu_icon_controller.cc |
| similarity index 72% |
| rename from chrome/browser/ui/toolbar/app_menu_badge_controller.cc |
| rename to chrome/browser/ui/toolbar/app_menu_icon_controller.cc |
| index 2345c43e57ac3daa82a959f834084ae3b97dc96f..5f8d4d1658d128b1efa7317d8b4336f462e8725b 100644 |
| --- a/chrome/browser/ui/toolbar/app_menu_badge_controller.cc |
| +++ b/chrome/browser/ui/toolbar/app_menu_icon_controller.cc |
| @@ -2,7 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "chrome/browser/ui/toolbar/app_menu_badge_controller.h" |
| +#include "chrome/browser/ui/toolbar/app_menu_icon_controller.h" |
| #include "base/logging.h" |
| #include "build/build_config.h" |
| @@ -52,7 +52,7 @@ bool ShouldAnimateUpgradeLevel( |
| return should_animate; |
| } |
| -// Returns true if we should show the upgrade recommended badge. |
| +// Returns true if we should show the upgrade recommended icon. |
| bool ShouldShowUpgradeRecommended() { |
| #if defined(OS_CHROMEOS) |
| // In chromeos, the update recommendation is shown in the system tray. So it |
| @@ -76,8 +76,8 @@ bool ShouldShowIncompatibilityWarning() { |
| } // namespace |
| -AppMenuBadgeController::AppMenuBadgeController(Profile* profile, |
| - Delegate* delegate) |
| +AppMenuIconController::AppMenuIconController(Profile* profile, |
| + Delegate* delegate) |
| : profile_(profile), delegate_(delegate) { |
| DCHECK(profile_); |
| DCHECK(delegate_); |
| @@ -88,48 +88,43 @@ AppMenuBadgeController::AppMenuBadgeController(Profile* profile, |
| content::Source<Profile>(profile_)); |
| #if defined(OS_WIN) |
| - if (base::win::GetVersion() == base::win::VERSION_XP) { |
| - registrar_.Add(this, chrome::NOTIFICATION_MODULE_LIST_ENUMERATED, |
| - content::NotificationService::AllSources()); |
| - } |
|
kylix_rd
2016/06/06 22:59:45
Since we're removing XP/Vista specific code, I wen
|
| registrar_.Add(this, chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE, |
| content::NotificationService::AllSources()); |
| #endif |
| } |
| -AppMenuBadgeController::~AppMenuBadgeController() { |
| -} |
| +AppMenuIconController::~AppMenuIconController() {} |
| -void AppMenuBadgeController::UpdateDelegate() { |
| +void AppMenuIconController::UpdateDelegate() { |
| if (ShouldShowUpgradeRecommended()) { |
| UpgradeDetector::UpgradeNotificationAnnoyanceLevel level = |
| UpgradeDetector::GetInstance()->upgrade_notification_stage(); |
| - delegate_->UpdateBadgeSeverity(BadgeType::UPGRADE_NOTIFICATION, |
| - SeverityFromUpgradeLevel(level), |
| - ShouldAnimateUpgradeLevel(level)); |
| + delegate_->UpdateIconSeverity(IconType::UPGRADE_NOTIFICATION, |
| + SeverityFromUpgradeLevel(level), |
| + ShouldAnimateUpgradeLevel(level)); |
| return; |
| } |
| if (ShouldShowIncompatibilityWarning()) { |
| - delegate_->UpdateBadgeSeverity(BadgeType::INCOMPATIBILITY_WARNING, |
| - AppMenuIconPainter::SEVERITY_MEDIUM, true); |
| + delegate_->UpdateIconSeverity(IconType::INCOMPATIBILITY_WARNING, |
| + AppMenuIconPainter::SEVERITY_MEDIUM, true); |
| return; |
| } |
| - if (GlobalErrorServiceFactory::GetForProfile(profile_)-> |
| - GetHighestSeverityGlobalErrorWithAppMenuItem()) { |
| + if (GlobalErrorServiceFactory::GetForProfile(profile_) |
| + ->GetHighestSeverityGlobalErrorWithAppMenuItem()) { |
| // If you change the severity here, make sure to also change the menu icon |
| // and the bubble icon. |
| - delegate_->UpdateBadgeSeverity(BadgeType::GLOBAL_ERROR, |
| - AppMenuIconPainter::SEVERITY_MEDIUM, true); |
| + delegate_->UpdateIconSeverity(IconType::GLOBAL_ERROR, |
| + AppMenuIconPainter::SEVERITY_MEDIUM, true); |
| return; |
| } |
| - delegate_->UpdateBadgeSeverity(BadgeType::NONE, |
| - AppMenuIconPainter::SEVERITY_NONE, true); |
| + delegate_->UpdateIconSeverity(IconType::NONE, |
| + AppMenuIconPainter::SEVERITY_NONE, true); |
| } |
| -void AppMenuBadgeController::Observe( |
| +void AppMenuIconController::Observe( |
| int type, |
| const content::NotificationSource& source, |
| const content::NotificationDetails& details) { |