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

Unified Diff: ui/views/controls/button/md_text_button.cc

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: new fn name 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/button/md_text_button.h ('k') | ui/views/window/dialog_client_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/md_text_button.cc
diff --git a/ui/views/controls/button/md_text_button.cc b/ui/views/controls/button/md_text_button.cc
index d00b0e0344f640ced5a1bb95f208ca009d2f5237..4f38188c47a507db70b468b8e0a818b6e9966021 100644
--- a/ui/views/controls/button/md_text_button.cc
+++ b/ui/views/controls/button/md_text_button.cc
@@ -23,19 +23,34 @@ const int kVerticalPadding = 6;
// Minimum size to reserve for the button contents.
const int kMinWidth = 48;
+LabelButton* CreateButton(ButtonListener* listener,
+ const base::string16& text,
+ bool md) {
+ if (md)
+ return MdTextButton::CreateMdButton(listener, text);
+
+ LabelButton* button = new LabelButton(listener, text);
+ button->SetStyle(CustomButton::STYLE_BUTTON);
+ return button;
+}
+
} // namespace
// static
LabelButton* MdTextButton::CreateStandardButton(ButtonListener* listener,
const base::string16& text) {
- if (ui::MaterialDesignController::IsModeMaterial())
- return CreateMdButton(listener, text);
+ return CreateButton(listener, text,
+ ui::MaterialDesignController::IsModeMaterial());
+}
- LabelButton* button = new LabelButton(listener, text);
- button->SetStyle(STYLE_BUTTON);
- return button;
+// static
+LabelButton* MdTextButton::CreateSecondaryUiButton(ButtonListener* listener,
+ const base::string16& text) {
+ return CreateButton(listener, text,
+ ui::MaterialDesignController::IsSecondaryUiMaterial());
}
+// static
MdTextButton* MdTextButton::CreateMdButton(ButtonListener* listener,
const base::string16& text) {
MdTextButton* button = new MdTextButton(listener);
@@ -69,6 +84,15 @@ void MdTextButton::SetText(const base::string16& text) {
LabelButton::SetText(base::i18n::ToUpper(text));
}
+void MdTextButton::UpdateStyleToIndicateDefaultStatus() {
+ // Update the call to action state to reflect defaultness. Don't change strong
+ // call to action to weak.
+ if (!is_default())
+ SetCallToAction(NO_CALL_TO_ACTION);
+ else if (cta_ == NO_CALL_TO_ACTION)
+ SetCallToAction(WEAK_CALL_TO_ACTION);
+}
+
MdTextButton::MdTextButton(ButtonListener* listener)
: LabelButton(listener, base::string16()),
ink_drop_delegate_(this, this),
« no previous file with comments | « ui/views/controls/button/md_text_button.h ('k') | ui/views/window/dialog_client_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698