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

Side by Side Diff: chrome/browser/themes/theme_properties.cc

Issue 2899053002: Fix the MD Incognito NTP background color regression (Closed)
Patch Set: Addressed comments. Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/ui/webui/ntp/ntp_resource_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common/chrome_features.h"
14 #include "chrome/grit/theme_resources.h" 15 #include "chrome/grit/theme_resources.h"
15 #include "ui/base/material_design/material_design_controller.h" 16 #include "ui/base/material_design/material_design_controller.h"
16 #include "ui/gfx/color_palette.h" 17 #include "ui/gfx/color_palette.h"
17 #include "ui/resources/grit/ui_resources.h" 18 #include "ui/resources/grit/ui_resources.h"
18 19
19 namespace { 20 namespace {
20 21
21 // ---------------------------------------------------------------------------- 22 // ----------------------------------------------------------------------------
22 // Defaults for properties which are stored in the browser theme pack. If you 23 // Defaults for properties which are stored in the browser theme pack. If you
23 // change these defaults, you must increment the version number in 24 // change these defaults, you must increment the version number in
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 color_utils::GetSysSkColor(COLOR_WINDOW); 61 color_utils::GetSysSkColor(COLOR_WINDOW);
61 const SkColor kDefaultColorNTPText = 62 const SkColor kDefaultColorNTPText =
62 color_utils::GetSysSkColor(COLOR_WINDOWTEXT); 63 color_utils::GetSysSkColor(COLOR_WINDOWTEXT);
63 const SkColor kDefaultColorNTPLink = color_utils::GetSysSkColor(COLOR_HOTLIGHT); 64 const SkColor kDefaultColorNTPLink = color_utils::GetSysSkColor(COLOR_HOTLIGHT);
64 #else 65 #else
65 // TODO(beng): source from theme provider. 66 // TODO(beng): source from theme provider.
66 constexpr SkColor kDefaultColorNTPBackground = SK_ColorWHITE; 67 constexpr SkColor kDefaultColorNTPBackground = SK_ColorWHITE;
67 constexpr SkColor kDefaultColorNTPText = SK_ColorBLACK; 68 constexpr SkColor kDefaultColorNTPText = SK_ColorBLACK;
68 const SkColor kDefaultColorNTPLink = SkColorSetRGB(0x06, 0x37, 0x74); 69 const SkColor kDefaultColorNTPLink = SkColorSetRGB(0x06, 0x37, 0x74);
69 #endif // OS_WIN 70 #endif // OS_WIN
70 const SkColor kDefaultColorNTPBackgroundOtr = SkColorSetRGB(0x30, 0x30, 0x30); 71
72 // Then new MD Incognito NTP uses a slightly different shade of black.
73 // TODO(msramek): Remove the old entry when the new NTP fully launches.
Evan Stade 2017/05/24 17:30:26 nit: I don't really mind if you leave this TODO he
msramek 2017/05/24 17:39:49 I just imagined that having two background colors
74 const SkColor kDefaultColorNTPBackgroundOtr = SkColorSetRGB(0x32, 0x32, 0x32);
75 const SkColor kDefaultColorNTPBackgroundOtrMD = SkColorSetRGB(0x30, 0x30, 0x30);
71 76
72 const SkColor kDefaultColorNTPHeader = SkColorSetRGB(0x96, 0x96, 0x96); 77 const SkColor kDefaultColorNTPHeader = SkColorSetRGB(0x96, 0x96, 0x96);
73 constexpr SkColor kDefaultColorButtonBackground = SK_ColorTRANSPARENT; 78 constexpr SkColor kDefaultColorButtonBackground = SK_ColorTRANSPARENT;
74 79
75 // Default tints. 80 // Default tints.
76 constexpr color_utils::HSL kDefaultTintButtons = {-1, -1, -1}; 81 constexpr color_utils::HSL kDefaultTintButtons = {-1, -1, -1};
77 constexpr color_utils::HSL kDefaultTintButtonsIncognito = {-1, -1, 0.85}; 82 constexpr color_utils::HSL kDefaultTintButtonsIncognito = {-1, -1, 0.85};
78 constexpr color_utils::HSL kDefaultTintFrame = {-1, -1, -1}; 83 constexpr color_utils::HSL kDefaultTintFrame = {-1, -1, -1};
79 constexpr color_utils::HSL kDefaultTintFrameInactive = {-1, -1, 0.75}; 84 constexpr color_utils::HSL kDefaultTintFrameInactive = {-1, -1, 0.75};
80 constexpr color_utils::HSL kDefaultTintFrameIncognito = {-1, 0.2, 0.35}; 85 constexpr color_utils::HSL kDefaultTintFrameIncognito = {-1, 0.2, 0.35};
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 : kDefaultColorFrameInactive; 234 : kDefaultColorFrameInactive;
230 case COLOR_TOOLBAR: 235 case COLOR_TOOLBAR:
231 return otr ? kDefaultColorToolbarIncognito : kDefaultColorToolbar; 236 return otr ? kDefaultColorToolbarIncognito : kDefaultColorToolbar;
232 case COLOR_TAB_TEXT: 237 case COLOR_TAB_TEXT:
233 case COLOR_BOOKMARK_TEXT: 238 case COLOR_BOOKMARK_TEXT:
234 return otr ? kDefaultColorToolbarTextIncognito : kDefaultColorToolbarText; 239 return otr ? kDefaultColorToolbarTextIncognito : kDefaultColorToolbarText;
235 case COLOR_BACKGROUND_TAB_TEXT: 240 case COLOR_BACKGROUND_TAB_TEXT:
236 return otr ? kDefaultColorBackgroundTabTextIncognito 241 return otr ? kDefaultColorBackgroundTabTextIncognito
237 : kDefaultColorBackgroundTabText; 242 : kDefaultColorBackgroundTabText;
238 case COLOR_NTP_BACKGROUND: 243 case COLOR_NTP_BACKGROUND:
239 return otr ? kDefaultColorNTPBackgroundOtr : kDefaultColorNTPBackground; 244 if (!otr)
245 return kDefaultColorNTPBackground;
246 return base::FeatureList::IsEnabled(features::kMaterialDesignIncognitoNTP)
247 ? kDefaultColorNTPBackgroundOtrMD
248 : kDefaultColorNTPBackgroundOtr;
240 case COLOR_NTP_TEXT: 249 case COLOR_NTP_TEXT:
241 return kDefaultColorNTPText; 250 return kDefaultColorNTPText;
242 case COLOR_NTP_LINK: 251 case COLOR_NTP_LINK:
243 return kDefaultColorNTPLink; 252 return kDefaultColorNTPLink;
244 case COLOR_NTP_HEADER: 253 case COLOR_NTP_HEADER:
245 return kDefaultColorNTPHeader; 254 return kDefaultColorNTPHeader;
246 case COLOR_BUTTON_BACKGROUND: 255 case COLOR_BUTTON_BACKGROUND:
247 return kDefaultColorButtonBackground; 256 return kDefaultColorButtonBackground;
248 257
249 // Properties not stored in theme pack. 258 // Properties not stored in theme pack.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 case COLOR_FRAME_INCOGNITO: 306 case COLOR_FRAME_INCOGNITO:
298 case COLOR_FRAME_INCOGNITO_INACTIVE: 307 case COLOR_FRAME_INCOGNITO_INACTIVE:
299 NOTREACHED() << "These values should be queried via their respective " 308 NOTREACHED() << "These values should be queried via their respective "
300 "non-incognito equivalents and an appropriate |otr| " 309 "non-incognito equivalents and an appropriate |otr| "
301 "value."; 310 "value.";
302 return gfx::kPlaceholderColor; 311 return gfx::kPlaceholderColor;
303 } 312 }
304 313
305 return gfx::kPlaceholderColor; 314 return gfx::kPlaceholderColor;
306 } 315 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/ntp/ntp_resource_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698