fix: check new forced colors enum value

https://chromium-review.googlesource.com/c/chromium/src/+/6944403
This commit is contained in:
Samuel Maddock
2025-10-08 14:49:13 -04:00
parent 1e86b6ddfb
commit d585879807

View File

@@ -427,7 +427,8 @@ void ElectronBrowserClient::OverrideWebPreferences(
renderer_prefs->can_accept_load_drops = false;
ui::NativeTheme* native_theme = ui::NativeTheme::GetInstanceForNativeUi();
prefs->in_forced_colors = native_theme->forced_colors();
prefs->in_forced_colors = native_theme->forced_colors() !=
ui::ColorProviderKey::ForcedColors::kNone;
prefs->preferred_color_scheme =
native_theme->preferred_color_scheme() ==
ui::NativeTheme::PreferredColorScheme::kDark
@@ -447,7 +448,8 @@ bool ElectronBrowserClient::WebPreferencesNeedUpdateForColorRelatedStateChanges(
const content::SiteInstance& main_frame_site) const {
const auto& prefs = web_contents.GetOrCreateWebPreferences();
ui::NativeTheme* native_theme = ui::NativeTheme::GetInstanceForNativeUi();
bool in_forced_colors = native_theme->forced_colors();
bool in_forced_colors = native_theme->forced_colors() !=
ui::ColorProviderKey::ForcedColors::kNone;
blink::mojom::PreferredColorScheme preferred_color_scheme =
native_theme->preferred_color_scheme() ==
ui::NativeTheme::PreferredColorScheme::kDark