From 84c94c3ebbd65dd87a70ddb0de3dd0b888014690 Mon Sep 17 00:00:00 2001 From: Keeley Hammond Date: Wed, 7 Sep 2022 09:39:35 -0700 Subject: [PATCH] chore: move dark mode activation to main_win.cc (#35529) --- shell/app/electron_main_win.cc | 6 ++++++ shell/browser/electron_browser_main_parts.cc | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/shell/app/electron_main_win.cc b/shell/app/electron_main_win.cc index 2be51c27b247..a8b45f716683 100644 --- a/shell/app/electron_main_win.cc +++ b/shell/app/electron_main_win.cc @@ -21,6 +21,7 @@ #include "base/i18n/icu_util.h" #include "base/process/launch.h" #include "base/strings/utf_string_conversions.h" +#include "base/win/dark_mode_support.h" #include "base/win/windows_version.h" #include "components/browser_watcher/exit_code_watcher_win.h" #include "components/crash/core/app/crash_switches.h" @@ -219,6 +220,11 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) { return crashpad_status; } +#if BUILDFLAG(IS_WIN) + // access ui native theme here to prevent blocking calls later + base::win::AllowDarkModeForApp(true); +#endif + #if defined(ARCH_CPU_32_BITS) // Intentionally crash if converting to a fiber failed. CHECK_EQ(fiber_status, FiberStatus::kSuccess); diff --git a/shell/browser/electron_browser_main_parts.cc b/shell/browser/electron_browser_main_parts.cc index c65232ec17ba..698e95742181 100644 --- a/shell/browser/electron_browser_main_parts.cc +++ b/shell/browser/electron_browser_main_parts.cc @@ -83,7 +83,6 @@ #endif #if BUILDFLAG(IS_WIN) -#include "base/win/dark_mode_support.h" #include "ui/base/l10n/l10n_util_win.h" #include "ui/display/win/dpi.h" #include "ui/gfx/system_fonts_win.h" @@ -444,11 +443,6 @@ int ElectronBrowserMainParts::PreMainMessageLoopRun() { SpellcheckServiceFactory::GetInstance(); #endif -#if BUILDFLAG(IS_WIN) - // access ui native theme here to prevent blocking calls later - base::win::AllowDarkModeForApp(true); -#endif - content::WebUIControllerFactory::RegisterFactory( ElectronWebUIControllerFactory::GetInstance());