| 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 const SkColor kDefaultColorFrameInactive = SkColorSetRGB(0xF5, 0xF5, 0xF5); |
| 27 | 28 |
| 28 #if defined(OS_MACOSX) | 29 #if defined(OS_MACOSX) |
| 29 const SkColor kDefaultColorFrameIncognito = | 30 const SkColor kDefaultColorFrameIncognito = |
| 30 SkColorSetARGB(0xE6, 0x14, 0x16, 0x18); | 31 SkColorSetARGB(0xE6, 0x14, 0x16, 0x18); |
| 31 const SkColor kDefaultColorFrameIncognitoInactiveMac = | 32 const SkColor kDefaultColorFrameIncognitoInactive = |
| 32 SkColorSetRGB(0x1E, 0x1E, 0x1E); | 33 SkColorSetRGB(0x1E, 0x1E, 0x1E); |
| 33 #else | 34 #else |
| 34 const SkColor kDefaultColorFrameIncognito = SkColorSetRGB(0x28, 0x2B, 0x2D); | 35 const SkColor kDefaultColorFrameIncognito = SkColorSetRGB(0x28, 0x2B, 0x2D); |
| 36 const SkColor kDefaultColorFrameIncognitoInactive = |
| 37 SkColorSetRGB(0x38, 0x3B, 0x3D); |
| 35 #endif | 38 #endif |
| 36 | 39 |
| 37 const SkColor kDefaultColorToolbar = SkColorSetRGB(0xF2, 0xF2, 0xF2); | 40 const SkColor kDefaultColorToolbar = SkColorSetRGB(0xF2, 0xF2, 0xF2); |
| 38 const SkColor kDefaultColorToolbarIncognito = SkColorSetRGB(0x50, 0x50, 0x50); | 41 const SkColor kDefaultColorToolbarIncognito = SkColorSetRGB(0x50, 0x50, 0x50); |
| 39 | 42 |
| 40 const SkColor kDefaultDetachedBookmarkBarBackground = SK_ColorWHITE; | 43 const SkColor kDefaultDetachedBookmarkBarBackground = SK_ColorWHITE; |
| 41 const SkColor kDefaultDetachedBookmarkBarBackgroundIncognito = | 44 const SkColor kDefaultDetachedBookmarkBarBackgroundIncognito = |
| 42 SkColorSetRGB(0x32, 0x32, 0x32); | 45 SkColorSetRGB(0x32, 0x32, 0x32); |
| 43 | 46 |
| 44 // "Toolbar" text is used for active tabs and the bookmarks bar. | 47 // "Toolbar" text is used for active tabs and the bookmarks bar. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 65 const SkColor kDefaultColorNTPLink = SkColorSetRGB(0x06, 0x37, 0x74); | 68 const SkColor kDefaultColorNTPLink = SkColorSetRGB(0x06, 0x37, 0x74); |
| 66 #endif // OS_WIN | 69 #endif // OS_WIN |
| 67 | 70 |
| 68 const SkColor kDefaultColorNTPHeader = SkColorSetRGB(0x96, 0x96, 0x96); | 71 const SkColor kDefaultColorNTPHeader = SkColorSetRGB(0x96, 0x96, 0x96); |
| 69 constexpr SkColor kDefaultColorButtonBackground = SK_ColorTRANSPARENT; | 72 constexpr SkColor kDefaultColorButtonBackground = SK_ColorTRANSPARENT; |
| 70 | 73 |
| 71 // Default tints. | 74 // Default tints. |
| 72 constexpr color_utils::HSL kDefaultTintButtons = {-1, -1, -1}; | 75 constexpr color_utils::HSL kDefaultTintButtons = {-1, -1, -1}; |
| 73 constexpr color_utils::HSL kDefaultTintButtonsIncognito = {-1, -1, 0.85}; | 76 constexpr color_utils::HSL kDefaultTintButtonsIncognito = {-1, -1, 0.85}; |
| 74 constexpr color_utils::HSL kDefaultTintFrame = {-1, -1, -1}; | 77 constexpr color_utils::HSL kDefaultTintFrame = {-1, -1, -1}; |
| 75 constexpr color_utils::HSL kDefaultTintFrameInactive = {-1, -1, 0.9}; | 78 constexpr color_utils::HSL kDefaultTintFrameInactive = {-1, -1, 0.75}; |
| 76 constexpr color_utils::HSL kDefaultTintFrameIncognito = {-1, 0.2, 0.35}; | 79 constexpr color_utils::HSL kDefaultTintFrameIncognito = {-1, 0.2, 0.35}; |
| 77 constexpr color_utils::HSL kDefaultTintFrameIncognitoInactive = {-1, 0.2, 0.87}; | 80 constexpr color_utils::HSL kDefaultTintFrameIncognitoInactive = {-1, 0.3, 0.6}; |
| 78 constexpr color_utils::HSL kDefaultTintBackgroundTab = {-1, -1, 0.75}; | 81 constexpr color_utils::HSL kDefaultTintBackgroundTab = {-1, -1, 0.75}; |
| 79 | 82 |
| 80 // ---------------------------------------------------------------------------- | 83 // ---------------------------------------------------------------------------- |
| 81 // 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. |
| 82 | 85 |
| 83 constexpr SkColor kDefaultColorControlBackground = SK_ColorWHITE; | 86 constexpr SkColor kDefaultColorControlBackground = SK_ColorWHITE; |
| 84 const SkColor kDefaultDetachedBookmarkBarSeparator = | 87 const SkColor kDefaultDetachedBookmarkBarSeparator = |
| 85 SkColorSetRGB(0xB6, 0xB4, 0xB6); | 88 SkColorSetRGB(0xB6, 0xB4, 0xB6); |
| 86 const SkColor kDefaultDetachedBookmarkBarSeparatorIncognito = | 89 const SkColor kDefaultDetachedBookmarkBarSeparatorIncognito = |
| 87 SkColorSetRGB(0x28, 0x28, 0x28); | 90 SkColorSetRGB(0x28, 0x28, 0x28); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 } | 217 } |
| 215 } | 218 } |
| 216 | 219 |
| 217 // static | 220 // static |
| 218 SkColor ThemeProperties::GetDefaultColor(int id, bool otr) { | 221 SkColor ThemeProperties::GetDefaultColor(int id, bool otr) { |
| 219 switch (id) { | 222 switch (id) { |
| 220 // Properties stored in theme pack. | 223 // Properties stored in theme pack. |
| 221 case COLOR_FRAME: | 224 case COLOR_FRAME: |
| 222 return otr ? kDefaultColorFrameIncognito : kDefaultColorFrame; | 225 return otr ? kDefaultColorFrameIncognito : kDefaultColorFrame; |
| 223 case COLOR_FRAME_INACTIVE: | 226 case COLOR_FRAME_INACTIVE: |
| 224 #if defined(OS_MACOSX) | 227 return otr ? kDefaultColorFrameIncognitoInactive |
| 225 if (otr) | 228 : kDefaultColorFrameInactive; |
| 226 return kDefaultColorFrameIncognitoInactiveMac; | |
| 227 #endif | |
| 228 return color_utils::HSLShift( | |
| 229 GetDefaultColor(ThemeProperties::COLOR_FRAME, otr), | |
| 230 GetDefaultTint(ThemeProperties::TINT_FRAME_INACTIVE, false)); | |
| 231 case COLOR_TOOLBAR: | 229 case COLOR_TOOLBAR: |
| 232 return otr ? kDefaultColorToolbarIncognito : kDefaultColorToolbar; | 230 return otr ? kDefaultColorToolbarIncognito : kDefaultColorToolbar; |
| 233 case COLOR_TAB_TEXT: | 231 case COLOR_TAB_TEXT: |
| 234 case COLOR_BOOKMARK_TEXT: | 232 case COLOR_BOOKMARK_TEXT: |
| 235 return otr ? kDefaultColorToolbarTextIncognito : kDefaultColorToolbarText; | 233 return otr ? kDefaultColorToolbarTextIncognito : kDefaultColorToolbarText; |
| 236 case COLOR_BACKGROUND_TAB_TEXT: | 234 case COLOR_BACKGROUND_TAB_TEXT: |
| 237 return otr ? kDefaultColorBackgroundTabTextIncognito | 235 return otr ? kDefaultColorBackgroundTabTextIncognito |
| 238 : kDefaultColorBackgroundTabText; | 236 : kDefaultColorBackgroundTabText; |
| 239 case COLOR_NTP_BACKGROUND: | 237 case COLOR_NTP_BACKGROUND: |
| 240 return kDefaultColorNTPBackground; | 238 return kDefaultColorNTPBackground; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 case COLOR_FRAME_INCOGNITO: | 296 case COLOR_FRAME_INCOGNITO: |
| 299 case COLOR_FRAME_INCOGNITO_INACTIVE: | 297 case COLOR_FRAME_INCOGNITO_INACTIVE: |
| 300 NOTREACHED() << "These values should be queried via their respective " | 298 NOTREACHED() << "These values should be queried via their respective " |
| 301 "non-incognito equivalents and an appropriate |otr| " | 299 "non-incognito equivalents and an appropriate |otr| " |
| 302 "value."; | 300 "value."; |
| 303 return gfx::kPlaceholderColor; | 301 return gfx::kPlaceholderColor; |
| 304 } | 302 } |
| 305 | 303 |
| 306 return gfx::kPlaceholderColor; | 304 return gfx::kPlaceholderColor; |
| 307 } | 305 } |
| OLD | NEW |