OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/themes/theme_properties.h" | 5 #include "chrome/browser/themes/theme_properties.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "chrome/browser/themes/browser_theme_pack.h" | 13 #include "chrome/browser/themes/browser_theme_pack.h" |
14 #include "chrome/grit/theme_resources.h" | 14 #include "chrome/grit/theme_resources.h" |
15 #include "ui/base/material_design/material_design_controller.h" | 15 #include "ui/base/material_design/material_design_controller.h" |
16 #include "ui/gfx/color_palette.h" | 16 #include "ui/gfx/color_palette.h" |
17 #include "ui/resources/grit/ui_resources.h" | 17 #include "ui/resources/grit/ui_resources.h" |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 // ---------------------------------------------------------------------------- | 21 // ---------------------------------------------------------------------------- |
22 // Defaults for properties which are stored in the browser theme pack. If you | 22 // Defaults for properties which are stored in the browser theme pack. If you |
23 // change these defaults, you must increment the version number in | 23 // change these defaults, you must increment the version number in |
24 // browser_theme_pack.cc. | 24 // browser_theme_pack.cc. |
25 | 25 |
26 const SkColor kDefaultColorFrame = SkColorSetRGB(0xCC, 0xCC, 0xCC); | 26 const SkColor kDefaultColorFrame = SkColorSetRGB(0xCC, 0xCC, 0xCC); |
27 #if defined(OS_MACOSX) | |
28 // Used for theme fallback colors. | |
29 const SkColor kDefaultColorFrameInactive = SkColorSetRGB(0xF6, 0xF6, 0xF6); | |
30 #else | |
31 const SkColor kDefaultColorFrameInactive = SkColorSetRGB(0xDC, 0xDC, 0xDC); | |
32 #endif | |
33 | 27 |
34 #if defined(OS_MACOSX) | 28 #if defined(OS_MACOSX) |
35 const SkColor kDefaultColorFrameIncognito = | 29 const SkColor kDefaultColorFrameIncognito = |
36 SkColorSetARGB(0xE6, 0x14, 0x16, 0x18); | 30 SkColorSetARGB(0xE6, 0x14, 0x16, 0x18); |
37 const SkColor kDefaultColorFrameIncognitoInactive = | 31 const SkColor kDefaultColorFrameIncognitoInactiveMac = |
38 SkColorSetRGB(0x1E, 0x1E, 0x1E); | 32 SkColorSetRGB(0x1E, 0x1E, 0x1E); |
39 #else | 33 #else |
40 const SkColor kDefaultColorFrameIncognito = SkColorSetRGB(0x28, 0x2B, 0x2D); | 34 const SkColor kDefaultColorFrameIncognito = SkColorSetRGB(0x28, 0x2B, 0x2D); |
41 const SkColor kDefaultColorFrameIncognitoInactive = | |
42 SkColorSetRGB(0x38, 0x3B, 0x3D); | |
43 #endif | 35 #endif |
44 | 36 |
45 const SkColor kDefaultColorToolbar = SkColorSetRGB(0xF2, 0xF2, 0xF2); | 37 const SkColor kDefaultColorToolbar = SkColorSetRGB(0xF2, 0xF2, 0xF2); |
46 const SkColor kDefaultColorToolbarIncognito = SkColorSetRGB(0x50, 0x50, 0x50); | 38 const SkColor kDefaultColorToolbarIncognito = SkColorSetRGB(0x50, 0x50, 0x50); |
47 | 39 |
48 const SkColor kDefaultDetachedBookmarkBarBackground = SK_ColorWHITE; | 40 const SkColor kDefaultDetachedBookmarkBarBackground = SK_ColorWHITE; |
49 const SkColor kDefaultDetachedBookmarkBarBackgroundIncognito = | 41 const SkColor kDefaultDetachedBookmarkBarBackgroundIncognito = |
50 SkColorSetRGB(0x32, 0x32, 0x32); | 42 SkColorSetRGB(0x32, 0x32, 0x32); |
51 | 43 |
52 // "Toolbar" text is used for active tabs and the bookmarks bar. | 44 // "Toolbar" text is used for active tabs and the bookmarks bar. |
(...skipping 23 matching lines...) Expand all Loading... |
76 const SkColor kDefaultColorNTPHeader = SkColorSetRGB(0x96, 0x96, 0x96); | 68 const SkColor kDefaultColorNTPHeader = SkColorSetRGB(0x96, 0x96, 0x96); |
77 const SkColor kDefaultColorNTPSection = SkColorSetRGB(0xE5, 0xE5, 0xE5); | 69 const SkColor kDefaultColorNTPSection = SkColorSetRGB(0xE5, 0xE5, 0xE5); |
78 constexpr SkColor kDefaultColorNTPSectionText = SK_ColorBLACK; | 70 constexpr SkColor kDefaultColorNTPSectionText = SK_ColorBLACK; |
79 const SkColor kDefaultColorNTPSectionLink = SkColorSetRGB(0x06, 0x37, 0x74); | 71 const SkColor kDefaultColorNTPSectionLink = SkColorSetRGB(0x06, 0x37, 0x74); |
80 constexpr SkColor kDefaultColorButtonBackground = SK_ColorTRANSPARENT; | 72 constexpr SkColor kDefaultColorButtonBackground = SK_ColorTRANSPARENT; |
81 | 73 |
82 // Default tints. | 74 // Default tints. |
83 constexpr color_utils::HSL kDefaultTintButtons = {-1, -1, -1}; | 75 constexpr color_utils::HSL kDefaultTintButtons = {-1, -1, -1}; |
84 constexpr color_utils::HSL kDefaultTintButtonsIncognito = {-1, -1, 0.85}; | 76 constexpr color_utils::HSL kDefaultTintButtonsIncognito = {-1, -1, 0.85}; |
85 constexpr color_utils::HSL kDefaultTintFrame = {-1, -1, -1}; | 77 constexpr color_utils::HSL kDefaultTintFrame = {-1, -1, -1}; |
86 constexpr color_utils::HSL kDefaultTintFrameInactive = {-1, -1, 0.75}; | 78 constexpr color_utils::HSL kDefaultTintFrameInactive = {-1, -1, 0.9}; |
87 constexpr color_utils::HSL kDefaultTintFrameIncognito = {-1, 0.2, 0.35}; | 79 constexpr color_utils::HSL kDefaultTintFrameIncognito = {-1, 0.2, 0.35}; |
88 constexpr color_utils::HSL kDefaultTintFrameIncognitoInactive = {-1, 0.3, 0.6}; | 80 constexpr color_utils::HSL kDefaultTintFrameIncognitoInactive = {-1, 0.2, 0.87}; |
89 constexpr color_utils::HSL kDefaultTintBackgroundTab = {-1, -1, 0.75}; | 81 constexpr color_utils::HSL kDefaultTintBackgroundTab = {-1, -1, 0.75}; |
90 | 82 |
91 // ---------------------------------------------------------------------------- | 83 // ---------------------------------------------------------------------------- |
92 // Defaults for properties which are not stored in the browser theme pack. | 84 // Defaults for properties which are not stored in the browser theme pack. |
93 | 85 |
94 constexpr SkColor kDefaultColorControlBackground = SK_ColorWHITE; | 86 constexpr SkColor kDefaultColorControlBackground = SK_ColorWHITE; |
95 const SkColor kDefaultDetachedBookmarkBarSeparator = | 87 const SkColor kDefaultDetachedBookmarkBarSeparator = |
96 SkColorSetRGB(0xB6, 0xB4, 0xB6); | 88 SkColorSetRGB(0xB6, 0xB4, 0xB6); |
97 const SkColor kDefaultDetachedBookmarkBarSeparatorIncognito = | 89 const SkColor kDefaultDetachedBookmarkBarSeparatorIncognito = |
98 SkColorSetRGB(0x28, 0x28, 0x28); | 90 SkColorSetRGB(0x28, 0x28, 0x28); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 } | 221 } |
230 } | 222 } |
231 | 223 |
232 // static | 224 // static |
233 SkColor ThemeProperties::GetDefaultColor(int id, bool otr) { | 225 SkColor ThemeProperties::GetDefaultColor(int id, bool otr) { |
234 switch (id) { | 226 switch (id) { |
235 // Properties stored in theme pack. | 227 // Properties stored in theme pack. |
236 case COLOR_FRAME: | 228 case COLOR_FRAME: |
237 return otr ? kDefaultColorFrameIncognito : kDefaultColorFrame; | 229 return otr ? kDefaultColorFrameIncognito : kDefaultColorFrame; |
238 case COLOR_FRAME_INACTIVE: | 230 case COLOR_FRAME_INACTIVE: |
239 return otr ? kDefaultColorFrameIncognitoInactive | 231 #if defined(OS_MACOSX) |
240 : kDefaultColorFrameInactive; | 232 if (otr) |
| 233 return kDefaultColorFrameIncognitoInactiveMac; |
| 234 #endif |
| 235 return color_utils::HSLShift( |
| 236 GetDefaultColor(ThemeProperties::COLOR_FRAME, otr), |
| 237 GetDefaultTint(ThemeProperties::TINT_FRAME_INACTIVE, false)); |
241 case COLOR_TOOLBAR: | 238 case COLOR_TOOLBAR: |
242 return otr ? kDefaultColorToolbarIncognito : kDefaultColorToolbar; | 239 return otr ? kDefaultColorToolbarIncognito : kDefaultColorToolbar; |
243 case COLOR_TAB_TEXT: | 240 case COLOR_TAB_TEXT: |
244 case COLOR_BOOKMARK_TEXT: | 241 case COLOR_BOOKMARK_TEXT: |
245 return otr ? kDefaultColorToolbarTextIncognito : kDefaultColorToolbarText; | 242 return otr ? kDefaultColorToolbarTextIncognito : kDefaultColorToolbarText; |
246 case COLOR_BACKGROUND_TAB_TEXT: | 243 case COLOR_BACKGROUND_TAB_TEXT: |
247 return otr ? kDefaultColorBackgroundTabTextIncognito | 244 return otr ? kDefaultColorBackgroundTabTextIncognito |
248 : kDefaultColorBackgroundTabText; | 245 : kDefaultColorBackgroundTabText; |
249 case COLOR_NTP_BACKGROUND: | 246 case COLOR_NTP_BACKGROUND: |
250 return kDefaultColorNTPBackground; | 247 return kDefaultColorNTPBackground; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 case COLOR_FRAME_INCOGNITO: | 315 case COLOR_FRAME_INCOGNITO: |
319 case COLOR_FRAME_INCOGNITO_INACTIVE: | 316 case COLOR_FRAME_INCOGNITO_INACTIVE: |
320 NOTREACHED() << "These values should be queried via their respective " | 317 NOTREACHED() << "These values should be queried via their respective " |
321 "non-incognito equivalents and an appropriate |otr| " | 318 "non-incognito equivalents and an appropriate |otr| " |
322 "value."; | 319 "value."; |
323 return gfx::kPlaceholderColor; | 320 return gfx::kPlaceholderColor; |
324 } | 321 } |
325 | 322 |
326 return gfx::kPlaceholderColor; | 323 return gfx::kPlaceholderColor; |
327 } | 324 } |
OLD | NEW |