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

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

Issue 2187473004: Make normal MD text buttons *on infobars* white. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
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 "ui/views/controls/button/label_button.h" 11 #include "ui/views/controls/button/label_button.h"
11 12
12 namespace views { 13 namespace views {
13 14
14 namespace internal { 15 namespace internal {
15 class MdFocusRing; 16 class MdFocusRing;
16 } // namespace internal 17 } // namespace internal
17 18
18 // A button class that implements the Material Design text button spec. 19 // A button class that implements the Material Design text button spec.
19 class VIEWS_EXPORT MdTextButton : public LabelButton { 20 class VIEWS_EXPORT MdTextButton : public LabelButton {
(...skipping 11 matching lines...) Expand all
31 static MdTextButton* CreateMdButton(ButtonListener* listener, 32 static MdTextButton* CreateMdButton(ButtonListener* listener,
32 const base::string16& text); 33 const base::string16& text);
33 34
34 // 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.
35 static void PaintMdFocusRing(gfx::Canvas* canvas, 36 static void PaintMdFocusRing(gfx::Canvas* canvas,
36 View* view, 37 View* view,
37 int thickness, 38 int thickness,
38 SkAlpha alpha); 39 SkAlpha alpha);
39 40
40 void SetCallToAction(bool cta); 41 void SetCallToAction(bool cta);
42 void set_bg_color_override(SkColor color) { bg_color_override_ = color; }
41 43
42 // LabelButton: 44 // LabelButton:
43 void Layout() override; 45 void Layout() override;
44 void OnFocus() override; 46 void OnFocus() override;
45 void OnBlur() override; 47 void OnBlur() override;
46 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; 48 void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
47 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() 49 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight()
48 const override; 50 const override;
49 SkColor GetInkDropBaseColor() const override; 51 SkColor GetInkDropBaseColor() const override;
50 bool ShouldShowInkDropForFocus() const override; 52 bool ShouldShowInkDropForFocus() const override;
51 void SetEnabledTextColors(SkColor color) override; 53 void SetEnabledTextColors(SkColor color) override;
52 void UpdateStyleToIndicateDefaultStatus() override; 54 void UpdateStyleToIndicateDefaultStatus() override;
53 55
54 private: 56 private:
55 MdTextButton(ButtonListener* listener); 57 MdTextButton(ButtonListener* listener);
56 ~MdTextButton() override; 58 ~MdTextButton() override;
57 59
58 void UpdateColors(); 60 void UpdateColors();
59 61
60 // The MD-style focus ring. This is not done via a FocusPainter 62 // 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 63 // because it needs to paint to a layer so it can extend beyond the bounds of
62 // |this|. 64 // |this|.
63 internal::MdFocusRing* focus_ring_; 65 internal::MdFocusRing* focus_ring_;
64 66
65 // True if this button uses call-to-action styling. 67 // True if this button uses call-to-action styling.
66 bool is_cta_; 68 bool is_cta_;
67 69
70 // When set, this provides the background color.
71 base::Optional<SkColor> bg_color_override_;
72
68 DISALLOW_COPY_AND_ASSIGN(MdTextButton); 73 DISALLOW_COPY_AND_ASSIGN(MdTextButton);
69 }; 74 };
70 75
71 } // namespace views 76 } // namespace views
72 77
73 #endif // UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_ 78 #endif // UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698