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 UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_ |
6 #define UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/optional.h" | 10 #include "base/optional.h" |
11 #include "ui/views/controls/button/label_button.h" | 11 #include "ui/views/controls/button/label_button.h" |
12 | 12 |
13 namespace views { | 13 namespace views { |
14 | 14 |
15 // A button class that implements the Material Design text button spec. | 15 // A button class that implements the Material Design text button spec. |
16 class VIEWS_EXPORT MdTextButton : public LabelButton { | 16 class VIEWS_EXPORT MdTextButton : public LabelButton { |
17 public: | 17 public: |
18 // As above, but only creates an MdTextButton if MD is enabled in the | 18 // As above, but only creates an MdTextButton if MD is enabled in the |
19 // secondary UI (as opposed to just "top chrome"/"primary" UI). | 19 // secondary UI (as opposed to just "top chrome"/"primary" UI). |
20 static LabelButton* CreateSecondaryUiButton(ButtonListener* listener, | 20 static LabelButton* CreateSecondaryUiButton(ButtonListener* listener, |
21 const base::string16& text); | 21 const base::string16& text); |
22 static LabelButton* CreateSecondaryUiBlueButton(ButtonListener* listener, | 22 static LabelButton* CreateSecondaryUiBlueButton(ButtonListener* listener, |
23 const base::string16& text); | 23 const base::string16& text); |
24 static MdTextButton* Create(ButtonListener* listener, | 24 static MdTextButton* Create(ButtonListener* listener, |
25 const base::string16& text); | 25 const base::string16& text); |
26 | 26 |
27 // See |is_prominent_|. | 27 // See |is_prominent_|. |
28 void SetProminent(bool is_prominent); | 28 void SetProminent(bool is_prominent); |
29 void set_bg_color_override(SkColor color) { bg_color_override_ = color; } | 29 |
| 30 // See |bg_color_override_|. |
| 31 void SetBgColorOverride(const base::Optional<SkColor>& color); |
30 | 32 |
31 // LabelButton: | 33 // LabelButton: |
32 void OnFocus() override; | 34 void OnFocus() override; |
33 void OnBlur() override; | 35 void OnBlur() override; |
34 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 36 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
35 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; | 37 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; |
36 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() | 38 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() |
37 const override; | 39 const override; |
38 SkColor GetInkDropBaseColor() const override; | 40 SkColor GetInkDropBaseColor() const override; |
39 bool ShouldShowInkDropForFocus() const override; | 41 bool ShouldShowInkDropForFocus() const override; |
(...skipping 19 matching lines...) Expand all Loading... |
59 | 61 |
60 // When set, this provides the background color. | 62 // When set, this provides the background color. |
61 base::Optional<SkColor> bg_color_override_; | 63 base::Optional<SkColor> bg_color_override_; |
62 | 64 |
63 DISALLOW_COPY_AND_ASSIGN(MdTextButton); | 65 DISALLOW_COPY_AND_ASSIGN(MdTextButton); |
64 }; | 66 }; |
65 | 67 |
66 } // namespace views | 68 } // namespace views |
67 | 69 |
68 #endif // UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_ | 70 #endif // UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_ |
OLD | NEW |