Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Side by Side Diff: ui/views/controls/button/md_text_button.h

Issue 2375543003: Add SetProminent() to MdTextButton to create blue buttons. (Closed)
Patch Set: Fix nits. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/native_theme/native_theme_win.cc ('k') | ui/views/controls/button/md_text_button.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 14 matching lines...) Expand all
25 const base::string16& text); 25 const base::string16& text);
26 // As above, but only creates an MdTextButton if MD is enabled in the 26 // As above, but only creates an MdTextButton if MD is enabled in the
27 // secondary UI (as opposed to just "top chrome"/"primary" UI). 27 // secondary UI (as opposed to just "top chrome"/"primary" UI).
28 static LabelButton* CreateSecondaryUiButton(ButtonListener* listener, 28 static LabelButton* CreateSecondaryUiButton(ButtonListener* listener,
29 const base::string16& text); 29 const base::string16& text);
30 static LabelButton* CreateSecondaryUiBlueButton(ButtonListener* listener, 30 static LabelButton* CreateSecondaryUiBlueButton(ButtonListener* listener,
31 const base::string16& text); 31 const base::string16& text);
32 static MdTextButton* Create(ButtonListener* listener, 32 static MdTextButton* Create(ButtonListener* listener,
33 const base::string16& text); 33 const base::string16& text);
34 34
35 // See |is_cta_|. 35 // See |is_prominent_|.
36 void SetCallToAction(bool cta); 36 void SetProminent(bool is_prominent);
37 void set_bg_color_override(SkColor color) { bg_color_override_ = color; } 37 void set_bg_color_override(SkColor color) { bg_color_override_ = color; }
38 38
39 // LabelButton: 39 // LabelButton:
40 void Layout() override; 40 void Layout() override;
41 void OnFocus() override; 41 void OnFocus() override;
42 void OnBlur() override; 42 void OnBlur() override;
43 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; 43 void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
44 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; 44 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override;
45 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() 45 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight()
46 const override; 46 const override;
(...skipping 14 matching lines...) Expand all
61 ~MdTextButton() override; 61 ~MdTextButton() override;
62 62
63 void UpdatePadding(); 63 void UpdatePadding();
64 void UpdateColors(); 64 void UpdateColors();
65 65
66 // The MD-style focus ring. This is not done via a FocusPainter 66 // The MD-style focus ring. This is not done via a FocusPainter
67 // because it needs to paint to a layer so it can extend beyond the bounds of 67 // because it needs to paint to a layer so it can extend beyond the bounds of
68 // |this|. 68 // |this|.
69 internal::MdFocusRing* focus_ring_; 69 internal::MdFocusRing* focus_ring_;
70 70
71 // True if this button uses call-to-action styling. 71 // True if this button uses prominent styling (blue fill, etc.).
72 bool is_cta_; 72 bool is_prominent_;
73 73
74 // When set, this provides the background color. 74 // When set, this provides the background color.
75 base::Optional<SkColor> bg_color_override_; 75 base::Optional<SkColor> bg_color_override_;
76 76
77 DISALLOW_COPY_AND_ASSIGN(MdTextButton); 77 DISALLOW_COPY_AND_ASSIGN(MdTextButton);
78 }; 78 };
79 79
80 } // namespace views 80 } // namespace views
81 81
82 #endif // UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_ 82 #endif // UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_
OLDNEW
« no previous file with comments | « ui/native_theme/native_theme_win.cc ('k') | ui/views/controls/button/md_text_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698