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

Unified Diff: chrome/browser/ui/views/harmony/chrome_typography.cc

Issue 2910153002: Remove views::Label::SetDisabledColor(). Replace with typography colors. (Closed)
Patch Set: rebase for r476345 Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/harmony/chrome_typography.cc
diff --git a/chrome/browser/ui/views/harmony/chrome_typography.cc b/chrome/browser/ui/views/harmony/chrome_typography.cc
index 5fc70512a2245318d268b10dda05f7a2aed41e19..ddeb5633bdc94e94bf998639715c87dd7556a9c1 100644
--- a/chrome/browser/ui/views/harmony/chrome_typography.cc
+++ b/chrome/browser/ui/views/harmony/chrome_typography.cc
@@ -7,20 +7,20 @@
#include "ui/base/default_style.h"
#include "ui/base/resource/resource_bundle.h"
-const gfx::FontList& LegacyTypographyProvider::GetFont(int text_context,
- int text_style) const {
+const gfx::FontList& LegacyTypographyProvider::GetFont(int context,
+ int style) const {
constexpr int kHeadlineDelta = 8;
constexpr int kDialogMessageDelta = 1;
int size_delta;
gfx::Font::Weight font_weight;
- GetDefaultFont(text_context, text_style, &size_delta, &font_weight);
+ GetDefaultFont(context, style, &size_delta, &font_weight);
#if defined(USE_ASH)
- ash::ApplyAshFontStyles(text_context, text_style, &size_delta, &font_weight);
+ ash::ApplyAshFontStyles(context, style, &size_delta, &font_weight);
#endif
- switch (text_context) {
+ switch (context) {
case CONTEXT_HEADLINE:
size_delta = kHeadlineDelta;
break;
@@ -36,7 +36,7 @@ const gfx::FontList& LegacyTypographyProvider::GetFont(int text_context,
break;
}
- switch (text_style) {
+ switch (style) {
case STYLE_EMPHASIZED:
font_weight = gfx::Font::Weight::BOLD;
break;
@@ -45,3 +45,13 @@ const gfx::FontList& LegacyTypographyProvider::GetFont(int text_context,
return ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta(
size_delta, kFontStyle, font_weight);
}
+
+SkColor LegacyTypographyProvider::GetColor(int context,
+ int style,
+ const ui::NativeTheme& theme) const {
+ // Use "disabled grey" for HINT and SECONDARY when Harmony is disabled.
+ if (style == STYLE_HINT || style == STYLE_SECONDARY)
+ style = views::style::STYLE_DISABLED;
+
+ return DefaultTypographyProvider::GetColor(context, style, theme);
+}

Powered by Google App Engine
This is Rietveld 408576698