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

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

Issue 1852463002: Don't fall back to default incognito colors and tints when using a custom theme. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 return profile_->GetPrefs()->GetString(prefs::kCurrentThemeID); 339 return profile_->GetPrefs()->GetString(prefs::kCurrentThemeID);
340 } 340 }
341 341
342 color_utils::HSL ThemeService::GetTint(int id, bool incognito) const { 342 color_utils::HSL ThemeService::GetTint(int id, bool incognito) const {
343 DCHECK(CalledOnValidThread()); 343 DCHECK(CalledOnValidThread());
344 344
345 color_utils::HSL hsl; 345 color_utils::HSL hsl;
346 if (theme_supplier_ && theme_supplier_->GetTint(id, &hsl)) 346 if (theme_supplier_ && theme_supplier_->GetTint(id, &hsl))
347 return hsl; 347 return hsl;
348 348
349 return ThemeProperties::GetDefaultTint(id, incognito); 349 // Always fall back to the non-incognito tint when there's a custom theme.
350 // See comment in GetDefaultColor().
351 return ThemeProperties::GetDefaultTint(id, incognito && !theme_supplier_);
350 } 352 }
351 353
352 void ThemeService::ClearAllThemeData() { 354 void ThemeService::ClearAllThemeData() {
353 if (!ready_) 355 if (!ready_)
354 return; 356 return;
355 357
356 SwapThemeSupplier(nullptr); 358 SwapThemeSupplier(nullptr);
357 359
358 // Clear our image cache. 360 // Clear our image cache.
359 FreePlatformCaches(); 361 FreePlatformCaches();
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 GetColor(ThemeProperties::COLOR_TOOLBAR, incognito); 617 GetColor(ThemeProperties::COLOR_TOOLBAR, incognito);
616 SkColor text_color = GetColor(ThemeProperties::COLOR_TAB_TEXT, incognito); 618 SkColor text_color = GetColor(ThemeProperties::COLOR_TAB_TEXT, incognito);
617 return SkColorSetARGB( 619 return SkColorSetARGB(
618 SkColorGetA(text_color), 620 SkColorGetA(text_color),
619 (SkColorGetR(text_color) + SkColorGetR(toolbar_color)) / 2, 621 (SkColorGetR(text_color) + SkColorGetR(toolbar_color)) / 2,
620 (SkColorGetG(text_color) + SkColorGetR(toolbar_color)) / 2, 622 (SkColorGetG(text_color) + SkColorGetR(toolbar_color)) / 2,
621 (SkColorGetB(text_color) + SkColorGetR(toolbar_color)) / 2); 623 (SkColorGetB(text_color) + SkColorGetR(toolbar_color)) / 2);
622 } 624 }
623 } 625 }
624 626
625 return ThemeProperties::GetDefaultColor(id, incognito); 627 // Always fall back to the non-incognito color when there's a custom theme
628 // because the default (classic) incognito color may be dramatically different
629 // (optimized for a light-on-dark color).
630 return ThemeProperties::GetDefaultColor(id, incognito && !theme_supplier_);
626 } 631 }
627 632
628 int ThemeService::GetDisplayProperty(int id) const { 633 int ThemeService::GetDisplayProperty(int id) const {
629 int result = 0; 634 int result = 0;
630 if (theme_supplier_ && theme_supplier_->GetDisplayProperty(id, &result)) { 635 if (theme_supplier_ && theme_supplier_->GetDisplayProperty(id, &result)) {
631 return result; 636 return result;
632 } 637 }
633 638
634 switch (id) { 639 switch (id) {
635 case ThemeProperties::NTP_BACKGROUND_ALIGNMENT: 640 case ThemeProperties::NTP_BACKGROUND_ALIGNMENT:
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 870
866 bool ThemeService::BrowserThemeProvider::HasCustomImage(int id) const { 871 bool ThemeService::BrowserThemeProvider::HasCustomImage(int id) const {
867 return theme_service_.HasCustomImage(id); 872 return theme_service_.HasCustomImage(id);
868 } 873 }
869 874
870 base::RefCountedMemory* ThemeService::BrowserThemeProvider::GetRawData( 875 base::RefCountedMemory* ThemeService::BrowserThemeProvider::GetRawData(
871 int id, 876 int id,
872 ui::ScaleFactor scale_factor) const { 877 ui::ScaleFactor scale_factor) const {
873 return theme_service_.GetRawData(id, scale_factor); 878 return theme_service_.GetRawData(id, scale_factor);
874 } 879 }
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