chore: move dark mode activation to main_win.cc (#35529)

This commit is contained in:
Keeley Hammond 2022-09-07 09:39:35 -07:00 committed by GitHub
parent 142eb89d5e
commit 84c94c3ebb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View file

@ -21,6 +21,7 @@
#include "base/i18n/icu_util.h" #include "base/i18n/icu_util.h"
#include "base/process/launch.h" #include "base/process/launch.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/win/dark_mode_support.h"
#include "base/win/windows_version.h" #include "base/win/windows_version.h"
#include "components/browser_watcher/exit_code_watcher_win.h" #include "components/browser_watcher/exit_code_watcher_win.h"
#include "components/crash/core/app/crash_switches.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; 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) #if defined(ARCH_CPU_32_BITS)
// Intentionally crash if converting to a fiber failed. // Intentionally crash if converting to a fiber failed.
CHECK_EQ(fiber_status, FiberStatus::kSuccess); CHECK_EQ(fiber_status, FiberStatus::kSuccess);

View file

@ -83,7 +83,6 @@
#endif #endif
#if BUILDFLAG(IS_WIN) #if BUILDFLAG(IS_WIN)
#include "base/win/dark_mode_support.h"
#include "ui/base/l10n/l10n_util_win.h" #include "ui/base/l10n/l10n_util_win.h"
#include "ui/display/win/dpi.h" #include "ui/display/win/dpi.h"
#include "ui/gfx/system_fonts_win.h" #include "ui/gfx/system_fonts_win.h"
@ -444,11 +443,6 @@ int ElectronBrowserMainParts::PreMainMessageLoopRun() {
SpellcheckServiceFactory::GetInstance(); SpellcheckServiceFactory::GetInstance();
#endif #endif
#if BUILDFLAG(IS_WIN)
// access ui native theme here to prevent blocking calls later
base::win::AllowDarkModeForApp(true);
#endif
content::WebUIControllerFactory::RegisterFactory( content::WebUIControllerFactory::RegisterFactory(
ElectronWebUIControllerFactory::GetInstance()); ElectronWebUIControllerFactory::GetInstance());