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

Unified Diff: ui/views/controls/button/vector_icon_button.cc

Issue 2618403002: Reland crrev.com/8283cad74e0cad4840d1f with fix for static initializers. (Closed)
Patch Set: re-up Created 3 years, 11 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: ui/views/controls/button/vector_icon_button.cc
diff --git a/ui/views/controls/button/vector_icon_button.cc b/ui/views/controls/button/vector_icon_button.cc
index 2c6b70d4b350a66f248832038e87c7dff543bdb3..b3dbca975e4e8ed90c29dc93d6ece94d6a7ec8f6 100644
--- a/ui/views/controls/button/vector_icon_button.cc
+++ b/ui/views/controls/button/vector_icon_button.cc
@@ -44,10 +44,19 @@ void VectorIconButton::SetIcon(gfx::VectorIconId id) {
}
}
+void VectorIconButton::SetIcon(const gfx::VectorIcon& icon) {
+ icon_ = &icon;
+ SetIcon(gfx::VectorIconId::VECTOR_ICON_NONE);
+}
+
void VectorIconButton::OnThemeChanged() {
SkColor icon_color =
color_utils::DeriveDefaultIconColor(delegate_->GetVectorIconBaseColor());
- gfx::ImageSkia image = gfx::CreateVectorIcon(id_, icon_color);
+ gfx::ImageSkia image;
+ if (icon_)
+ image = gfx::CreateVectorIcon(*icon_, icon_color);
+ else
+ image = gfx::CreateVectorIcon(id_, icon_color);
SetImage(views::CustomButton::STATE_NORMAL, &image);
image = gfx::CreateVectorIcon(id_, SkColorSetA(icon_color, 0xff / 2));
SetImage(views::CustomButton::STATE_DISABLED, &image);

Powered by Google App Engine
This is Rietveld 408576698