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

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

Issue 1958453002: Update some secondary UI buttons to MD style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: msw review 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
« no previous file with comments | « ui/views/controls/button/label_button.h ('k') | no next file » | 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 #include "ui/views/controls/button/md_text_button.h" 5 #include "ui/views/controls/button/md_text_button.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "ui/base/material_design/material_design_controller.h" 8 #include "ui/base/material_design/material_design_controller.h"
9 #include "ui/gfx/color_utils.h" 9 #include "ui/gfx/color_utils.h"
10 #include "ui/native_theme/native_theme.h" 10 #include "ui/native_theme/native_theme.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 UseMdFocusRing(); 106 UseMdFocusRing();
107 label()->SetAutoColorReadabilityEnabled(false); 107 label()->SetAutoColorReadabilityEnabled(false);
108 } 108 }
109 109
110 MdTextButton::~MdTextButton() {} 110 MdTextButton::~MdTextButton() {}
111 111
112 void MdTextButton::UpdateColorsFromNativeTheme() { 112 void MdTextButton::UpdateColorsFromNativeTheme() {
113 ui::NativeTheme::ColorId fg_color_id = ui::NativeTheme::kColorId_NumColors; 113 ui::NativeTheme::ColorId fg_color_id = ui::NativeTheme::kColorId_NumColors;
114 switch (cta_) { 114 switch (cta_) {
115 case NO_CALL_TO_ACTION: 115 case NO_CALL_TO_ACTION:
116 fg_color_id = ui::NativeTheme::kColorId_ButtonEnabledColor; 116 // When there's no call to action, respect a color override if one has
117 // been set. For other call to action states, don't let individual buttons
118 // specify a color.
119 if (!explicitly_set_normal_color())
120 fg_color_id = ui::NativeTheme::kColorId_ButtonEnabledColor;
117 break; 121 break;
118 case WEAK_CALL_TO_ACTION: 122 case WEAK_CALL_TO_ACTION:
119 fg_color_id = ui::NativeTheme::kColorId_CallToActionColor; 123 fg_color_id = ui::NativeTheme::kColorId_CallToActionColor;
120 break; 124 break;
121 case STRONG_CALL_TO_ACTION: 125 case STRONG_CALL_TO_ACTION:
122 fg_color_id = ui::NativeTheme::kColorId_TextOnCallToActionColor; 126 fg_color_id = ui::NativeTheme::kColorId_TextOnCallToActionColor;
123 break; 127 break;
124 } 128 }
125 ui::NativeTheme* theme = GetNativeTheme(); 129 ui::NativeTheme* theme = GetNativeTheme();
126 SetEnabledTextColors(theme->GetSystemColor(fg_color_id)); 130 if (fg_color_id != ui::NativeTheme::kColorId_NumColors)
131 SetEnabledTextColors(theme->GetSystemColor(fg_color_id));
127 132
128 set_background( 133 set_background(
129 cta_ == STRONG_CALL_TO_ACTION 134 cta_ == STRONG_CALL_TO_ACTION
130 ? Background::CreateBackgroundPainter( 135 ? Background::CreateBackgroundPainter(
131 true, Painter::CreateSolidRoundRectPainter( 136 true, Painter::CreateSolidRoundRectPainter(
132 theme->GetSystemColor( 137 theme->GetSystemColor(
133 ui::NativeTheme::kColorId_CallToActionColor), 138 ui::NativeTheme::kColorId_CallToActionColor),
134 kInkDropSmallCornerRadius)) 139 kInkDropSmallCornerRadius))
135 : nullptr); 140 : nullptr);
136 } 141 }
137 142
138 } // namespace views 143 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/label_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698