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

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

Issue 2961223002: Rename native theme color constants relating to text on dialog buttons
Patch Set: rebase Created 3 years, 5 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 #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 "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "ui/base/material_design/material_design_controller.h" 9 #include "ui/base/material_design/material_design_controller.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 // TODO(estade): can we get rid of the platform style border hoopla if 228 // TODO(estade): can we get rid of the platform style border hoopla if
229 // we apply the MD treatment to all buttons, even GTK buttons? 229 // we apply the MD treatment to all buttons, even GTK buttons?
230 const int horizontal_padding = LayoutProvider::Get()->GetDistanceMetric( 230 const int horizontal_padding = LayoutProvider::Get()->GetDistanceMetric(
231 DISTANCE_BUTTON_HORIZONTAL_PADDING); 231 DISTANCE_BUTTON_HORIZONTAL_PADDING);
232 SetBorder(CreateEmptyBorder(top_padding, horizontal_padding, bottom_padding, 232 SetBorder(CreateEmptyBorder(top_padding, horizontal_padding, bottom_padding,
233 horizontal_padding)); 233 horizontal_padding));
234 } 234 }
235 235
236 void MdTextButton::UpdateColors() { 236 void MdTextButton::UpdateColors() {
237 ui::NativeTheme::ColorId fg_color_id = 237 ui::NativeTheme::ColorId fg_color_id =
238 is_prominent_ ? ui::NativeTheme::kColorId_TextOnProminentButtonColor 238 is_prominent_ ? ui::NativeTheme::kColorId_TextOnProminentDialogButton
239 : ui::NativeTheme::kColorId_ButtonEnabledColor; 239 : ui::NativeTheme::kColorId_TextOnEnabledDialogButton;
240 240
241 ui::NativeTheme* theme = GetNativeTheme(); 241 ui::NativeTheme* theme = GetNativeTheme();
242 if (!explicitly_set_normal_color()) { 242 if (!explicitly_set_normal_color()) {
243 const auto colors = explicitly_set_colors(); 243 const auto colors = explicitly_set_colors();
244 LabelButton::SetEnabledTextColors(theme->GetSystemColor(fg_color_id)); 244 LabelButton::SetEnabledTextColors(theme->GetSystemColor(fg_color_id));
245 set_explicitly_set_colors(colors); 245 set_explicitly_set_colors(colors);
246 } 246 }
247 247
248 // Prominent buttons keep their enabled text color; disabled state is conveyed 248 // Prominent buttons keep their enabled text color; disabled state is conveyed
249 // by shading the background instead. 249 // by shading the background instead.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 } 286 }
287 287
288 DCHECK_EQ(SK_AlphaOPAQUE, static_cast<int>(SkColorGetA(bg_color))); 288 DCHECK_EQ(SK_AlphaOPAQUE, static_cast<int>(SkColorGetA(bg_color)));
289 SetBackground( 289 SetBackground(
290 CreateBackgroundFromPainter(Painter::CreateRoundRectWith1PxBorderPainter( 290 CreateBackgroundFromPainter(Painter::CreateRoundRectWith1PxBorderPainter(
291 bg_color, stroke_color, kInkDropSmallCornerRadius))); 291 bg_color, stroke_color, kInkDropSmallCornerRadius)));
292 SchedulePaint(); 292 SchedulePaint();
293 } 293 }
294 294
295 } // namespace views 295 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/label_button_unittest.cc ('k') | ui/views/controls/tabbed_pane/tabbed_pane.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698