mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-01-31 19:45:27 +01:00
2f1e782f62
Frame identifiers have changed from int64_t to string type. This is due to https://crbug.com/1502660 which removes access to frame routing IDs in the renderer process. New cross-process frame identifiers are 160-bit values (32-bit child process ID + 128-bit local frame token) and most easily represented as strings. All other frame-related expectations and behaviors remain the same.
106 lines
3.8 KiB
Diff
106 lines
3.8 KiB
Diff
diff --git base/win/dark_mode_support.cc base/win/dark_mode_support.cc
|
|
index 6b9d2c180c904..3570ef071ba07 100644
|
|
--- base/win/dark_mode_support.cc
|
|
+++ base/win/dark_mode_support.cc
|
|
@@ -7,6 +7,7 @@
|
|
#include <windows.h>
|
|
|
|
#include "base/check.h"
|
|
+#include "base/command_line.h"
|
|
#include "base/native_library.h"
|
|
#include "base/win/windows_version.h"
|
|
|
|
@@ -86,11 +87,20 @@ const DarkModeSupport& GetDarkModeSupport() {
|
|
return dark_mode_support;
|
|
}
|
|
|
|
+bool IsForcedLightMode() {
|
|
+ static bool kIsForcedLightMode =
|
|
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
|
|
+ "force-light-mode");
|
|
+ return kIsForcedLightMode;
|
|
+}
|
|
+
|
|
} // namespace
|
|
|
|
namespace base::win {
|
|
|
|
bool IsDarkModeAvailable() {
|
|
+ if (IsForcedLightMode())
|
|
+ return false;
|
|
auto& dark_mode_support = GetDarkModeSupport();
|
|
return (dark_mode_support.allow_dark_mode_for_app ||
|
|
dark_mode_support.set_preferred_app_mode) &&
|
|
diff --git ui/native_theme/native_theme_mac.mm ui/native_theme/native_theme_mac.mm
|
|
index be2f769afe2d1..51bcf353b8797 100644
|
|
--- ui/native_theme/native_theme_mac.mm
|
|
+++ ui/native_theme/native_theme_mac.mm
|
|
@@ -50,6 +50,13 @@ bool InvertedColors() {
|
|
return NSWorkspace.sharedWorkspace.accessibilityDisplayShouldInvertColors;
|
|
}
|
|
|
|
+bool IsForcedLightMode() {
|
|
+ static bool kIsForcedLightMode =
|
|
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
|
|
+ "force-light-mode");
|
|
+ return kIsForcedLightMode;
|
|
+}
|
|
+
|
|
} // namespace
|
|
|
|
// Helper object to respond to light mode/dark mode changeovers.
|
|
@@ -594,11 +601,15 @@ void NativeThemeMac::PaintSelectedMenuItem(
|
|
|
|
void NativeThemeMac::InitializeDarkModeStateAndObserver() {
|
|
__block auto theme = this;
|
|
- set_use_dark_colors(IsDarkMode());
|
|
+ if (!IsForcedLightMode()) {
|
|
+ set_use_dark_colors(IsForcedDarkMode() || IsDarkMode());
|
|
+ }
|
|
set_preferred_color_scheme(CalculatePreferredColorScheme());
|
|
appearance_observer_ =
|
|
[[NativeThemeEffectiveAppearanceObserver alloc] initWithHandler:^{
|
|
- theme->set_use_dark_colors(IsDarkMode());
|
|
+ if (!IsForcedLightMode()) {
|
|
+ theme->set_use_dark_colors(IsForcedDarkMode() || IsDarkMode());
|
|
+ }
|
|
theme->set_preferred_color_scheme(CalculatePreferredColorScheme());
|
|
theme->NotifyOnNativeThemeUpdated();
|
|
}];
|
|
diff --git ui/native_theme/native_theme_win.cc ui/native_theme/native_theme_win.cc
|
|
index 6af4df92820d5..c2ae96510d011 100644
|
|
--- ui/native_theme/native_theme_win.cc
|
|
+++ ui/native_theme/native_theme_win.cc
|
|
@@ -653,14 +653,17 @@ bool NativeThemeWin::ShouldUseDarkColors() const {
|
|
// Windows high contrast modes are entirely different themes,
|
|
// so let them take priority over dark mode.
|
|
// ...unless --force-dark-mode was specified in which case caveat emptor.
|
|
- if (InForcedColorsMode() && !IsForcedDarkMode())
|
|
+ if (supports_windows_dark_mode_ && IsForcedDarkMode()) {
|
|
+ return true;
|
|
+ }
|
|
+ if (InForcedColorsMode())
|
|
return false;
|
|
return NativeTheme::ShouldUseDarkColors();
|
|
}
|
|
|
|
NativeTheme::PreferredColorScheme
|
|
NativeThemeWin::CalculatePreferredColorScheme() const {
|
|
- if (!InForcedColorsMode())
|
|
+ if (!InForcedColorsMode() || !supports_windows_dark_mode_)
|
|
return NativeTheme::CalculatePreferredColorScheme();
|
|
|
|
// According to the spec, the preferred color scheme for web content is 'dark'
|
|
@@ -1651,8 +1654,9 @@ void NativeThemeWin::RegisterColorFilteringRegkeyObserver() {
|
|
}
|
|
|
|
void NativeThemeWin::UpdateDarkModeStatus() {
|
|
- bool dark_mode_enabled = false;
|
|
- if (hkcu_themes_regkey_.Valid()) {
|
|
+ bool dark_mode_enabled = ShouldUseDarkColors();
|
|
+ if (supports_windows_dark_mode_ && !IsForcedDarkMode() &&
|
|
+ hkcu_themes_regkey_.Valid()) {
|
|
DWORD apps_use_light_theme = 1;
|
|
hkcu_themes_regkey_.ReadValueDW(L"AppsUseLightTheme",
|
|
&apps_use_light_theme);
|