Commit 0f73ff94 authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Don't force non-incognito default colors for X11/increased contrast themes.

For X11 this likely doesn't matter, as in practice NativeThemeGtk::GetColor()
will probably override everything.  For the increased contrast theme supplier,
someday we probably want to replace this with better platform-native high
contrast support on the platforms that use it, but for now, it doesn't make
sense to disable incognito default colors in most cases; the code in question
was only intended to apply to custom themes.

This _does_ still apply "force non-incognito" to autogenerated themes, since
these should basically work "like custom themes" as much as possible.  If we
wanted, we could likely change this by ensuring the autogenerator overrides
everything necessary.  I don't have a strong opinion.

This is primarily a set-up change for fixing bug 621004, by exposing a method
that we'll also use to control "disable dark mode".

Bug: 621004
Change-Id: I6375cea9ae88d56a02c212258caf3b647af30585
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1938569
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarGayane Petrosyan <gayane@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719713}
parent 44f4a86d
...@@ -475,6 +475,10 @@ bool ThemeService::UsingAutogeneratedTheme() const { ...@@ -475,6 +475,10 @@ bool ThemeService::UsingAutogeneratedTheme() const {
return autogenerated; return autogenerated;
} }
bool ThemeService::ForceLightDefaultColors() const {
return UsingExtensionTheme() || UsingAutogeneratedTheme();
}
std::string ThemeService::GetThemeID() const { std::string ThemeService::GetThemeID() const {
return profile_->GetPrefs()->GetString(prefs::kCurrentThemeID); return profile_->GetPrefs()->GetString(prefs::kCurrentThemeID);
} }
...@@ -658,10 +662,7 @@ SkColor ThemeService::GetDefaultColor(int id, bool incognito) const { ...@@ -658,10 +662,7 @@ SkColor ThemeService::GetDefaultColor(int id, bool incognito) const {
} }
} }
// Always fall back to the non-incognito color when there's a custom theme return TP::GetDefaultColor(id, incognito && !ForceLightDefaultColors());
// because the default (classic) incognito color may be dramatically different
// (optimized for a light-on-dark color).
return TP::GetDefaultColor(id, incognito && !theme_supplier_);
} }
color_utils::HSL ThemeService::GetTint(int id, bool incognito) const { color_utils::HSL ThemeService::GetTint(int id, bool incognito) const {
...@@ -671,9 +672,7 @@ color_utils::HSL ThemeService::GetTint(int id, bool incognito) const { ...@@ -671,9 +672,7 @@ color_utils::HSL ThemeService::GetTint(int id, bool incognito) const {
if (theme_supplier_ && theme_supplier_->GetTint(id, &hsl)) if (theme_supplier_ && theme_supplier_->GetTint(id, &hsl))
return hsl; return hsl;
// Always fall back to the non-incognito tint when there's a custom theme. return TP::GetDefaultTint(id, incognito && !ForceLightDefaultColors());
// See comment in GetDefaultColor().
return TP::GetDefaultTint(id, incognito && !theme_supplier_);
} }
void ThemeService::ClearAllThemeData() { void ThemeService::ClearAllThemeData() {
......
...@@ -128,6 +128,10 @@ class ThemeService : public content::NotificationObserver, ...@@ -128,6 +128,10 @@ class ThemeService : public content::NotificationObserver,
// Whether we are using an autogenerated theme. // Whether we are using an autogenerated theme.
virtual bool UsingAutogeneratedTheme() const; virtual bool UsingAutogeneratedTheme() const;
// Whether to force the use of light colors/tints by default, i.e. ignore
// incognito state. This is true for extension and autogenerated themes.
bool ForceLightDefaultColors() const;
// Gets the id of the last installed theme. (The theme may have been further // Gets the id of the last installed theme. (The theme may have been further
// locally customized.) // locally customized.)
virtual std::string GetThemeID() const; virtual std::string GetThemeID() const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment