Commit 60c24709 authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Allow the IncreasedContrastThemeSupplier to Opt-Out of Most Incognito Colors

Previously, the IncreasedContrastThemeSupplier bypassed most of the
incognito colors. This worked fine as the colors it did specify worked
with non-incognito colors in incognito.

http://crrev.com/719713 removed this bypass, resulting in incognito
colors applied to the IncreasedContrastThemeSupplier and white-on-white
text as well as light-on-white controls.

This change reintroduces this opt-out as a workaround.

BUG=1045630

Change-Id: Ib83172fbd90559bc72e94e850591ee66cd4ad4e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2024468
Commit-Queue: Robert Liao <robliao@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Auto-Submit: Robert Liao <robliao@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735723}
parent 746df67f
......@@ -57,3 +57,7 @@ base::RefCountedMemory* CustomThemeSupplier::GetRawData(
bool CustomThemeSupplier::HasCustomImage(int id) const {
return false;
}
bool CustomThemeSupplier::CanUseIncognitoColors() const {
return true;
}
......@@ -74,6 +74,11 @@ class CustomThemeSupplier
// Whether this theme provides an image for |id|.
virtual bool HasCustomImage(int id) const;
// Returns whether or not the default incognito colors can be used with this
// theme. This is a workaround for the IncreasedContrastThemeSupplier that
// doesn't supply all the colors it should (http://crbug.com/1045630).
virtual bool CanUseIncognitoColors() const;
protected:
virtual ~CustomThemeSupplier();
......
......@@ -47,3 +47,7 @@ bool IncreasedContrastThemeSupplier::GetColor(int id, SkColor* color) const {
}
return false;
}
bool IncreasedContrastThemeSupplier::CanUseIncognitoColors() const {
return false;
}
......@@ -15,6 +15,7 @@ class IncreasedContrastThemeSupplier : public CustomThemeSupplier {
explicit IncreasedContrastThemeSupplier(bool is_dark_mode);
bool GetColor(int id, SkColor* color) const override;
bool CanUseIncognitoColors() const override;
protected:
~IncreasedContrastThemeSupplier() override;
......
......@@ -1126,7 +1126,9 @@ bool ThemeService::UsingCustomTheme() const {
bool ThemeService::UseIncognitoColor(int id) const {
// Incognito is disabled for any non-ignored custom theme colors so they apply
// atop a predictable state.
return !UsingCustomTheme() || ShouldIgnoreThemeSupplier(id, true);
return ShouldIgnoreThemeSupplier(id, true) ||
(!UsingCustomTheme() &&
(!theme_supplier_ || theme_supplier_->CanUseIncognitoColors()));
}
bool ThemeService::UseDarkModeColors() 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