Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_BAR_CONTROL_BUTTON_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_VECTOR_ICON_BUTTON_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_BAR_CONTROL_BUTTON_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_VECTOR_ICON_BUTTON_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "ui/views/controls/button/image_button.h" | 12 #include "ui/views/controls/button/image_button.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 enum class VectorIconId; | 15 enum class VectorIconId; |
| 16 } | 16 } |
| 17 | 17 |
| 18 // A class for buttons that control bars (find bar, download shelf, etc.). The | 18 namespace views { |
| 19 // button has an image and no text. | 19 |
| 20 class BarControlButton : public views::ImageButton { | 20 // A button that has an image and no text, with the image defined by a vector |
| 21 // icon identifier. | |
| 22 class VectorIconButton : public views::ImageButton { | |
| 21 public: | 23 public: |
| 22 explicit BarControlButton(views::ButtonListener* listener); | 24 explicit VectorIconButton(views::ButtonListener* listener); |
| 23 ~BarControlButton() override; | 25 ~VectorIconButton() override; |
| 24 | 26 |
| 25 // Sets the icon to display and provides a callback which should return the | 27 // Sets the icon to display and provides a callback which should return the |
| 26 // text color from which to derive this icon's color. | 28 // text color from which to derive this icon's color. If the callback is null, |
| 29 // the color will default to kChromeIconGrey. | |
| 27 void SetIcon(gfx::VectorIconId id, | 30 void SetIcon(gfx::VectorIconId id, |
| 28 const base::Callback<SkColor(void)>& get_text_color_callback); | 31 const base::Callback<SkColor(void)>& get_text_color_callback); |
|
sky
2016/09/06 21:22:47
I would prefer not to put this class in views beca
Evan Stade
2016/09/06 21:45:55
I can get rid of the kChromeIconGrey pretty easily
| |
| 29 | 32 |
| 30 // views::ImageButton: | 33 // views::ImageButton: |
| 34 void OnEnabledChanged() override; | |
| 31 void OnThemeChanged() override; | 35 void OnThemeChanged() override; |
| 32 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 36 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| 33 | 37 |
| 34 private: | 38 private: |
| 35 gfx::VectorIconId id_; | 39 gfx::VectorIconId id_; |
| 36 base::Callback<SkColor(void)> get_text_color_callback_; | 40 base::Callback<SkColor(void)> get_text_color_callback_; |
| 37 | 41 |
| 38 DISALLOW_COPY_AND_ASSIGN(BarControlButton); | 42 DISALLOW_COPY_AND_ASSIGN(VectorIconButton); |
| 39 }; | 43 }; |
| 40 | 44 |
| 41 #endif // CHROME_BROWSER_UI_VIEWS_BAR_CONTROL_BUTTON_H_ | 45 } // namespace views |
| 46 | |
| 47 #endif // UI_VIEWS_CONTROLS_BUTTON_VECTOR_ICON_BUTTON_H_ | |
| OLD | NEW |