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

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

Issue 2439873002: Make all text buttons on download shelf work well with themes, not just (Closed)
Patch Set: dont set bg 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
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"
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 ~MdTextButton() override;
28
27 // See |is_prominent_|. 29 // See |is_prominent_|.
28 void SetProminent(bool is_prominent); 30 void SetProminent(bool is_prominent);
29 31
30 // See |bg_color_override_|. 32 // See |bg_color_override_|.
31 void SetBgColorOverride(const base::Optional<SkColor>& color); 33 void SetBgColorOverride(const base::Optional<SkColor>& color);
32 34
33 // View: 35 // View:
34 void OnPaintBackground(gfx::Canvas* canvas) override; 36 void OnPaintBackground(gfx::Canvas* canvas) override;
35 37
36 // LabelButton: 38 // LabelButton:
(...skipping 10 matching lines...) Expand all
47 void AdjustFontSize(int size_delta) override; 49 void AdjustFontSize(int size_delta) override;
48 void UpdateStyleToIndicateDefaultStatus() override; 50 void UpdateStyleToIndicateDefaultStatus() override;
49 void StateChanged() override; 51 void StateChanged() override;
50 52
51 protected: 53 protected:
52 // LabelButton: 54 // LabelButton:
53 void SetFontList(const gfx::FontList& font_list) override; 55 void SetFontList(const gfx::FontList& font_list) override;
54 56
55 private: 57 private:
56 explicit MdTextButton(ButtonListener* listener); 58 explicit MdTextButton(ButtonListener* listener);
57 ~MdTextButton() override;
58 59
59 void UpdatePadding(); 60 void UpdatePadding();
60 void UpdateColors(); 61 void UpdateColors();
61 62
62 // True if this button uses prominent styling (blue fill, etc.). 63 // True if this button uses prominent styling (blue fill, etc.).
63 bool is_prominent_; 64 bool is_prominent_;
64 65
65 // When set, this provides the background color. 66 // When set, this provides the background color.
66 base::Optional<SkColor> bg_color_override_; 67 base::Optional<SkColor> bg_color_override_;
67 68
68 DISALLOW_COPY_AND_ASSIGN(MdTextButton); 69 DISALLOW_COPY_AND_ASSIGN(MdTextButton);
69 }; 70 };
70 71
71 } // namespace views 72 } // namespace views
72 73
73 #endif // UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_ 74 #endif // UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/download/download_shelf_view.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