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

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: Renamed icons - interim name until larger refactor. 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
« no previous file with comments | « chrome/browser/ui/views/toolbar/app_menu_button.h ('k') | chrome/browser/ui/views/toolbar/toolbar_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..482d37056e808c68bc0fdf805f16326e3ab17186 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"
@@ -37,6 +38,7 @@ bool AppMenuButton::g_open_app_immediately_for_testing = false;
AppMenuButton::AppMenuButton(ToolbarView* toolbar_view)
: views::MenuButton(base::string16(), toolbar_view, false),
severity_(AppMenuIconPainter::SEVERITY_NONE),
+ type_(AppMenuBadgeController::BadgeType::NONE),
kylix_rd 2016/06/06 17:46:55 Oops... failed to properly initialize the type_ fi
toolbar_view_(toolbar_view),
allow_extension_dragging_(
extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()),
@@ -50,10 +52,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 +155,24 @@ void AppMenuButton::UpdateIcon() {
break;
}
- SetImage(views::Button::STATE_NORMAL,
- gfx::CreateVectorIcon(gfx::VectorIconId::BROWSER_TOOLS, color));
+ gfx::VectorIconId icon_id = gfx::VectorIconId::VECTOR_ICON_NONE;
+ switch (type_) {
+ case AppMenuBadgeController::BadgeType::NONE:
+ icon_id = gfx::VectorIconId::BROWSER_TOOLS;
+ DCHECK_EQ(severity_, AppMenuIconPainter::SEVERITY_NONE);
+ break;
+ case AppMenuBadgeController::BadgeType::UPGRADE_NOTIFICATION:
+ icon_id = gfx::VectorIconId::BROWSER_TOOLS_UPDATE;
+ break;
+ case AppMenuBadgeController::BadgeType::GLOBAL_ERROR:
+ icon_id = gfx::VectorIconId::BROWSER_TOOLS_ERROR;
+ break;
+ case AppMenuBadgeController::BadgeType::INCOMPATIBILITY_WARNING:
+ icon_id = gfx::VectorIconId::BROWSER_TOOLS_WARNING;
+ break;
+ }
+
+ SetImage(views::Button::STATE_NORMAL, gfx::CreateVectorIcon(icon_id, color));
}
void AppMenuButton::SetTrailingMargin(int margin) {
« no previous file with comments | « chrome/browser/ui/views/toolbar/app_menu_button.h ('k') | chrome/browser/ui/views/toolbar/toolbar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698