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

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

Issue 1813393002: Don't fall back to default incognito colors and tints when using a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment Created 4 years, 8 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 | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_service.h" 5 #include "chrome/browser/themes/theme_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 SK_ColorWHITE, GetColor(kLabelBackground, incognito)); 491 SK_ColorWHITE, GetColor(kLabelBackground, incognito));
492 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL_BACKGROUND: 492 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL_BACKGROUND:
493 return color_utils::BlendTowardOppositeLuma( 493 return color_utils::BlendTowardOppositeLuma(
494 GetColor(ThemeProperties::COLOR_FRAME, incognito), 0x80); 494 GetColor(ThemeProperties::COLOR_FRAME, incognito), 0x80);
495 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL_BORDER: 495 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL_BORDER:
496 return color_utils::AlphaBlend(GetColor(kLabelBackground, incognito), 496 return color_utils::AlphaBlend(GetColor(kLabelBackground, incognito),
497 SK_ColorBLACK, 230); 497 SK_ColorBLACK, 230);
498 #endif 498 #endif
499 } 499 }
500 500
501 return ThemeProperties::GetDefaultColor(id, incognito); 501 // Always fall back to the non-incognito color when there's a custom theme
502 // because the default (classic) incognito color may be dramatically different
503 // (optimized for a light-on-dark color).
504 return ThemeProperties::GetDefaultColor(id, incognito && !theme_supplier_);
502 } 505 }
503 506
504 color_utils::HSL ThemeService::GetTint(int id, bool incognito) const { 507 color_utils::HSL ThemeService::GetTint(int id, bool incognito) const {
505 DCHECK(CalledOnValidThread()); 508 DCHECK(CalledOnValidThread());
506 509
507 color_utils::HSL hsl; 510 color_utils::HSL hsl;
508 if (theme_supplier_ && theme_supplier_->GetTint(id, &hsl)) 511 if (theme_supplier_ && theme_supplier_->GetTint(id, &hsl))
509 return hsl; 512 return hsl;
510 513
511 return ThemeProperties::GetDefaultTint(id, incognito); 514 // Always fall back to the non-incognito tint when there's a custom theme.
515 // See comment in GetDefaultColor().
516 return ThemeProperties::GetDefaultTint(id, incognito && !theme_supplier_);
512 } 517 }
513 518
514 void ThemeService::ClearAllThemeData() { 519 void ThemeService::ClearAllThemeData() {
515 if (!ready_) 520 if (!ready_)
516 return; 521 return;
517 522
518 SwapThemeSupplier(nullptr); 523 SwapThemeSupplier(nullptr);
519 524
520 // Clear our image cache. 525 // Clear our image cache.
521 FreePlatformCaches(); 526 FreePlatformCaches();
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 859
855 #if defined(ENABLE_SUPERVISED_USERS) 860 #if defined(ENABLE_SUPERVISED_USERS)
856 bool ThemeService::IsSupervisedUser() const { 861 bool ThemeService::IsSupervisedUser() const {
857 return profile_->IsSupervised(); 862 return profile_->IsSupervised();
858 } 863 }
859 864
860 void ThemeService::SetSupervisedUserTheme() { 865 void ThemeService::SetSupervisedUserTheme() {
861 SetCustomDefaultTheme(new SupervisedUserTheme); 866 SetCustomDefaultTheme(new SupervisedUserTheme);
862 } 867 }
863 #endif 868 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698