| 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 "chrome/browser/ui/views/harmony/harmony_typography_provider.h" | 5 #include "chrome/browser/ui/views/harmony/harmony_typography_provider.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/views/harmony/chrome_typography.h" | 7 #include "chrome/browser/ui/views/harmony/chrome_typography.h" |
| 8 #include "ui/base/resource/resource_bundle.h" | 8 #include "ui/base/resource/resource_bundle.h" |
| 9 #include "ui/gfx/color_palette.h" | 9 #include "ui/gfx/color_palette.h" |
| 10 #include "ui/gfx/platform_font.h" | 10 #include "ui/gfx/platform_font.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 const SkColor foreground_color = | 59 const SkColor foreground_color = |
| 60 theme.GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor); | 60 theme.GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor); |
| 61 | 61 |
| 62 // If the default foreground color from the native theme isn't black, the rest | 62 // If the default foreground color from the native theme isn't black, the rest |
| 63 // of the Harmony spec isn't going to work. TODO(tapted): Something more | 63 // of the Harmony spec isn't going to work. TODO(tapted): Something more |
| 64 // generic would be nice here, but that requires knowing the background color | 64 // generic would be nice here, but that requires knowing the background color |
| 65 // for the text. At the time of writing, very few UI surfaces need native- | 65 // for the text. At the time of writing, very few UI surfaces need native- |
| 66 // themed typography with a custom native theme. Typically just incognito | 66 // themed typography with a custom native theme. Typically just incognito |
| 67 // browser windows, when the native theme is NativeThemeDarkAura. | 67 // browser windows, when the native theme is NativeThemeDarkAura. |
| 68 if (foreground_color != SK_ColorBLACK) { | 68 if (foreground_color != SK_ColorBLACK) { |
| 69 if (context == views::style::CONTEXT_TEXTFIELD) { |
| 70 return theme.GetSystemColor( |
| 71 style == views::style::STYLE_DISABLED |
| 72 ? ui::NativeTheme::kColorId_TextfieldReadOnlyColor |
| 73 : ui::NativeTheme::kColorId_TextfieldDefaultColor); |
| 74 } |
| 69 switch (style) { | 75 switch (style) { |
| 70 case views::style::STYLE_DISABLED: | 76 case views::style::STYLE_DISABLED: |
| 71 case STYLE_SECONDARY: | 77 case STYLE_SECONDARY: |
| 72 case STYLE_HINT: | 78 case STYLE_HINT: |
| 73 return theme.GetSystemColor( | 79 return theme.GetSystemColor( |
| 74 ui::NativeTheme::kColorId_LabelDisabledColor); | 80 ui::NativeTheme::kColorId_LabelDisabledColor); |
| 75 case views::style::STYLE_LINK: | 81 case views::style::STYLE_LINK: |
| 76 return theme.GetSystemColor(ui::NativeTheme::kColorId_LinkEnabled); | 82 return theme.GetSystemColor(ui::NativeTheme::kColorId_LinkEnabled); |
| 77 case STYLE_RED: | 83 case STYLE_RED: |
| 78 return foreground_color == SK_ColorWHITE ? gfx::kGoogleRed300 | 84 return foreground_color == SK_ColorWHITE ? gfx::kGoogleRed300 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 case views::style::CONTEXT_DIALOG_TITLE: | 168 case views::style::CONTEXT_DIALOG_TITLE: |
| 163 return title_height; | 169 return title_height; |
| 164 case CONTEXT_BODY_TEXT_LARGE: | 170 case CONTEXT_BODY_TEXT_LARGE: |
| 165 return body_large_height; | 171 return body_large_height; |
| 166 case CONTEXT_HEADLINE: | 172 case CONTEXT_HEADLINE: |
| 167 return headline_height; | 173 return headline_height; |
| 168 default: | 174 default: |
| 169 return default_height; | 175 return default_height; |
| 170 } | 176 } |
| 171 } | 177 } |
| OLD | NEW |