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

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

Issue 1926943002: Introduce new flag to control usage of MD in secondary (not top-chrome) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: improve docs Created 4 years, 7 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 "ui/views/animation/button_ink_drop_delegate.h" 10 #include "ui/views/animation/button_ink_drop_delegate.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 // Describes the presentation of a button. A stronger call to action draws 18 // Describes the presentation of a button. A stronger call to action draws
19 // more attention. 19 // more attention.
20 enum CallToAction { 20 enum CallToAction {
21 NO_CALL_TO_ACTION, // Default. 21 NO_CALL_TO_ACTION, // Default.
22 WEAK_CALL_TO_ACTION, 22 WEAK_CALL_TO_ACTION,
23 STRONG_CALL_TO_ACTION, 23 STRONG_CALL_TO_ACTION,
24 }; 24 };
25 25
26 // Creates a normal STYLE_BUTTON LabelButton in pre-MD, or an MdTextButton 26 // Creates a normal STYLE_BUTTON LabelButton in pre-MD, or an MdTextButton
27 // in MD mode. 27 // in MD mode.
28 static LabelButton* CreateStandardButton(ButtonListener* listener, 28 static LabelButton* CreateStandardButton(ButtonListener* listener,
29 const base::string16& text); 29 const base::string16& text);
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).
32 static LabelButton* CreateSecondaryUiButton(ButtonListener* listener,
33 const base::string16& text);
30 static MdTextButton* CreateMdButton(ButtonListener* listener, 34 static MdTextButton* CreateMdButton(ButtonListener* listener,
31 const base::string16& text); 35 const base::string16& text);
32 36
33 void SetCallToAction(CallToAction cta); 37 void SetCallToAction(CallToAction cta);
34 38
35 // LabelButton: 39 // LabelButton:
36 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; 40 void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
37 SkColor GetInkDropBaseColor() const override; 41 SkColor GetInkDropBaseColor() const override;
38 void SetText(const base::string16& text) override; 42 void SetText(const base::string16& text) override;
43 void UpdateStyleForDefaultness() override;
39 44
40 private: 45 private:
41 MdTextButton(ButtonListener* listener); 46 MdTextButton(ButtonListener* listener);
42 ~MdTextButton() override; 47 ~MdTextButton() override;
43 48
44 void UpdateColorsFromNativeTheme(); 49 void UpdateColorsFromNativeTheme();
45 50
46 ButtonInkDropDelegate ink_drop_delegate_; 51 ButtonInkDropDelegate ink_drop_delegate_;
47 52
48 // The call to action style for this button. 53 // The call to action style for this button.
49 CallToAction cta_; 54 CallToAction cta_;
50 55
51 DISALLOW_COPY_AND_ASSIGN(MdTextButton); 56 DISALLOW_COPY_AND_ASSIGN(MdTextButton);
52 }; 57 };
53 58
54 } // namespace views 59 } // namespace views
55 60
56 #endif // UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_ 61 #endif // UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698