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

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: Use a switch statement instead of an if..else ladder Created 4 years, 6 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 9db62bc1d38cccf88dee9237922739e7215db784..d9afbada2cd5fe3c0a6d477aa48e86172cc22ba9 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;
}
@@ -133,7 +136,9 @@ void AppMenuButton::ScheduleAppMenuIconPaint() {
}
void AppMenuButton::UpdateIcon() {
+ using BadgeType = AppMenuBadgeController::BadgeType;
Evan Stade 2016/06/03 21:44:16 I think we generally don't use using. Adding the q
kylix_rd 2016/06/03 22:04:10 Removed.
DCHECK(ui::MaterialDesignController::IsModeMaterial());
+ gfx::VectorIconId icon_id = gfx::VectorIconId::BROWSER_TOOLS;
Evan Stade 2016/06/03 21:44:17 nit: move to right above 2nd switch
kylix_rd 2016/06/03 22:04:10 Done.
SkColor color = gfx::kPlaceholderColor;
switch (severity_) {
case AppMenuIconPainter::SEVERITY_NONE:
@@ -151,8 +156,24 @@ void AppMenuButton::UpdateIcon() {
break;
}
+ switch (type_) {
+ case BadgeType::NONE:
+ // icon_id = gfx::VectorIconId::BROWSER_TOOLS; /* Already set above */
Evan Stade 2016/06/03 21:44:17 uncomment this, make initialization VECTOR_ICON_NO
kylix_rd 2016/06/03 22:04:10 Done.
+ DCHECK(severity_ == AppMenuIconPainter::SEVERITY_NONE);
+ break;
+ case BadgeType::UPGRADE_NOTIFICATION:
+ icon_id = gfx::VectorIconId::UPDATE_MENU_SEVERITY_LOW_MEDIUM_HIGH;
+ break;
+ case BadgeType::GLOBAL_ERROR:
+ icon_id = gfx::VectorIconId::UPDATE_MENU_FAILED;
+ break;
+ case 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));
}
void AppMenuButton::SetTrailingMargin(int margin) {

Powered by Google App Engine
This is Rietveld 408576698