Chromium Code Reviews| Index: chrome/browser/ui/views/toolbar/toolbar_view.cc |
| diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc |
| index 25f0b5eb838087ba5367b2b4897872ef7c935487..a037f5acdb84307e3bb1c28447d9c11ee81926fb 100644 |
| --- a/chrome/browser/ui/views/toolbar/toolbar_view.cc |
| +++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc |
| @@ -129,7 +129,7 @@ ToolbarView::ToolbarView(Browser* browser) |
| browser_actions_(nullptr), |
| app_menu_button_(nullptr), |
| browser_(browser), |
| - badge_controller_(browser->profile(), this), |
| + icon_controller_(browser->profile(), this), |
| display_mode_(browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) |
| ? DISPLAYMODE_NORMAL |
| : DISPLAYMODE_LOCATION) { |
| @@ -239,7 +239,7 @@ void ToolbarView::Init() { |
| LoadImages(); |
| - // Start global error services now so we badge the menu correctly. |
| + // Start global error services now so we set the icon on the menu correctly. |
| #if !defined(OS_CHROMEOS) |
| if (!HasAshShell()) { |
| SigninGlobalErrorFactory::GetForProfile(browser_->profile()); |
| @@ -253,11 +253,10 @@ void ToolbarView::Init() { |
| #endif |
| #endif // OS_CHROMEOS |
| - // Add any necessary badges to the menu item based on the system state. |
| - // Do this after |app_menu_button_| has been added as a bubble may be shown |
| - // that needs the widget (widget found by way of app_menu_button_-> |
| - // GetWidget()). |
| - badge_controller_.UpdateDelegate(); |
| + // Set the button icon based on the system state. Do this after |
| + // |app_menu_button_| has been added as a bubble may be shown that needs |
| + // the widget (widget found by way of app_menu_button_->GetWidget()). |
| + icon_controller_.UpdateDelegate(); |
| location_bar_->Init(); |
| @@ -646,9 +645,9 @@ bool ToolbarView::DoesIntersectRect(const views::View* target, |
| return ViewTargeterDelegate::DoesIntersectRect(this, rect); |
| } |
| -void ToolbarView::UpdateBadgeSeverity(AppMenuBadgeController::BadgeType type, |
| - AppMenuIconPainter::Severity severity, |
| - bool animate) { |
| +void ToolbarView::UpdateIconSeverity(AppMenuIconController::IconType type, |
|
Evan Stade
2016/06/10 18:01:57
nit: would be easier to grok if you copied the pat
kylix_rd
2016/06/10 19:08:53
Could you be a little more specific about what you
Evan Stade
2016/06/10 19:38:58
it seems you figured it out :)
|
| + AppMenuIconPainter::Severity severity, |
| + bool animate) { |
| // There's no app menu in tabless windows. |
| if (!app_menu_button_) |
| return; |
| @@ -658,28 +657,29 @@ void ToolbarView::UpdateBadgeSeverity(AppMenuBadgeController::BadgeType type, |
| DCHECK(app_menu_button_->GetWidget()); |
| base::string16 accname_app = l10n_util::GetStringUTF16(IDS_ACCNAME_APP); |
| - if (type == AppMenuBadgeController::BadgeType::UPGRADE_NOTIFICATION) { |
| + if (type == AppMenuIconController::IconType::UPGRADE_NOTIFICATION) { |
| accname_app = l10n_util::GetStringFUTF16( |
| IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app); |
| } |
| app_menu_button_->SetAccessibleName(accname_app); |
| app_menu_button_->SetSeverity(type, severity, animate); |
| - // Keep track of whether we were showing the badge before, so we don't send |
| - // multiple UMA events for example when multiple Chrome windows are open. |
| - static bool incompatibility_badge_showing = false; |
| + // Keep track of whether we were showing the incompatibility icon before, |
| + // so we don't send multiple UMA events for example when multiple Chrome |
| + // windows are open. |
| + static bool incompatibility_icon_showing = false; |
| // Save the old value before resetting it. |
| - bool was_showing = incompatibility_badge_showing; |
| - incompatibility_badge_showing = false; |
| + bool was_showing = incompatibility_icon_showing; |
| + incompatibility_icon_showing = false; |
| - if (type == AppMenuBadgeController::BadgeType::INCOMPATIBILITY_WARNING) { |
| + if (type == AppMenuIconController::IconType::INCOMPATIBILITY_WARNING) { |
| if (!was_showing) { |
| content::RecordAction(UserMetricsAction("ConflictBadge")); |
| #if defined(OS_WIN) |
| ConflictingModuleView::MaybeShow(browser_, app_menu_button_); |
| #endif |
| } |
| - incompatibility_badge_showing = true; |
| + incompatibility_icon_showing = true; |
|
Evan Stade
2016/06/10 18:01:57
I would call this the more generic/logical "incomp
kylix_rd
2016/06/10 19:08:53
Done.
|
| return; |
| } |
| } |