OLD | NEW |
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 Loading... |
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 return theme.GetSystemColor( |
| 56 (style == style::STYLE_DISABLED) |
| 57 ? ui::NativeTheme::kColorId_LabelDisabledColor |
| 58 : ui::NativeTheme::kColorId_LabelEnabledColor); |
52 } | 59 } |
53 | 60 |
54 int DefaultTypographyProvider::GetLineHeight(int context, int style) const { | 61 int DefaultTypographyProvider::GetLineHeight(int context, int style) const { |
55 return 0; | 62 return 0; |
56 } | 63 } |
57 | 64 |
58 // static | 65 // static |
59 void DefaultTypographyProvider::GetDefaultFont(int context, | 66 void DefaultTypographyProvider::GetDefaultFont(int context, |
60 int style, | 67 int style, |
61 int* size_delta, | 68 int* size_delta, |
(...skipping 26 matching lines...) Expand all Loading... |
88 *font_weight = GetValueBolderThan( | 95 *font_weight = GetValueBolderThan( |
89 ResourceBundle::GetSharedInstance() | 96 ResourceBundle::GetSharedInstance() |
90 .GetFontListWithDelta(*size_delta, Font::NORMAL, *font_weight) | 97 .GetFontListWithDelta(*size_delta, Font::NORMAL, *font_weight) |
91 .GetFontWeight()); | 98 .GetFontWeight()); |
92 } | 99 } |
93 break; | 100 break; |
94 } | 101 } |
95 } | 102 } |
96 | 103 |
97 } // namespace views | 104 } // namespace views |
OLD | NEW |