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

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

Issue 2305933002: Update dialog close buttons to use vector icons and ripples. (Closed)
Patch Set: delegate Created 4 years, 3 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.h
diff --git a/ui/views/controls/button/vector_icon_button.h b/ui/views/controls/button/vector_icon_button.h
new file mode 100644
index 0000000000000000000000000000000000000000..9e2e3ca0ca38fb66fd1e3fa3ce459c55cbcc38a0
--- /dev/null
+++ b/ui/views/controls/button/vector_icon_button.h
@@ -0,0 +1,53 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
sky 2016/09/07 03:42:18 2016
Evan Stade 2016/09/07 16:17:37 in my mind this is a file move + rename
+// 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_VECTOR_ICON_BUTTON_H_
+#define UI_VIEWS_CONTROLS_BUTTON_VECTOR_ICON_BUTTON_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "ui/views/controls/button/image_button.h"
+
+namespace gfx {
+enum class VectorIconId;
+}
+
+namespace views {
+
+// A ButtonListener that also provides a color to use for drawing an icon.
+class VIEWS_EXPORT VectorIconButtonDelegate : public ButtonListener {
sky 2016/09/07 03:42:19 Move to own header as suggested in style guide.
Evan Stade 2016/09/07 16:17:37 Done.
+ public:
+ virtual SkColor GetVectorIconBaseColor() const;
+
+ protected:
+ ~VectorIconButtonDelegate() override {}
+};
+
+// A button that has an image and no text, with the image defined by a vector
+// icon identifier.
+class VIEWS_EXPORT VectorIconButton : public views::ImageButton {
+ public:
+ explicit VectorIconButton(VectorIconButtonDelegate* delegate);
+ ~VectorIconButton() override;
+
+ // Sets the icon to display and provides a callback which should return the
+ // text color from which to derive this icon's color.
+ void SetIcon(gfx::VectorIconId id);
+
+ // views::ImageButton:
+ void OnEnabledChanged() override;
+ void OnThemeChanged() override;
+ void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
+
+ private:
+ VectorIconButtonDelegate* delegate_;
+ gfx::VectorIconId id_;
+
+ DISALLOW_COPY_AND_ASSIGN(VectorIconButton);
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_CONTROLS_BUTTON_VECTOR_ICON_BUTTON_H_

Powered by Google App Engine
This is Rietveld 408576698