| 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/native_theme/native_theme.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 Font::Weight font_weight; | 45 Font::Weight font_weight; |
| 46 GetDefaultFont(context, style, &size_delta, &font_weight); | 46 GetDefaultFont(context, style, &size_delta, &font_weight); |
| 47 return ResourceBundle::GetSharedInstance().GetFontListWithDelta( | 47 return ResourceBundle::GetSharedInstance().GetFontListWithDelta( |
| 48 size_delta, Font::NORMAL, font_weight); | 48 size_delta, Font::NORMAL, font_weight); |
| 49 } | 49 } |
| 50 | 50 |
| 51 SkColor DefaultTypographyProvider::GetColor( | 51 SkColor DefaultTypographyProvider::GetColor( |
| 52 int context, | 52 int context, |
| 53 int style, | 53 int style, |
| 54 const ui::NativeTheme& theme) const { | 54 const ui::NativeTheme& theme) const { |
| 55 ui::NativeTheme::ColorId color_id = |
| 56 ui::NativeTheme::kColorId_LabelEnabledColor; |
| 55 if (context == style::CONTEXT_BUTTON_MD) { | 57 if (context == style::CONTEXT_BUTTON_MD) { |
| 56 ui::NativeTheme::ColorId color_id = | |
| 57 ui::NativeTheme::kColorId_ButtonEnabledColor; | |
| 58 switch (style) { | 58 switch (style) { |
| 59 case views::style::STYLE_DIALOG_BUTTON_DEFAULT: | 59 case views::style::STYLE_DIALOG_BUTTON_DEFAULT: |
| 60 color_id = ui::NativeTheme::kColorId_TextOnProminentButtonColor; | 60 color_id = ui::NativeTheme::kColorId_TextOnProminentButtonColor; |
| 61 break; | 61 break; |
| 62 case views::style::STYLE_DISABLED: | 62 case views::style::STYLE_DISABLED: |
| 63 color_id = ui::NativeTheme::kColorId_ButtonDisabledColor; | 63 color_id = ui::NativeTheme::kColorId_ButtonDisabledColor; |
| 64 break; | 64 break; |
| 65 default: |
| 66 color_id = ui::NativeTheme::kColorId_ButtonEnabledColor; |
| 67 break; |
| 65 } | 68 } |
| 66 return theme.GetSystemColor(color_id); | 69 } else if (context == style::CONTEXT_TEXTFIELD) { |
| 70 color_id = style == style::STYLE_DISABLED |
| 71 ? ui::NativeTheme::kColorId_TextfieldReadOnlyColor |
| 72 : ui::NativeTheme::kColorId_TextfieldDefaultColor; |
| 73 } else if (style == style::STYLE_DISABLED) { |
| 74 color_id = ui::NativeTheme::kColorId_LabelDisabledColor; |
| 67 } | 75 } |
| 68 | 76 return theme.GetSystemColor(color_id); |
| 69 return theme.GetSystemColor( | |
| 70 (style == style::STYLE_DISABLED) | |
| 71 ? ui::NativeTheme::kColorId_LabelDisabledColor | |
| 72 : ui::NativeTheme::kColorId_LabelEnabledColor); | |
| 73 } | 77 } |
| 74 | 78 |
| 75 int DefaultTypographyProvider::GetLineHeight(int context, int style) const { | 79 int DefaultTypographyProvider::GetLineHeight(int context, int style) const { |
| 76 return 0; | 80 return 0; |
| 77 } | 81 } |
| 78 | 82 |
| 79 // static | 83 // static |
| 80 void DefaultTypographyProvider::GetDefaultFont(int context, | 84 void DefaultTypographyProvider::GetDefaultFont(int context, |
| 81 int style, | 85 int style, |
| 82 int* size_delta, | 86 int* size_delta, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 109 *font_weight = GetValueBolderThan( | 113 *font_weight = GetValueBolderThan( |
| 110 ResourceBundle::GetSharedInstance() | 114 ResourceBundle::GetSharedInstance() |
| 111 .GetFontListWithDelta(*size_delta, Font::NORMAL, *font_weight) | 115 .GetFontListWithDelta(*size_delta, Font::NORMAL, *font_weight) |
| 112 .GetFontWeight()); | 116 .GetFontWeight()); |
| 113 } | 117 } |
| 114 break; | 118 break; |
| 115 } | 119 } |
| 116 } | 120 } |
| 117 | 121 |
| 118 } // namespace views | 122 } // namespace views |
| OLD | NEW |