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

Unified Diff: ui/views/controls/button/image_button_util.h

Issue 2744463002: Add VectorIconButton functionality to ImageButton. (Closed)
Patch Set: tests Created 3 years, 9 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/image_button_util.h
diff --git a/ui/views/controls/button/image_button_util.h b/ui/views/controls/button/image_button_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..d586abce04db3c995d3bc84aaca022c3bb1e872c
--- /dev/null
+++ b/ui/views/controls/button/image_button_util.h
@@ -0,0 +1,33 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+#ifndef UI_VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_UTIL_H_
Evan Stade 2017/03/17 13:54:44 nit: not sure how many more things will be added t
sky 2017/03/17 15:38:12 I prefer not having files that become dumping grou
Bret 2017/03/17 23:41:41 I went with image_button_factory as the more speci
+#define UI_VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_UTIL_H_
+
+#include "third_party/skia/include/core/SkColor.h"
+#include "ui/views/views_export.h"
+
+namespace gfx {
+struct VectorIcon;
+}
+
+namespace views {
+
+class ButtonListener;
+class ImageButton;
+
+// Creates an ImageButton with an ink drop and a centered image in preparation
+// for applying a vector icon with SetImageFromVectorIcon below.
+VIEWS_EXPORT ImageButton* CreateImageButtonWithVectorIconStyling(
Evan Stade 2017/03/17 13:54:45 nit: naming is hard, but I'd give this a shorter n
Bret 2017/03/17 23:41:41 This one is pretty tough. I went with your suggest
+ ButtonListener* listener);
+
+// Sets images on |button| for STATE_NORMAL and STATE_DISABLED from the given
+// vector icon and color.
sky 2017/03/17 15:38:12 optional: as a common pattern is calling this from
Bret 2017/03/17 23:41:41 I put in a sentence about calling this again if th
+VIEWS_EXPORT void SetImageFromVectorIcon(ImageButton* button,
+ const gfx::VectorIcon& icon,
+ SkColor base_color);
Evan Stade 2017/03/17 13:54:45 nit: the nomenclature here is probably my fault, b
Evan Stade 2017/03/17 13:54:45 nit: I think we should make base_color optional, a
Bret 2017/03/17 23:41:41 I updated the names and comment. I'm a bit hesitan
Evan Stade 2017/03/18 00:27:58 It was already optional. Callers that didn't speci
Bret 2017/03/18 20:12:53 Okay, done.
+
+} // namespace views
+
+#endif // UI_VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_UTIL_H_

Powered by Google App Engine
This is Rietveld 408576698