--- electron/shell/browser/electron_browser_main_parts.cc.orig 2024-09-05 10:01:25 UTC +++ electron/shell/browser/electron_browser_main_parts.cc @@ -77,7 +77,7 @@ #include "ui/wm/core/wm_state.h" #endif -#if BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) #include "base/environment.h" #include "chrome/browser/ui/views/dark_mode_manager_linux.h" #include "device/bluetooth/bluetooth_adapter_factory.h" @@ -130,7 +130,7 @@ namespace { namespace { -#if BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) class LinuxUiGetterImpl : public ui::LinuxUiGetter { public: LinuxUiGetterImpl() = default; @@ -208,7 +208,7 @@ int ElectronBrowserMainParts::PreEarlyInitialization() #if BUILDFLAG(IS_POSIX) HandleSIGCHLD(); #endif -#if BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) DetectOzonePlatform(); ui::OzonePlatform::PreEarlyInitialization(); #endif @@ -298,7 +298,7 @@ int ElectronBrowserMainParts::PreCreateThreads() { // happen before the ResourceBundle is loaded if (locale.empty()) l10n_util::OverrideLocaleWithCocoaLocale(); -#elif BUILDFLAG(IS_LINUX) +#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) // l10n_util::GetApplicationLocaleInternal uses g_get_language_names(), // which keys off of getenv("LC_ALL"). // We must set this env first to make ui::ResourceBundle accept the custom @@ -329,7 +329,7 @@ int ElectronBrowserMainParts::PreCreateThreads() { ElectronBrowserClient::SetApplicationLocale(app_locale); fake_browser_process_->SetApplicationLocale(app_locale); -#if BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) // Reset to the original LC_ALL since we should not be changing it. if (!locale.empty()) { if (lc_all) @@ -389,7 +389,7 @@ void ElectronBrowserMainParts::ToolkitInitialized() { } void ElectronBrowserMainParts::ToolkitInitialized() { -#if BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) auto* linux_ui = ui::GetDefaultLinuxUi(); CHECK(linux_ui); linux_ui_getter_ = std::make_unique(); @@ -495,7 +495,7 @@ void ElectronBrowserMainParts::PostCreateMainMessageLo } void ElectronBrowserMainParts::PostCreateMainMessageLoop() { -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) std::string app_name = electron::Browser::Get()->GetName(); #endif #if BUILDFLAG(IS_LINUX) @@ -507,7 +507,9 @@ void ElectronBrowserMainParts::PostCreateMainMessageLo if (!bluez::BluezDBusManager::IsInitialized()) bluez::DBusBluezManagerWrapperLinux::Initialize(); +#endif +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) // Set up crypt config. This needs to be done before anything starts the // network service, as the raw encryption key needs to be shared with the // network service for encrypted cookie storage. @@ -606,7 +608,7 @@ void ElectronBrowserMainParts::PostMainMessageLoopRun( fake_browser_process_->PostMainMessageLoopRun(); content::DevToolsAgentHost::StopRemoteDebuggingPipeHandler(); -#if BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) ui::OzonePlatform::GetInstance()->PostMainMessageLoopRun(); #endif }