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

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

Issue 2904823002: Inactive toast ux changes (Closed)
Patch Set: switch to vector icons. Simplify new button class as a function 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 9
10 const gfx::FontList& LegacyTypographyProvider::GetFont(int context, 10 const gfx::FontList& LegacyTypographyProvider::GetFont(int context,
11 int style) const { 11 int style) const {
12 constexpr int kHeadlineDelta = 8; 12 constexpr int kHeadlineDelta = 8;
13 constexpr int kDialogMessageDelta = 1; 13 constexpr int kDialogMessageDelta = 1;
14 14
15 int size_delta; 15 int size_delta;
16 gfx::Font::Weight font_weight; 16 gfx::Font::Weight font_weight;
17 GetDefaultFont(context, style, &size_delta, &font_weight); 17 GetDefaultFont(context, style, &size_delta, &font_weight);
18 18
19 #if defined(USE_ASH) 19 #if defined(USE_ASH)
20 ash::ApplyAshFontStyles(context, style, &size_delta, &font_weight); 20 ash::ApplyAshFontStyles(context, style, &size_delta, &font_weight);
21 #endif 21 #endif
22 22
23 ApplyCommonFontStyles(context, style, &size_delta, &font_weight);
24
23 switch (context) { 25 switch (context) {
24 case CONTEXT_HEADLINE: 26 case CONTEXT_HEADLINE:
25 size_delta = kHeadlineDelta; 27 size_delta = kHeadlineDelta;
26 break; 28 break;
27 case CONTEXT_BODY_TEXT_LARGE: 29 case CONTEXT_BODY_TEXT_LARGE:
28 // Note: Not using ui::kMessageFontSizeDelta, so 13pt in most cases. 30 // Note: Not using ui::kMessageFontSizeDelta, so 13pt in most cases.
29 size_delta = kDialogMessageDelta; 31 size_delta = kDialogMessageDelta;
30 break; 32 break;
31 case CONTEXT_BODY_TEXT_SMALL: 33 case CONTEXT_BODY_TEXT_SMALL:
32 size_delta = ui::kLabelFontSizeDelta; 34 size_delta = ui::kLabelFontSizeDelta;
33 break; 35 break;
34 case CONTEXT_DEPRECATED_SMALL: 36 case CONTEXT_DEPRECATED_SMALL:
35 size_delta = ui::ResourceBundle::kSmallFontDelta; 37 size_delta = ui::ResourceBundle::kSmallFontDelta;
36 break; 38 break;
37 } 39 }
38 40
39 switch (style) { 41 switch (style) {
40 case STYLE_EMPHASIZED: 42 case STYLE_EMPHASIZED:
41 font_weight = gfx::Font::Weight::BOLD; 43 font_weight = gfx::Font::Weight::BOLD;
42 break; 44 break;
43 } 45 }
44 constexpr gfx::Font::FontStyle kFontStyle = gfx::Font::NORMAL; 46 constexpr gfx::Font::FontStyle kFontStyle = gfx::Font::NORMAL;
45 return ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta( 47 return ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta(
46 size_delta, kFontStyle, font_weight); 48 size_delta, kFontStyle, font_weight);
47 } 49 }
48 50
51 // Sets the |size_delta| and |font_weight| for text that should not be affected
tapted 2017/07/07 03:32:19 nit: duplicate comment not required
skare_ 2017/07/21 03:11:35 Done.
52 // by the Harmony spec.
53 void ApplyCommonFontStyles(int context,
tapted 2017/07/07 03:32:19 nit: move to top of the file so it matches the dec
skare_ 2017/07/21 03:11:35 Done.
54 int style,
55 int* size_delta,
56 gfx::Font::Weight* weight) {
57 if (context == CONTEXT_WINDOWS10_NATIVE) {
58 *size_delta = 15 - gfx::PlatformFont::kDefaultBaseFontSize;
59 *weight = views::TypographyProvider::WeightNotLighterThanNormal(
60 gfx::Font::Weight::MEDIUM);
61 }
62 }
63
49 SkColor LegacyTypographyProvider::GetColor(int context, 64 SkColor LegacyTypographyProvider::GetColor(int context,
50 int style, 65 int style,
51 const ui::NativeTheme& theme) const { 66 const ui::NativeTheme& theme) const {
52 // Use "disabled grey" for HINT and SECONDARY when Harmony is disabled. 67 // Use "disabled grey" for HINT and SECONDARY when Harmony is disabled.
53 if (style == STYLE_HINT || style == STYLE_SECONDARY) 68 if (style == STYLE_HINT || style == STYLE_SECONDARY)
54 style = views::style::STYLE_DISABLED; 69 style = views::style::STYLE_DISABLED;
55 70
56 return DefaultTypographyProvider::GetColor(context, style, theme); 71 return DefaultTypographyProvider::GetColor(context, style, theme);
57 } 72 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698