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 #ifndef CHROME_BROWSER_UI_VIEWS_HARMONY_CHROME_TYPOGRAPHY_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_HARMONY_CHROME_TYPOGRAPHY_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_HARMONY_CHROME_TYPOGRAPHY_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_HARMONY_CHROME_TYPOGRAPHY_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/gfx/font.h" |
9 #include "ui/views/style/typography.h" | 10 #include "ui/views/style/typography.h" |
10 #include "ui/views/style/typography_provider.h" | 11 #include "ui/views/style/typography_provider.h" |
11 | 12 |
12 #if defined(USE_ASH) | 13 #if defined(USE_ASH) |
13 #include "ash/public/cpp/ash_typography.h" // nogncheck | 14 #include "ash/public/cpp/ash_typography.h" // nogncheck |
14 #endif | 15 #endif |
15 | 16 |
16 enum ChromeTextContext { | 17 enum ChromeTextContext { |
17 #if defined(USE_ASH) | 18 #if defined(USE_ASH) |
18 CHROME_TEXT_CONTEXT_START = ash::ASH_TEXT_CONTEXT_END, | 19 CHROME_TEXT_CONTEXT_START = ash::ASH_TEXT_CONTEXT_END, |
19 #else | 20 #else |
20 CHROME_TEXT_CONTEXT_START = views::style::VIEWS_TEXT_CONTEXT_END, | 21 CHROME_TEXT_CONTEXT_START = views::style::VIEWS_TEXT_CONTEXT_END, |
21 #endif | 22 #endif |
22 | 23 |
23 // Headline text. Usually 20pt. Never multi-line. | 24 // Headline text. Usually 20pt. Never multi-line. |
24 CONTEXT_HEADLINE = CHROME_TEXT_CONTEXT_START, | 25 CONTEXT_HEADLINE = CHROME_TEXT_CONTEXT_START, |
25 | 26 |
26 // "Body 1". Usually 13pt. | 27 // "Body 1". Usually 13pt. |
27 CONTEXT_BODY_TEXT_LARGE, | 28 CONTEXT_BODY_TEXT_LARGE, |
28 | 29 |
29 // "Body 2". Usually 12pt. | 30 // "Body 2". Usually 12pt. |
30 CONTEXT_BODY_TEXT_SMALL, | 31 CONTEXT_BODY_TEXT_SMALL, |
31 | 32 |
| 33 // Text for titles, body text and buttons that appear in dialogs attempting to |
| 34 // mimic the native Windows 10 look and feel. |
| 35 CONTEXT_WINDOWS10_NATIVE, |
| 36 |
32 // ResourceBundle::SmallFont (11 pt). There is no equivalent in the Harmony | 37 // ResourceBundle::SmallFont (11 pt). There is no equivalent in the Harmony |
33 // spec, so new code should not be using this. It is only provided to avoid | 38 // spec, so new code should not be using this. It is only provided to avoid |
34 // changing existing UI and it will eventually be removed. | 39 // changing existing UI and it will eventually be removed. |
35 CONTEXT_DEPRECATED_SMALL, | 40 CONTEXT_DEPRECATED_SMALL, |
36 }; | 41 }; |
37 | 42 |
38 enum ChromeTextStyle { | 43 enum ChromeTextStyle { |
39 CHROME_TEXT_STYLE_START = views::style::VIEWS_TEXT_STYLE_END, | 44 CHROME_TEXT_STYLE_START = views::style::VIEWS_TEXT_STYLE_END, |
40 | 45 |
41 // Secondary text. May be lighter than views::style::PRIMARY. | 46 // Secondary text. May be lighter than views::style::PRIMARY. |
42 STYLE_SECONDARY = CHROME_TEXT_STYLE_START, | 47 STYLE_SECONDARY = CHROME_TEXT_STYLE_START, |
43 | 48 |
44 // "Hint" text, usually a line that gives context to something more important. | 49 // "Hint" text, usually a line that gives context to something more important. |
45 STYLE_HINT, | 50 STYLE_HINT, |
46 | 51 |
47 // A solid shade of red. | 52 // A solid shade of red. |
48 STYLE_RED, | 53 STYLE_RED, |
49 | 54 |
50 // A solid shade of green. | 55 // A solid shade of green. |
51 STYLE_GREEN, | 56 STYLE_GREEN, |
52 | 57 |
53 // Used to draw attention to a section of body text such as an extension name | 58 // Used to draw attention to a section of body text such as an extension name |
54 // or hostname. | 59 // or hostname. |
55 STYLE_EMPHASIZED, | 60 STYLE_EMPHASIZED, |
56 }; | 61 }; |
57 | 62 |
| 63 // Sets the |size_delta| and |font_weight| for text that should not be affected |
| 64 // by the Harmony spec. |
| 65 void ApplyCommonFontStyles(int context, |
| 66 int style, |
| 67 int* size_delta, |
| 68 gfx::Font::Weight* weight); |
| 69 |
58 // TypographyProvider that provides pre-Harmony fonts in Chrome. | 70 // TypographyProvider that provides pre-Harmony fonts in Chrome. |
59 class LegacyTypographyProvider : public views::DefaultTypographyProvider { | 71 class LegacyTypographyProvider : public views::DefaultTypographyProvider { |
60 public: | 72 public: |
61 LegacyTypographyProvider() = default; | 73 LegacyTypographyProvider() = default; |
62 | 74 |
63 // DefaultTypographyProvider: | 75 // DefaultTypographyProvider: |
64 const gfx::FontList& GetFont(int context, int style) const override; | 76 const gfx::FontList& GetFont(int context, int style) const override; |
65 SkColor GetColor(int context, | 77 SkColor GetColor(int context, |
66 int style, | 78 int style, |
67 const ui::NativeTheme& theme) const override; | 79 const ui::NativeTheme& theme) const override; |
68 | 80 |
69 private: | 81 private: |
70 DISALLOW_COPY_AND_ASSIGN(LegacyTypographyProvider); | 82 DISALLOW_COPY_AND_ASSIGN(LegacyTypographyProvider); |
71 }; | 83 }; |
72 | 84 |
73 #endif // CHROME_BROWSER_UI_VIEWS_HARMONY_CHROME_TYPOGRAPHY_H_ | 85 #endif // CHROME_BROWSER_UI_VIEWS_HARMONY_CHROME_TYPOGRAPHY_H_ |
OLD | NEW |