Chromium Code Reviews| Index: chrome/browser/ui/views/toolbar/app_menu_button.cc |
| diff --git a/chrome/browser/ui/views/toolbar/app_menu_button.cc b/chrome/browser/ui/views/toolbar/app_menu_button.cc |
| index 9db62bc1d38cccf88dee9237922739e7215db784..6cc19841f1ee1832cd9e6386fa581841ac2c020f 100644 |
| --- a/chrome/browser/ui/views/toolbar/app_menu_button.cc |
| +++ b/chrome/browser/ui/views/toolbar/app_menu_button.cc |
| @@ -11,6 +11,7 @@ |
| #include "base/time/time.h" |
| #include "chrome/browser/themes/theme_properties.h" |
| #include "chrome/browser/ui/browser.h" |
| +#include "chrome/browser/ui/browser_otr_state.h" |
| #include "chrome/browser/ui/layout_constants.h" |
| #include "chrome/browser/ui/toolbar/app_menu_model.h" |
| #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h" |
| @@ -50,10 +51,12 @@ AppMenuButton::AppMenuButton(ToolbarView* toolbar_view) |
| AppMenuButton::~AppMenuButton() {} |
| -void AppMenuButton::SetSeverity(AppMenuIconPainter::Severity severity, |
| +void AppMenuButton::SetSeverity(AppMenuBadgeController::BadgeType type, |
| + AppMenuIconPainter::Severity severity, |
| bool animate) { |
| if (ui::MaterialDesignController::IsModeMaterial()) { |
| severity_ = severity; |
| + type_ = type; |
| UpdateIcon(); |
| return; |
| } |
| @@ -151,8 +154,25 @@ void AppMenuButton::UpdateIcon() { |
| break; |
| } |
| + gfx::VectorIconId icon_id = gfx::VectorIconId::VECTOR_ICON_NONE; |
| + switch (type_) { |
| + case AppMenuBadgeController::BadgeType::NONE: |
| + icon_id = gfx::VectorIconId::BROWSER_TOOLS; |
| + DCHECK(severity_ == AppMenuIconPainter::SEVERITY_NONE); |
|
msw
2016/06/03 22:34:37
nit: DCHECK_EQ?
kylix_rd
2016/06/03 22:42:45
I was completely unaware such a beast existed. Wil
|
| + break; |
| + case AppMenuBadgeController::BadgeType::UPGRADE_NOTIFICATION: |
| + icon_id = gfx::VectorIconId::UPDATE_MENU_SEVERITY_LOW_MEDIUM_HIGH; |
|
msw
2016/06/03 22:34:37
nit: these names aren't terribly straightforward.
kylix_rd
2016/06/03 22:42:45
I used the names (or derivatives thereof) straight
msw
2016/06/03 23:01:17
Hmm, that might be okay, but it adds another layer
|
| + break; |
| + case AppMenuBadgeController::BadgeType::GLOBAL_ERROR: |
| + icon_id = gfx::VectorIconId::UPDATE_MENU_FAILED; |
| + break; |
| + case AppMenuBadgeController::BadgeType::INCOMPATIBILITY_WARNING: |
| + icon_id = gfx::VectorIconId::UPDATE_MENU_SEVERITY_WARNING; |
| + break; |
| + } |
| + |
| SetImage(views::Button::STATE_NORMAL, |
| - gfx::CreateVectorIcon(gfx::VectorIconId::BROWSER_TOOLS, color)); |
| + gfx::CreateVectorIcon(icon_id, 16, color)); |
|
msw
2016/06/03 22:34:37
Hmm, sad to see most related callers using magic n
kylix_rd
2016/06/03 22:42:45
Agreed. I think I asked at some point about whethe
Evan Stade
2016/06/03 22:53:23
Well most top chrome icons are specified in both 1
kylix_rd
2016/06/03 23:00:47
So should I look into creating 1x and 2x variants
Evan Stade
2016/06/03 23:04:40
You might double check, but I assume Sebastien did
|
| } |
| void AppMenuButton::SetTrailingMargin(int margin) { |