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

Side by Side Diff: chrome/browser/ui/views/harmony/chrome_typography.cc

Issue 2904823002: Inactive toast ux changes (Closed)
Patch Set: Review / style fixes Created 3 years, 5 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 "chrome/browser/ui/views/harmony/chrome_typography.h" 5 #include "chrome/browser/ui/views/harmony/chrome_typography.h"
6 6
7 #include "ui/base/default_style.h" 7 #include "ui/base/default_style.h"
8 #include "ui/base/resource/resource_bundle.h" 8 #include "ui/base/resource/resource_bundle.h"
9 #include "ui/gfx/platform_font.h"
10
11 void ApplyCommonFontStyles(int context,
12 int style,
13 int* size_delta,
14 gfx::Font::Weight* weight) {
15 if (context == CONTEXT_WINDOWS10_NATIVE) {
16 *size_delta = 15 - gfx::PlatformFont::kDefaultBaseFontSize;
17 *weight = views::TypographyProvider::WeightNotLighterThanNormal(
18 gfx::Font::Weight::MEDIUM);
19 }
20 }
9 21
10 const gfx::FontList& LegacyTypographyProvider::GetFont(int context, 22 const gfx::FontList& LegacyTypographyProvider::GetFont(int context,
11 int style) const { 23 int style) const {
12 constexpr int kHeadlineDelta = 8; 24 constexpr int kHeadlineDelta = 8;
13 constexpr int kDialogMessageDelta = 1; 25 constexpr int kDialogMessageDelta = 1;
14 26
15 int size_delta; 27 int size_delta;
16 gfx::Font::Weight font_weight; 28 gfx::Font::Weight font_weight;
17 GetDefaultFont(context, style, &size_delta, &font_weight); 29 GetDefaultFont(context, style, &size_delta, &font_weight);
18 30
19 #if defined(USE_ASH) 31 #if defined(USE_ASH)
20 ash::ApplyAshFontStyles(context, style, &size_delta, &font_weight); 32 ash::ApplyAshFontStyles(context, style, &size_delta, &font_weight);
21 #endif 33 #endif
22 34
35 ApplyCommonFontStyles(context, style, &size_delta, &font_weight);
36
23 switch (context) { 37 switch (context) {
24 case CONTEXT_HEADLINE: 38 case CONTEXT_HEADLINE:
25 size_delta = kHeadlineDelta; 39 size_delta = kHeadlineDelta;
26 break; 40 break;
27 case CONTEXT_BODY_TEXT_LARGE: 41 case CONTEXT_BODY_TEXT_LARGE:
28 // Note: Not using ui::kMessageFontSizeDelta, so 13pt in most cases. 42 // Note: Not using ui::kMessageFontSizeDelta, so 13pt in most cases.
29 size_delta = kDialogMessageDelta; 43 size_delta = kDialogMessageDelta;
30 break; 44 break;
31 case CONTEXT_BODY_TEXT_SMALL: 45 case CONTEXT_BODY_TEXT_SMALL:
32 size_delta = ui::kLabelFontSizeDelta; 46 size_delta = ui::kLabelFontSizeDelta;
(...skipping 15 matching lines...) Expand all
48 62
49 SkColor LegacyTypographyProvider::GetColor(int context, 63 SkColor LegacyTypographyProvider::GetColor(int context,
50 int style, 64 int style,
51 const ui::NativeTheme& theme) const { 65 const ui::NativeTheme& theme) const {
52 // Use "disabled grey" for HINT and SECONDARY when Harmony is disabled. 66 // Use "disabled grey" for HINT and SECONDARY when Harmony is disabled.
53 if (style == STYLE_HINT || style == STYLE_SECONDARY) 67 if (style == STYLE_HINT || style == STYLE_SECONDARY)
54 style = views::style::STYLE_DISABLED; 68 style = views::style::STYLE_DISABLED;
55 69
56 return DefaultTypographyProvider::GetColor(context, style, theme); 70 return DefaultTypographyProvider::GetColor(context, style, theme);
57 } 71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698