| 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" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 const base::string16& text); | 31 const base::string16& text); |
| 32 static MdTextButton* CreateMdButton(ButtonListener* listener, | 32 static MdTextButton* CreateMdButton(ButtonListener* listener, |
| 33 const base::string16& text); | 33 const base::string16& text); |
| 34 | 34 |
| 35 // Paint an MD-style focus ring on the given canvas at the given bounds. | 35 // Paint an MD-style focus ring on the given canvas at the given bounds. |
| 36 static void PaintMdFocusRing(gfx::Canvas* canvas, | 36 static void PaintMdFocusRing(gfx::Canvas* canvas, |
| 37 View* view, | 37 View* view, |
| 38 int thickness, | 38 int thickness, |
| 39 SkAlpha alpha); | 39 SkAlpha alpha); |
| 40 | 40 |
| 41 void AdjustFontSize(int size_delta); |
| 41 void SetCallToAction(bool cta); | 42 void SetCallToAction(bool cta); |
| 42 void set_bg_color_override(SkColor color) { bg_color_override_ = color; } | 43 void set_bg_color_override(SkColor color) { bg_color_override_ = color; } |
| 43 | 44 |
| 44 // LabelButton: | 45 // LabelButton: |
| 45 void Layout() override; | 46 void Layout() override; |
| 46 void OnFocus() override; | 47 void OnFocus() override; |
| 47 void OnBlur() override; | 48 void OnBlur() override; |
| 48 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 49 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| 49 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() | 50 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() |
| 50 const override; | 51 const override; |
| 51 SkColor GetInkDropBaseColor() const override; | 52 SkColor GetInkDropBaseColor() const override; |
| 52 bool ShouldShowInkDropForFocus() const override; | 53 bool ShouldShowInkDropForFocus() const override; |
| 53 void SetEnabledTextColors(SkColor color) override; | 54 void SetEnabledTextColors(SkColor color) override; |
| 54 void UpdateStyleToIndicateDefaultStatus() override; | 55 void UpdateStyleToIndicateDefaultStatus() override; |
| 55 | 56 |
| 56 private: | 57 private: |
| 57 MdTextButton(ButtonListener* listener); | 58 MdTextButton(ButtonListener* listener); |
| 58 ~MdTextButton() override; | 59 ~MdTextButton() override; |
| 59 | 60 |
| 61 void UpdatePaddingForFont(); |
| 60 void UpdateColors(); | 62 void UpdateColors(); |
| 61 | 63 |
| 62 // The MD-style focus ring. This is not done via a FocusPainter | 64 // The MD-style focus ring. This is not done via a FocusPainter |
| 63 // because it needs to paint to a layer so it can extend beyond the bounds of | 65 // because it needs to paint to a layer so it can extend beyond the bounds of |
| 64 // |this|. | 66 // |this|. |
| 65 internal::MdFocusRing* focus_ring_; | 67 internal::MdFocusRing* focus_ring_; |
| 66 | 68 |
| 67 // True if this button uses call-to-action styling. | 69 // True if this button uses call-to-action styling. |
| 68 bool is_cta_; | 70 bool is_cta_; |
| 69 | 71 |
| 70 // When set, this provides the background color. | 72 // When set, this provides the background color. |
| 71 base::Optional<SkColor> bg_color_override_; | 73 base::Optional<SkColor> bg_color_override_; |
| 72 | 74 |
| 73 DISALLOW_COPY_AND_ASSIGN(MdTextButton); | 75 DISALLOW_COPY_AND_ASSIGN(MdTextButton); |
| 74 }; | 76 }; |
| 75 | 77 |
| 76 } // namespace views | 78 } // namespace views |
| 77 | 79 |
| 78 #endif // UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_ | 80 #endif // UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_ |
| OLD | NEW |