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

Side by Side Diff: ui/views/style/typography_provider.cc

Issue 2910153002: Remove views::Label::SetDisabledColor(). Replace with typography colors. (Closed)
Patch Set: Use STYLE_HINT more. Fix SadTab Created 3 years, 6 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/style/typography_provider.h" 5 #include "ui/views/style/typography_provider.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/base/default_style.h" 8 #include "ui/base/default_style.h"
9 #include "ui/base/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/native_theme/native_theme.h"
10 #include "ui/views/style/typography.h" 11 #include "ui/views/style/typography.h"
11 12
12 using gfx::Font; 13 using gfx::Font;
13 14
14 namespace views { 15 namespace views {
15 namespace { 16 namespace {
16 17
17 Font::Weight GetValueBolderThan(Font::Weight weight) { 18 Font::Weight GetValueBolderThan(Font::Weight weight) {
18 switch (weight) { 19 switch (weight) {
19 case Font::Weight::BOLD: 20 case Font::Weight::BOLD:
(...skipping 20 matching lines...) Expand all
40 41
41 const gfx::FontList& DefaultTypographyProvider::GetFont(int context, 42 const gfx::FontList& DefaultTypographyProvider::GetFont(int context,
42 int style) const { 43 int style) const {
43 int size_delta; 44 int size_delta;
44 Font::Weight font_weight; 45 Font::Weight font_weight;
45 GetDefaultFont(context, style, &size_delta, &font_weight); 46 GetDefaultFont(context, style, &size_delta, &font_weight);
46 return ResourceBundle::GetSharedInstance().GetFontListWithDelta( 47 return ResourceBundle::GetSharedInstance().GetFontListWithDelta(
47 size_delta, Font::NORMAL, font_weight); 48 size_delta, Font::NORMAL, font_weight);
48 } 49 }
49 50
50 SkColor DefaultTypographyProvider::GetColor(int context, int style) const { 51 SkColor DefaultTypographyProvider::GetColor(
51 return SK_ColorBLACK; 52 int context,
53 int style,
54 const ui::NativeTheme& theme) const {
55 switch (style) {
56 case style::STYLE_DISABLED:
57 return theme.GetSystemColor(ui::NativeTheme::kColorId_LabelDisabledColor);
58 }
59
60 return theme.GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor);
Peter Kasting 2017/06/01 04:55:58 Nit: Simpler: return theme.GetSystemColor(
tapted 2017/06/01 11:22:18 Done.
52 } 61 }
53 62
54 int DefaultTypographyProvider::GetLineHeight(int context, int style) const { 63 int DefaultTypographyProvider::GetLineHeight(int context, int style) const {
55 return 0; 64 return 0;
56 } 65 }
57 66
58 // static 67 // static
59 void DefaultTypographyProvider::GetDefaultFont(int context, 68 void DefaultTypographyProvider::GetDefaultFont(int context,
60 int style, 69 int style,
61 int* size_delta, 70 int* size_delta,
(...skipping 26 matching lines...) Expand all
88 *font_weight = GetValueBolderThan( 97 *font_weight = GetValueBolderThan(
89 ResourceBundle::GetSharedInstance() 98 ResourceBundle::GetSharedInstance()
90 .GetFontListWithDelta(*size_delta, Font::NORMAL, *font_weight) 99 .GetFontListWithDelta(*size_delta, Font::NORMAL, *font_weight)
91 .GetFontWeight()); 100 .GetFontWeight());
92 } 101 }
93 break; 102 break;
94 } 103 }
95 } 104 }
96 105
97 } // namespace views 106 } // namespace views
OLDNEW
« ui/views/style/typography_provider.h ('K') | « ui/views/style/typography_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698