feat: add nativeTheme.inForcedColorsMode (#33357)

Co-authored-by: Milan Burda <milan.burda@gmail.com>
This commit is contained in:
trop[bot]
2022-03-23 16:54:11 -07:00
committed by GitHub
parent 8b996a478a
commit 4abb7e9709
4 changed files with 18 additions and 1 deletions

View File

@@ -67,6 +67,10 @@ bool NativeTheme::ShouldUseHighContrastColors() {
return ui_theme_->UserHasContrastPreference();
}
bool NativeTheme::InForcedColorsMode() {
return ui_theme_->InForcedColorsMode();
}
#if BUILDFLAG(IS_MAC)
const CFStringRef WhiteOnBlack = CFSTR("whiteOnBlack");
const CFStringRef UniversalAccessDomain = CFSTR("com.apple.universalaccess");
@@ -106,7 +110,8 @@ gin::ObjectTemplateBuilder NativeTheme::GetObjectTemplateBuilder(
.SetProperty("shouldUseHighContrastColors",
&NativeTheme::ShouldUseHighContrastColors)
.SetProperty("shouldUseInvertedColorScheme",
&NativeTheme::ShouldUseInvertedColorScheme);
&NativeTheme::ShouldUseInvertedColorScheme)
.SetProperty("inForcedColorsMode", &NativeTheme::InForcedColorsMode);
}
const char* NativeTheme::GetTypeName() {

View File

@@ -46,6 +46,7 @@ class NativeTheme : public gin::Wrappable<NativeTheme>,
bool ShouldUseDarkColors();
bool ShouldUseHighContrastColors();
bool ShouldUseInvertedColorScheme();
bool InForcedColorsMode();
// ui::NativeThemeObserver:
void OnNativeThemeUpdated(ui::NativeTheme* theme) override;