| 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 "ui/views/animation/button_ink_drop_delegate.h" | 10 #include "ui/views/animation/button_ink_drop_delegate.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 const base::string16& text); | 29 const base::string16& text); |
| 30 // As above, but only creates an MdTextButton if MD is enabled in the | 30 // As above, but only creates an MdTextButton if MD is enabled in the |
| 31 // secondary UI (as opposed to just "top chrome"/"primary" UI). | 31 // secondary UI (as opposed to just "top chrome"/"primary" UI). |
| 32 static LabelButton* CreateSecondaryUiButton(ButtonListener* listener, | 32 static LabelButton* CreateSecondaryUiButton(ButtonListener* listener, |
| 33 const base::string16& text); | 33 const base::string16& text); |
| 34 static LabelButton* CreateSecondaryUiBlueButton(ButtonListener* listener, | 34 static LabelButton* CreateSecondaryUiBlueButton(ButtonListener* listener, |
| 35 const base::string16& text); | 35 const base::string16& text); |
| 36 static MdTextButton* CreateMdButton(ButtonListener* listener, | 36 static MdTextButton* CreateMdButton(ButtonListener* listener, |
| 37 const base::string16& text); | 37 const base::string16& text); |
| 38 | 38 |
| 39 // Paint an MD-style focus ring on the given canvas at the given bounds. |
| 40 static void PaintMdFocusRing(gfx::Canvas* canvas, View* view); |
| 41 |
| 39 void SetCallToAction(CallToAction cta); | 42 void SetCallToAction(CallToAction cta); |
| 40 | 43 |
| 41 // LabelButton: | 44 // LabelButton: |
| 45 void Layout() override; |
| 46 void OnFocus() override; |
| 47 void OnBlur() override; |
| 42 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 48 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| 43 SkColor GetInkDropBaseColor() const override; | 49 SkColor GetInkDropBaseColor() const override; |
| 50 bool ShouldShowInkDropForFocus() const override; |
| 44 void SetText(const base::string16& text) override; | 51 void SetText(const base::string16& text) override; |
| 45 void UpdateStyleToIndicateDefaultStatus() override; | 52 void UpdateStyleToIndicateDefaultStatus() override; |
| 46 | 53 |
| 47 private: | 54 private: |
| 48 MdTextButton(ButtonListener* listener); | 55 MdTextButton(ButtonListener* listener); |
| 49 ~MdTextButton() override; | 56 ~MdTextButton() override; |
| 50 | 57 |
| 51 void UpdateColorsFromNativeTheme(); | 58 void UpdateColorsFromNativeTheme(); |
| 52 | 59 |
| 53 ButtonInkDropDelegate ink_drop_delegate_; | 60 // The MD-style focus ring. This is not done via a FocusPainter |
| 61 // because it needs to paint to a layer so it can extend beyond the bounds of |
| 62 // |this|. |
| 63 views::View* focus_ring_; |
| 54 | 64 |
| 55 // The call to action style for this button. | 65 // The call to action style for this button. |
| 56 CallToAction cta_; | 66 CallToAction cta_; |
| 57 | 67 |
| 58 DISALLOW_COPY_AND_ASSIGN(MdTextButton); | 68 DISALLOW_COPY_AND_ASSIGN(MdTextButton); |
| 59 }; | 69 }; |
| 60 | 70 |
| 61 } // namespace views | 71 } // namespace views |
| 62 | 72 |
| 63 #endif // UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_ | 73 #endif // UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_ |
| OLD | NEW |