| 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> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "base/macros.h" | 8 #include "base/macros.h" |
| 12 #include "ui/views/controls/button/image_button.h" | 9 #include "ui/views/controls/button/image_button.h" |
| 13 | 10 |
| 14 namespace gfx { | 11 namespace gfx { |
| 15 enum class VectorIconId; | 12 enum class VectorIconId; |
| 16 } | 13 } |
| 17 | 14 |
| 18 // A class for buttons that control bars (find bar, download shelf, etc.). The | 15 namespace views { |
| 19 // button has an image and no text. | 16 |
| 20 class BarControlButton : public views::ImageButton { | 17 class VectorIconButtonDelegate; |
| 18 |
| 19 // A button that has an image and no text, with the image defined by a vector |
| 20 // icon identifier. |
| 21 class VIEWS_EXPORT VectorIconButton : public views::ImageButton { |
| 21 public: | 22 public: |
| 22 explicit BarControlButton(views::ButtonListener* listener); | 23 explicit VectorIconButton(VectorIconButtonDelegate* delegate); |
| 23 ~BarControlButton() override; | 24 ~VectorIconButton() override; |
| 24 | 25 |
| 25 // Sets the icon to display and provides a callback which should return the | 26 // Sets the icon to display and provides a callback which should return the |
| 26 // text color from which to derive this icon's color. | 27 // text color from which to derive this icon's color. |
| 27 void SetIcon(gfx::VectorIconId id, | 28 void SetIcon(gfx::VectorIconId id); |
| 28 const base::Callback<SkColor(void)>& get_text_color_callback); | |
| 29 | 29 |
| 30 // views::ImageButton: | 30 // views::ImageButton: |
| 31 void OnEnabledChanged() override; |
| 31 void OnThemeChanged() override; | 32 void OnThemeChanged() override; |
| 32 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 33 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| 33 | 34 |
| 34 private: | 35 private: |
| 36 VectorIconButtonDelegate* delegate_; |
| 35 gfx::VectorIconId id_; | 37 gfx::VectorIconId id_; |
| 36 base::Callback<SkColor(void)> get_text_color_callback_; | |
| 37 | 38 |
| 38 DISALLOW_COPY_AND_ASSIGN(BarControlButton); | 39 DISALLOW_COPY_AND_ASSIGN(VectorIconButton); |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 #endif // CHROME_BROWSER_UI_VIEWS_BAR_CONTROL_BUTTON_H_ | 42 } // namespace views |
| 43 |
| 44 #endif // UI_VIEWS_CONTROLS_BUTTON_VECTOR_ICON_BUTTON_H_ |
| OLD | NEW |