Browse Source

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

Keeley Hammond 2 years ago
parent
commit
84c94c3ebb
2 changed files with 6 additions and 6 deletions
  1. 6 0
      shell/app/electron_main_win.cc
  2. 0 6
      shell/browser/electron_browser_main_parts.cc

+ 6 - 0
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);

+ 0 - 6
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());