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

Unified Diff: chrome/browser/ui/views/toolbar/app_menu_button.cc

Issue 1966643002: Integrate new MD update menu icons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Uses the BadgeType to select the severity-warning icon. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
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 ca12f2f1d1dd190b9bbe03d43558d92d344fc758..d7133845905431fde65592ee5933e59c6357d2ca 100644
--- a/chrome/browser/ui/views/toolbar/app_menu_button.cc
+++ b/chrome/browser/ui/views/toolbar/app_menu_button.cc
@@ -51,9 +51,11 @@ AppMenuButton::AppMenuButton(ToolbarView* toolbar_view)
AppMenuButton::~AppMenuButton() {}
void AppMenuButton::SetSeverity(AppMenuIconPainter::Severity severity,
+ AppMenuBadgeController::BadgeType type,
bool animate) {
if (ui::MaterialDesignController::IsModeMaterial()) {
severity_ = severity;
+ type_ = type;
UpdateIcon();
return;
}
@@ -134,6 +136,7 @@ void AppMenuButton::ScheduleAppMenuIconPaint() {
void AppMenuButton::UpdateIcon() {
DCHECK(ui::MaterialDesignController::IsModeMaterial());
+ gfx::VectorIconId icon_id = gfx::VectorIconId::BROWSER_TOOLS;
SkColor color = gfx::kPlaceholderColor;
switch (severity_) {
case AppMenuIconPainter::SEVERITY_NONE:
@@ -142,17 +145,26 @@ void AppMenuButton::UpdateIcon() {
break;
case AppMenuIconPainter::SEVERITY_LOW:
color = gfx::kGoogleGreen700;
+ icon_id = gfx::VectorIconId::UPDATE_MENU_SEVERITY_LOW;
break;
case AppMenuIconPainter::SEVERITY_MEDIUM:
color = gfx::kGoogleYellow700;
+ if (type_ == AppMenuBadgeController::BADGE_TYPE_GLOBAL_ERROR)
+ icon_id = gfx::VectorIconId::UPDATE_MENU_FAILED;
+ else if (type_ ==
+ AppMenuBadgeController::BADGE_TYPE_INCOMPATIBILITY_WARNING)
Peter Kasting 2016/05/11 19:16:46 The long names for the enum values are causing str
kylix_rd 2016/05/11 19:54:43 Should this kind of refactoring work be a separate
Peter Kasting 2016/05/11 19:57:48 There's no formal rule, it's basically a judgment
+ icon_id = gfx::VectorIconId::UPDATE_MENU_SEVERITY_WARNING;
+ else
+ icon_id = gfx::VectorIconId::UPDATE_MENU_SEVERITY_MEDIUM;
break;
case AppMenuIconPainter::SEVERITY_HIGH:
color = gfx::kGoogleRed700;
+ icon_id = gfx::VectorIconId::UPDATE_MENU_SEVERITY_HIGH;
break;
}
SetImage(views::Button::STATE_NORMAL,
- gfx::CreateVectorIcon(gfx::VectorIconId::BROWSER_TOOLS, color));
+ gfx::CreateVectorIcon(icon_id, 16, color));
}
void AppMenuButton::SetTrailingMargin(int margin) {

Powered by Google App Engine
This is Rietveld 408576698