aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroki Tagato <tagattie@FreeBSD.org>2024-07-19 07:59:42 +0000
committerHiroki Tagato <tagattie@FreeBSD.org>2024-07-19 08:07:07 +0000
commitf972de2bb95520d069245f99b6e5f9180ba9e108 (patch)
tree7f3f8c77de83830e00d6ebae82c6fbaf5cf371c3
parenta237805db5a4de3bd9aad407f66bd11d5f668880 (diff)
devel/electron31: add port: Build cross-platform desktop apps with JavaScript, HTML, and CSS
Build cross platform desktop apps with JavaScript, HTML, and CSS. It's easier than you think. If you can build a website, you can build a desktop app. Electron is a framework for creating native applications with web technologies like JavaScript, HTML, and CSS. It takes care of the hard parts so you can focus on the core of your application. WWW: https://electronjs.org/
-rw-r--r--devel/Makefile1
-rw-r--r--devel/electron31/Makefile438
-rw-r--r--devel/electron31/Makefile.version2
-rw-r--r--devel/electron31/distinfo21
-rw-r--r--devel/electron31/files/apply-electron-patches.sh26
-rw-r--r--devel/electron31/files/package.json152
-rw-r--r--devel/electron31/files/patch-BUILD.gn89
-rw-r--r--devel/electron31/files/patch-apps_ui_views_app__window__frame__view.cc11
-rw-r--r--devel/electron31/files/patch-ash_display_mirror__window__controller.cc14
-rw-r--r--devel/electron31/files/patch-base_BUILD.gn157
-rw-r--r--devel/electron31/files/patch-base_allocator_dispatcher_tls.h11
-rw-r--r--devel/electron31/files/patch-base_allocator_partition__allocator_partition__alloc.gni20
-rw-r--r--devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_address__space__randomization.h20
-rw-r--r--devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator.h11
-rw-r--r--devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__constants.h11
-rw-r--r--devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.h16
-rw-r--r--devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_stack__trace__posix.cc34
-rw-r--r--devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_rand__util__posix.cc13
-rw-r--r--devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread.h11
-rw-r--r--devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__internal__posix.h11
-rw-r--r--devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__posix.cc11
-rw-r--r--devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__config.h20
-rw-r--r--devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__constants.h11
-rw-r--r--devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__forward.h16
-rw-r--r--devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__root.cc29
-rw-r--r--devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_spinning__mutex.cc53
-rw-r--r--devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_stack_stack.cc50
-rw-r--r--devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_thread__isolation_pkey.cc11
-rw-r--r--devel/electron31/files/patch-base_atomicops.h14
-rw-r--r--devel/electron31/files/patch-base_base__paths__posix.cc108
-rw-r--r--devel/electron31/files/patch-base_compiler__specific.h11
-rw-r--r--devel/electron31/files/patch-base_debug_debugger__posix.cc69
-rw-r--r--devel/electron31/files/patch-base_debug_elf__reader.cc13
-rw-r--r--devel/electron31/files/patch-base_debug_proc__maps__linux.cc11
-rw-r--r--devel/electron31/files/patch-base_debug_stack__trace.cc29
-rw-r--r--devel/electron31/files/patch-base_debug_stack__trace__posix.cc101
-rw-r--r--devel/electron31/files/patch-base_features.cc20
-rw-r--r--devel/electron31/files/patch-base_files_dir__reader__linux.h39
-rw-r--r--devel/electron31/files/patch-base_files_dir__reader__posix.h20
-rw-r--r--devel/electron31/files/patch-base_files_file__path__watcher.h11
-rw-r--r--devel/electron31/files/patch-base_files_file__path__watcher__bsd.cc57
-rw-r--r--devel/electron31/files/patch-base_files_file__path__watcher__kqueue.h10
-rw-r--r--devel/electron31/files/patch-base_files_file__path__watcher__unittest.cc29
-rw-r--r--devel/electron31/files/patch-base_files_file__util__posix.cc53
-rw-r--r--devel/electron31/files/patch-base_files_file__util__unittest.cc20
-rw-r--r--devel/electron31/files/patch-base_files_important__file__writer__cleaner.cc12
-rw-r--r--devel/electron31/files/patch-base_files_scoped__file.cc11
-rw-r--r--devel/electron31/files/patch-base_functional_unretained__traits.h11
-rw-r--r--devel/electron31/files/patch-base_i18n_icu__util.cc20
-rw-r--r--devel/electron31/files/patch-base_linux__util.cc17
-rw-r--r--devel/electron31/files/patch-base_logging__unittest.cc31
-rw-r--r--devel/electron31/files/patch-base_memory_discardable__memory.cc38
-rw-r--r--devel/electron31/files/patch-base_memory_discardable__memory__internal.h11
-rw-r--r--devel/electron31/files/patch-base_memory_madv__free__discardable__memory__posix.cc21
-rw-r--r--devel/electron31/files/patch-base_memory_platform__shared__memory__region.h29
-rw-r--r--devel/electron31/files/patch-base_memory_platform__shared__memory__region__posix.cc29
-rw-r--r--devel/electron31/files/patch-base_message__loop_message__pump__glib.cc28
-rw-r--r--devel/electron31/files/patch-base_native__library__posix.cc11
-rw-r--r--devel/electron31/files/patch-base_native__library__unittest.cc11
-rw-r--r--devel/electron31/files/patch-base_posix_can__lower__nice__to.cc16
-rw-r--r--devel/electron31/files/patch-base_posix_sysctl.cc10
-rw-r--r--devel/electron31/files/patch-base_posix_unix__domain__socket.cc57
-rw-r--r--devel/electron31/files/patch-base_posix_unix__domain__socket__unittest.cc11
-rw-r--r--devel/electron31/files/patch-base_process_internal__linux.h20
-rw-r--r--devel/electron31/files/patch-base_process_kill.h11
-rw-r--r--devel/electron31/files/patch-base_process_kill__posix.cc11
-rw-r--r--devel/electron31/files/patch-base_process_launch.h11
-rw-r--r--devel/electron31/files/patch-base_process_launch__posix.cc12
-rw-r--r--devel/electron31/files/patch-base_process_memory__linux.cc44
-rw-r--r--devel/electron31/files/patch-base_process_process__handle.cc11
-rw-r--r--devel/electron31/files/patch-base_process_process__handle.h11
-rw-r--r--devel/electron31/files/patch-base_process_process__handle__freebsd.cc25
-rw-r--r--devel/electron31/files/patch-base_process_process__handle__openbsd.cc133
-rw-r--r--devel/electron31/files/patch-base_process_process__iterator__freebsd.cc51
-rw-r--r--devel/electron31/files/patch-base_process_process__iterator__openbsd.cc45
-rw-r--r--devel/electron31/files/patch-base_process_process__metrics.cc49
-rw-r--r--devel/electron31/files/patch-base_process_process__metrics.h115
-rw-r--r--devel/electron31/files/patch-base_process_process__metrics__freebsd.cc307
-rw-r--r--devel/electron31/files/patch-base_process_process__metrics__openbsd.cc234
-rw-r--r--devel/electron31/files/patch-base_process_process__metrics__posix.cc20
-rw-r--r--devel/electron31/files/patch-base_process_process__metrics__unittest.cc12
-rw-r--r--devel/electron31/files/patch-base_process_process__posix.cc94
-rw-r--r--devel/electron31/files/patch-base_process_process__unittest.cc11
-rw-r--r--devel/electron31/files/patch-base_profiler_module__cache.cc11
-rw-r--r--devel/electron31/files/patch-base_profiler_sampling__profiler__thread__token.cc20
-rw-r--r--devel/electron31/files/patch-base_profiler_sampling__profiler__thread__token.h20
-rw-r--r--devel/electron31/files/patch-base_profiler_stack__base__address__posix.cc59
-rw-r--r--devel/electron31/files/patch-base_profiler_stack__sampling__profiler__test__util.cc11
-rw-r--r--devel/electron31/files/patch-base_profiler_stack__sampling__profiler__unittest.cc11
-rw-r--r--devel/electron31/files/patch-base_profiler_thread__delegate__posix.cc20
-rw-r--r--devel/electron31/files/patch-base_rand__util.h11
-rw-r--r--devel/electron31/files/patch-base_rand__util__posix.cc62
-rw-r--r--devel/electron31/files/patch-base_strings_safe__sprintf__unittest.cc18
-rw-r--r--devel/electron31/files/patch-base_synchronization_lock__impl.h23
-rw-r--r--devel/electron31/files/patch-base_syslog__logging.cc20
-rw-r--r--devel/electron31/files/patch-base_system_sys__info.cc11
-rw-r--r--devel/electron31/files/patch-base_system_sys__info.h20
-rw-r--r--devel/electron31/files/patch-base_system_sys__info__freebsd.cc115
-rw-r--r--devel/electron31/files/patch-base_system_sys__info__openbsd.cc94
-rw-r--r--devel/electron31/files/patch-base_system_sys__info__posix.cc29
-rw-r--r--devel/electron31/files/patch-base_system_sys__info__unittest.cc20
-rw-r--r--devel/electron31/files/patch-base_task_thread__pool_environment__config__unittest.cc11
-rw-r--r--devel/electron31/files/patch-base_test_launcher_test__launcher.cc10
-rw-r--r--devel/electron31/files/patch-base_test_test__file__util__linux.cc13
-rw-r--r--devel/electron31/files/patch-base_test_test__file__util__posix.cc11
-rw-r--r--devel/electron31/files/patch-base_threading_hang__watcher.cc11
-rw-r--r--devel/electron31/files/patch-base_threading_platform__thread.h11
-rw-r--r--devel/electron31/files/patch-base_threading_platform__thread__bsd.cc34
-rw-r--r--devel/electron31/files/patch-base_threading_platform__thread__internal__posix.cc11
-rw-r--r--devel/electron31/files/patch-base_threading_platform__thread__posix.cc53
-rw-r--r--devel/electron31/files/patch-base_threading_platform__thread__unittest.cc38
-rw-r--r--devel/electron31/files/patch-base_trace__event_malloc__dump__provider.cc30
-rw-r--r--devel/electron31/files/patch-base_trace__event_memory__dump__manager.cc11
-rw-r--r--devel/electron31/files/patch-base_trace__event_process__memory__dump.cc20
-rw-r--r--devel/electron31/files/patch-base_tracing_trace__time.cc28
-rw-r--r--devel/electron31/files/patch-base_tracing_trace__time.h11
-rw-r--r--devel/electron31/files/patch-build_config_BUILD.gn13
-rw-r--r--devel/electron31/files/patch-build_config_BUILDCONFIG.gn45
-rw-r--r--devel/electron31/files/patch-build_config_clang_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-build_config_compiler_BUILD.gn132
-rw-r--r--devel/electron31/files/patch-build_config_linux_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-build_config_linux_pkg-config.py11
-rw-r--r--devel/electron31/files/patch-build_config_ozone.gni19
-rw-r--r--devel/electron31/files/patch-build_config_rust.gni13
-rw-r--r--devel/electron31/files/patch-build_config_v8__target__cpu.gni13
-rw-r--r--devel/electron31/files/patch-build_detect__host__arch.py11
-rw-r--r--devel/electron31/files/patch-build_gn__run__binary.py11
-rw-r--r--devel/electron31/files/patch-build_linux_chrome.map13
-rw-r--r--devel/electron31/files/patch-build_linux_strip__binary.py10
-rw-r--r--devel/electron31/files/patch-build_linux_unbundle_icu.gn18
-rw-r--r--devel/electron31/files/patch-build_linux_unbundle_libevent.gn15
-rw-r--r--devel/electron31/files/patch-build_linux_unbundle_libusb.gn30
-rw-r--r--devel/electron31/files/patch-build_rust_std_BUILD.gn10
-rw-r--r--devel/electron31/files/patch-build_toolchain_freebsd_BUILD.gn69
-rw-r--r--devel/electron31/files/patch-build_toolchain_gcc__solink__wrapper.py11
-rw-r--r--devel/electron31/files/patch-build_toolchain_gcc__toolchain.gni44
-rw-r--r--devel/electron31/files/patch-build_toolchain_openbsd_BUILD.gn69
-rw-r--r--devel/electron31/files/patch-build_toolchain_toolchain.gni11
-rw-r--r--devel/electron31/files/patch-cc_BUILD.gn19
-rw-r--r--devel/electron31/files/patch-cc_base_features.cc11
-rw-r--r--devel/electron31/files/patch-chrome_app_chrome__command__ids.h17
-rw-r--r--devel/electron31/files/patch-chrome_app_chrome__main.cc43
-rw-r--r--devel/electron31/files/patch-chrome_app_chrome__main__delegate.cc154
-rw-r--r--devel/electron31/files/patch-chrome_browser_BUILD.gn16
-rw-r--r--devel/electron31/files/patch-chrome_browser_about__flags.cc218
-rw-r--r--devel/electron31/files/patch-chrome_browser_after__startup__task__utils.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_apps_app__service_publishers_extension__apps.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_apps_platform__apps_platform__app__launch.cc65
-rw-r--r--devel/electron31/files/patch-chrome_browser_apps_platform__apps_platform__app__launch.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_autocomplete_chrome__autocomplete__scheme__classifier.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_background_background__mode__manager.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_background_background__mode__optimizer.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_browser__features.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_browser__process__impl.cc29
-rw-r--r--devel/electron31/files/patch-chrome_browser_browser__process__impl.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_chrome__browser__interface__binders.cc71
-rw-r--r--devel/electron31/files/patch-chrome_browser_chrome__browser__main.cc118
-rw-r--r--devel/electron31/files/patch-chrome_browser_chrome__browser__main__extra__parts__linux.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_chrome__browser__main__extra__parts__ozone.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_chrome__browser__main__linux.cc39
-rw-r--r--devel/electron31/files/patch-chrome_browser_chrome__browser__main__linux.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_chrome__browser__main__posix.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_chrome__content__browser__client.cc161
-rw-r--r--devel/electron31/files/patch-chrome_browser_chrome__content__browser__client.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_component__updater_widevine__cdm__component__installer.cc38
-rw-r--r--devel/electron31/files/patch-chrome_browser_custom__handlers_chrome__protocol__handler__registry__delegate.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_defaults.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_device__identity_device__oauth2__token__service__factory.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_diagnostics_diagnostics__writer.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_download_chrome__download__manager__delegate.cc29
-rw-r--r--devel/electron31/files/patch-chrome_browser_download_download__commands.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_download_download__commands.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_download_download__file__picker.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_download_download__item__model.cc29
-rw-r--r--devel/electron31/files/patch-chrome_browser_download_download__prefs.cc90
-rw-r--r--devel/electron31/files/patch-chrome_browser_download_download__prefs.h20
-rw-r--r--devel/electron31/files/patch-chrome_browser_enterprise_browser__management_browser__management__service.cc29
-rw-r--r--devel/electron31/files/patch-chrome_browser_enterprise_browser__management_browser__management__service.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_enterprise_connectors_analysis_analysis__service__settings.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_enterprise_connectors_connectors__service.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__connector__service__factory.cc29
-rw-r--r--devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__service__factory.cc29
-rw-r--r--devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_key__management_browser_commands_key__rotation__command__factory.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_key__management_core_persistence_key__persistence__delegate__factory.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_signals_signals__service__factory.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_enterprise_connectors_reporting_browser__crash__event__router.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_enterprise_connectors_reporting_crash__reporting__context.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.cc38
-rw-r--r--devel/electron31/files/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.h20
-rw-r--r--devel/electron31/files/patch-chrome_browser_enterprise_identifiers_profile__id__delegate__impl.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_enterprise_profile__management_profile__management__navigation__throttle.cc13
-rw-r--r--devel/electron31/files/patch-chrome_browser_enterprise_remote__commands_cbcm__remote__commands__factory.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_enterprise_signals_device__info__fetcher.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_enterprise_signals_device__info__fetcher__linux.cc78
-rw-r--r--devel/electron31/files/patch-chrome_browser_enterprise_watermark_watermark__view.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_extensions_BUILD.gn13
-rw-r--r--devel/electron31/files/patch-chrome_browser_extensions_api_api__browser__context__keyed__service__factories.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_chrome__desktop__report__request__helper.cc29
-rw-r--r--devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.cc38
-rw-r--r--devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.h29
-rw-r--r--devel/electron31/files/patch-chrome_browser_extensions_api_image__writer__private_removable__storage__provider.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_extensions_api_management_chrome__management__api__delegate.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_extensions_api_messaging_native__process__launcher__posix.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_extensions_api_passwords__private_passwords__private__delegate__impl.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_extensions_api_runtime_chrome__runtime__api__delegate.cc13
-rw-r--r--devel/electron31/files/patch-chrome_browser_extensions_api_settings__private_prefs__util.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_extensions_api_tabs_tabs__api.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_extensions_api_webrtc__logging__private_webrtc__logging__private__api.cc29
-rw-r--r--devel/electron31/files/patch-chrome_browser_extensions_api_webstore__private_webstore__private__api.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_extensions_external__provider__impl.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_first__run_first__run__dialog.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_first__run_first__run__internal.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_flag__descriptions.cc91
-rw-r--r--devel/electron31/files/patch-chrome_browser_flag__descriptions.h90
-rw-r--r--devel/electron31/files/patch-chrome_browser_gcm_gcm__profile__service__factory.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_gcm_instance__id_instance__id__profile__service__factory.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_headless_headless__mode__util.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_intranet__redirect__detector.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_media__galleries_fileapi_mtp__device__map__service.cc15
-rw-r--r--devel/electron31/files/patch-chrome_browser_media__galleries_media__file__system__registry.cc16
-rw-r--r--devel/electron31/files/patch-chrome_browser_media_audio__service__util.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_media_router_discovery_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-chrome_browser_media_router_discovery_discovery__network__list__posix.cc48
-rw-r--r--devel/electron31/files/patch-chrome_browser_media_router_discovery_discovery__network__list__wifi__linux.cc30
-rw-r--r--devel/electron31/files/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.cc47
-rw-r--r--devel/electron31/files/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.h20
-rw-r--r--devel/electron31/files/patch-chrome_browser_media_webrtc_desktop__media__picker__controller.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_media_webrtc_webrtc__log__uploader.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_media_webrtc_webrtc__logging__controller.cc33
-rw-r--r--devel/electron31/files/patch-chrome_browser_media_webrtc_webrtc__logging__controller.h20
-rw-r--r--devel/electron31/files/patch-chrome_browser_memory__details.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.cc55
-rw-r--r--devel/electron31/files/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.h20
-rw-r--r--devel/electron31/files/patch-chrome_browser_metrics_chrome__metrics__service__client.cc83
-rw-r--r--devel/electron31/files/patch-chrome_browser_metrics_perf_cpu__identity.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_metrics_power_process__metrics__recorder__util.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_metrics_power_process__monitor.cc29
-rw-r--r--devel/electron31/files/patch-chrome_browser_metrics_power_process__monitor.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_net_system__network__context__manager.cc174
-rw-r--r--devel/electron31/files/patch-chrome_browser_net_system__network__context__manager.h29
-rw-r--r--devel/electron31/files/patch-chrome_browser_new__tab__page_modules_file__suggestion_drive__service.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_new__tab__page_new__tab__page__util.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_notifications_notification__display__service__impl.cc38
-rw-r--r--devel/electron31/files/patch-chrome_browser_notifications_notification__platform__bridge__delegator.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_password__manager_chrome__password__manager__client.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_password__manager_password__reuse__manager__factory.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_platform__util__linux.cc12
-rw-r--r--devel/electron31/files/patch-chrome_browser_policy_browser__signin__policy__handler.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_policy_chrome__browser__cloud__management__controller__desktop.cc38
-rw-r--r--devel/electron31/files/patch-chrome_browser_policy_configuration__policy__handler__list__factory.cc254
-rw-r--r--devel/electron31/files/patch-chrome_browser_policy_device__management__service__configuration.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_policy_policy__value__and__status__aggregator.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_prefs_browser__prefs.cc57
-rw-r--r--devel/electron31/files/patch-chrome_browser_prefs_pref__service__incognito__allowlist.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_printing_print__backend__service__manager.cc29
-rw-r--r--devel/electron31/files/patch-chrome_browser_printing_printer__query.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_process__singleton__posix.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_profiles_chrome__browser__main__extra__parts__profiles.cc114
-rw-r--r--devel/electron31/files/patch-chrome_browser_profiles_profile__impl.cc40
-rw-r--r--devel/electron31/files/patch-chrome_browser_profiles_profiles__state.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_renderer__preferences__util.cc29
-rw-r--r--devel/electron31/files/patch-chrome_browser_resources_settings_autofill__page_passwords__shared.css11
-rw-r--r--devel/electron31/files/patch-chrome_browser_resources_signin_signin__shared.css11
-rw-r--r--devel/electron31/files/patch-chrome_browser_safe__browsing_cloud__content__scanning_binary__upload__service.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_safe__browsing_download__protection_file__analyzer.cc29
-rw-r--r--devel/electron31/files/patch-chrome_browser_safe__browsing_download__protection_file__analyzer.h29
-rw-r--r--devel/electron31/files/patch-chrome_browser_safe__browsing_incident__reporting_incident__reporting__service.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_screen__ai_screen__ai__install__state.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_screen__ai_screen__ai__service__router.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_send__tab__to__self_receiving__ui__handler__registry.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_send__tab__to__self_send__tab__to__self__client__service.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_sharing_sharing__device__registration.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_sharing_sharing__handler__registry__impl.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_shortcuts_icon__badging.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_signin_signin__util.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_supervised__user_supervised__user__extensions__delegate__impl.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_supervised__user_supervised__user__navigation__observer.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_sync_chrome__sync__client.cc38
-rw-r--r--devel/electron31/files/patch-chrome_browser_sync_device__info__sync__client__impl.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_sync_sync__service__factory.cc29
-rw-r--r--devel/electron31/files/patch-chrome_browser_sync_sync__service__util.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__group.cc38
-rw-r--r--devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__group.h38
-rw-r--r--devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__group__sampler.cc47
-rw-r--r--devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__group__sampler.h38
-rw-r--r--devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__manager__impl.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_task__manager_task__manager__observer.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_themes_theme__helper.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_themes_theme__service.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_themes_theme__service__aura__linux.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_themes_theme__service__factory.cc37
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_actions_chrome__action__id.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.h38
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_browser.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_browser__command__controller.cc62
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_browser__ui__prefs.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_browser__view__prefs.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_chrome__pages.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_chrome__pages.h20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_color_native__chrome__color__mixer.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_omnibox_omnibox__pedal__implementations.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_passwords_bubble__controllers_relaunch__chrome__bubble__controller.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_passwords_manage__passwords__ui__controller.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_sad__tab.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_sharing__hub_sharing__hub__bubble__controller.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_signin_signin__view__controller.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_signin_signin__view__controller__delegate.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_startup_bad__flags__prompt.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_startup_startup__browser__creator.cc38
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_startup_startup__browser__creator__impl.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_startup_startup__tab__provider.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_tab__helpers.cc26
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_task__manager_task__manager__columns.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_task__manager_task__manager__table__model.cc29
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_test_popup__browsertest.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_test_test__browser__ui.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_ui__features.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_ui__features.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_accelerator__table.cc43
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_apps_chrome__native__app__window__views__aura.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_chrome__browser__main__extra__parts__views.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_chrome__views__delegate.h16
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_chrome__views__delegate__linux.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_compose_compose__dialog__view.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame.cc56
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame.h20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux__native.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame__view__linux.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__non__client__frame__view__factory__views.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__view.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.cc38
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.h20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view__layout__delegate.h20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.cc92
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.h47
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_frame_system__menu__model__builder.cc29
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_frame_system__menu__model__delegate.cc29
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_frame_tab__strip__region__view.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_hung__renderer__view.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_omnibox_omnibox__view__views.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_passwords_password__bubble__view__base.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_profiles_profile__menu__view.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_profiles_profile__menu__view__base.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.cc47
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.h20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_tab__search__bubble__host.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_tabs_tab.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_tabs_tab__drag__controller.cc56
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_tabs_tab__hover__card__bubble__view.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_tabs_tab__style__views.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_user__education_browser__user__education__service.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_views_web__apps_web__app__integration__test__driver.cc83
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_web__applications_web__app__dialogs.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_webui_about_about__ui.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_webui_app__home_app__home__page__handler.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_webui_chrome__web__ui__controller__factory.cc91
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_webui_connectors__internals_device__trust__utils.cc29
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui.cc16
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui__constants.cc17
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui__constants.h19
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui__handler.cc29
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui__handler.h20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_webui_password__manager_promo__cards__handler.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_webui_password__manager_promo__cards_relaunch__chrome__promo.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_webui_searchbox_searchbox__handler.cc29
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_webui_settings_accessibility__main__handler.cc46
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_webui_settings_accessibility__main__handler.h47
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_webui_settings_appearance__handler.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_webui_settings_settings__localized__strings__provider.cc56
-rw-r--r--devel/electron31/files/patch-chrome_browser_ui_window__sizer_window__sizer.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_visited__url__ranking_visited__url__ranking__service__factory.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_web__applications_extension__status__utils.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_web__applications_extensions_extension__status__utils.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_web__applications_os__integration_os__integration__test__override.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_web__applications_os__integration_run__on__os__login__sub__manager.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_web__applications_os__integration_shortcut__sub__manager.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_web__applications_os__integration_web__app__file__handler__registration.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.cc20
-rw-r--r--devel/electron31/files/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.h20
-rw-r--r--devel/electron31/files/patch-chrome_browser_web__applications_os__integration_web__app__shortcut__manager.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_web__applications_policy_web__app__policy__manager.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.cc119
-rw-r--r--devel/electron31/files/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.h38
-rw-r--r--devel/electron31/files/patch-chrome_browser_web__applications_web__app__helpers.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_web__applications_web__app__install__info.h11
-rw-r--r--devel/electron31/files/patch-chrome_browser_webauthn_chrome__authenticator__request__delegate.cc11
-rw-r--r--devel/electron31/files/patch-chrome_browser_webauthn_enclave__manager.cc20
-rw-r--r--devel/electron31/files/patch-chrome_common_channel__info.h20
-rw-r--r--devel/electron31/files/patch-chrome_common_channel__info__posix.cc20
-rw-r--r--devel/electron31/files/patch-chrome_common_chrome__features.cc74
-rw-r--r--devel/electron31/files/patch-chrome_common_chrome__features.h45
-rw-r--r--devel/electron31/files/patch-chrome_common_chrome__paths.cc84
-rw-r--r--devel/electron31/files/patch-chrome_common_chrome__paths.h29
-rw-r--r--devel/electron31/files/patch-chrome_common_chrome__paths__internal.h11
-rw-r--r--devel/electron31/files/patch-chrome_common_chrome__switches.cc19
-rw-r--r--devel/electron31/files/patch-chrome_common_chrome__switches.h17
-rw-r--r--devel/electron31/files/patch-chrome_common_extensions_permissions_chrome__permission__message__rules.cc11
-rw-r--r--devel/electron31/files/patch-chrome_common_media_cdm__host__file__path.cc11
-rw-r--r--devel/electron31/files/patch-chrome_common_media_cdm__registration.cc61
-rw-r--r--devel/electron31/files/patch-chrome_common_media_cdm__registration.h11
-rw-r--r--devel/electron31/files/patch-chrome_common_media_component__widevine__cdm__hint__file__linux.h11
-rw-r--r--devel/electron31/files/patch-chrome_common_pref__names.h91
-rw-r--r--devel/electron31/files/patch-chrome_common_url__constants.h11
-rw-r--r--devel/electron31/files/patch-chrome_common_webui__url__constants.cc94
-rw-r--r--devel/electron31/files/patch-chrome_common_webui__url__constants.h56
-rw-r--r--devel/electron31/files/patch-chrome_services_file__util_public_mojom_safe__document__analyzer__mojom__traits.h11
-rw-r--r--devel/electron31/files/patch-chrome_services_printing_print__backend__service__impl.cc47
-rw-r--r--devel/electron31/files/patch-chrome_services_speech_audio__source__fetcher__impl.cc11
-rw-r--r--devel/electron31/files/patch-chrome_test_base_scoped__channel__override__posix.cc11
-rw-r--r--devel/electron31/files/patch-chrome_test_chromedriver_chrome__launcher.cc10
-rw-r--r--devel/electron31/files/patch-chrome_test_chromedriver_chrome_chrome__finder.cc29
-rw-r--r--devel/electron31/files/patch-chrome_test_chromedriver_key__converter__unittest.cc20
-rw-r--r--devel/electron31/files/patch-chrome_test_chromedriver_keycode__text__conversion__unittest.cc20
-rw-r--r--devel/electron31/files/patch-chrome_updater_configurator.cc11
-rw-r--r--devel/electron31/files/patch-chrome_updater_util_posix__util.cc11
-rw-r--r--devel/electron31/files/patch-chrome_utility_services.cc65
-rw-r--r--devel/electron31/files/patch-chromecast_browser_cast__browser__main__parts.cc38
-rw-r--r--devel/electron31/files/patch-chromecast_browser_cast__content__browser__client.cc11
-rw-r--r--devel/electron31/files/patch-chromecast_cast__core_runtime_browser_runtime__application__service__impl.cc11
-rw-r--r--devel/electron31/files/patch-chromecast_media_base_default__monotonic__clock.cc20
-rw-r--r--devel/electron31/files/patch-components_autofill_core_browser_payments__data__manager.cc11
-rw-r--r--devel/electron31/files/patch-components_autofill_core_common_autofill__payments__features.cc11
-rw-r--r--devel/electron31/files/patch-components_autofill_core_common_autofill__util.cc11
-rw-r--r--devel/electron31/files/patch-components_commerce_core_commerce__feature__list.cc20
-rw-r--r--devel/electron31/files/patch-components_constrained__window_constrained__window__views.cc11
-rw-r--r--devel/electron31/files/patch-components_content__settings_core_browser_website__settings__registry.cc11
-rw-r--r--devel/electron31/files/patch-components_cookie__config_cookie__store__util.cc11
-rw-r--r--devel/electron31/files/patch-components_crash_core_app_BUILD.gn43
-rw-r--r--devel/electron31/files/patch-components_crash_core_app_chrome__crashpad__handler.cc12
-rw-r--r--devel/electron31/files/patch-components_crash_core_app_crashpad__handler__main.cc20
-rw-r--r--devel/electron31/files/patch-components_crash_core_browser_crash__upload__list__crashpad.cc26
-rw-r--r--devel/electron31/files/patch-components_crash_core_common_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-components_device__signals_core_browser_mock__signals__aggregator.h11
-rw-r--r--devel/electron31/files/patch-components_device__signals_core_browser_signals__aggregator.h11
-rw-r--r--devel/electron31/files/patch-components_device__signals_core_browser_signals__aggregator__impl.cc11
-rw-r--r--devel/electron31/files/patch-components_device__signals_core_browser_signals__aggregator__impl.h11
-rw-r--r--devel/electron31/files/patch-components_device__signals_core_browser_user__permission__service.h11
-rw-r--r--devel/electron31/files/patch-components_device__signals_core_browser_user__permission__service__impl.cc11
-rw-r--r--devel/electron31/files/patch-components_device__signals_core_browser_user__permission__service__impl.h11
-rw-r--r--devel/electron31/files/patch-components_device__signals_core_common_signals__features.cc11
-rw-r--r--devel/electron31/files/patch-components_device__signals_core_common_signals__features.h11
-rw-r--r--devel/electron31/files/patch-components_device__signals_core_system__signals_platform__delegate.cc11
-rw-r--r--devel/electron31/files/patch-components_device__signals_test_signals__contract.cc11
-rw-r--r--devel/electron31/files/patch-components_discardable__memory_service_discardable__shared__memory__manager.cc11
-rw-r--r--devel/electron31/files/patch-components_embedder__support_user__agent__utils.cc12
-rw-r--r--devel/electron31/files/patch-components_embedder__support_user__agent__utils__unittest.cc29
-rw-r--r--devel/electron31/files/patch-components_eye__dropper_eye__dropper__view.cc11
-rw-r--r--devel/electron31/files/patch-components_feature__engagement_public_event__constants.cc11
-rw-r--r--devel/electron31/files/patch-components_feature__engagement_public_event__constants.h11
-rw-r--r--devel/electron31/files/patch-components_feature__engagement_public_feature__configurations.cc29
-rw-r--r--devel/electron31/files/patch-components_feature__engagement_public_feature__constants.cc30
-rw-r--r--devel/electron31/files/patch-components_feature__engagement_public_feature__constants.h30
-rw-r--r--devel/electron31/files/patch-components_feature__engagement_public_feature__list.cc30
-rw-r--r--devel/electron31/files/patch-components_feature__engagement_public_feature__list.h58
-rw-r--r--devel/electron31/files/patch-components_feed_core_proto_v2_wire_version.proto13
-rw-r--r--devel/electron31/files/patch-components_feed_core_v2_feed__network__impl__unittest.cc13
-rw-r--r--devel/electron31/files/patch-components_feed_core_v2_proto__util.cc24
-rw-r--r--devel/electron31/files/patch-components_feed_core_v2_proto__util__unittest.cc13
-rw-r--r--devel/electron31/files/patch-components_feed_core_v2_test_proto__printer.cc13
-rw-r--r--devel/electron31/files/patch-components_flags__ui_flags__state.cc11
-rw-r--r--devel/electron31/files/patch-components_gwp__asan_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-components_gwp__asan_client_guarded__page__allocator__posix.cc13
-rw-r--r--devel/electron31/files/patch-components_gwp__asan_client_gwp__asan.cc11
-rw-r--r--devel/electron31/files/patch-components_gwp__asan_client_gwp__asan__features.cc11
-rw-r--r--devel/electron31/files/patch-components_gwp__asan_crash__handler_crash__analyzer.cc20
-rw-r--r--devel/electron31/files/patch-components_live__caption_caption__util.cc11
-rw-r--r--devel/electron31/files/patch-components_live__caption_caption__util.h11
-rw-r--r--devel/electron31/files/patch-components_media__router_common_media__source.cc11
-rw-r--r--devel/electron31/files/patch-components_media__router_common_providers_cast_channel_cast__message__util.cc11
-rw-r--r--devel/electron31/files/patch-components_metrics_drive__metrics__provider__linux.cc16
-rw-r--r--devel/electron31/files/patch-components_metrics_metrics__log.cc38
-rw-r--r--devel/electron31/files/patch-components_metrics_motherboard.cc10
-rw-r--r--devel/electron31/files/patch-components_named__mojo__ipc__server_connection__info.h20
-rw-r--r--devel/electron31/files/patch-components_named__mojo__ipc__server_named__mojo__ipc__server__client__util.cc11
-rw-r--r--devel/electron31/files/patch-components_neterror_resources_neterror.js11
-rw-r--r--devel/electron31/files/patch-components_network__session__configurator_browser_network__session__configurator.cc11
-rw-r--r--devel/electron31/files/patch-components_network__session__configurator_browser_network__session__configurator__unittest.cc11
-rw-r--r--devel/electron31/files/patch-components_optimization__guide_core_optimization__guide__util.cc11
-rw-r--r--devel/electron31/files/patch-components_os__crypt_sync_libsecret__util__linux.cc27
-rw-r--r--devel/electron31/files/patch-components_os__crypt_sync_os__crypt.h72
-rw-r--r--devel/electron31/files/patch-components_paint__preview_browser_paint__preview__client.cc13
-rw-r--r--devel/electron31/files/patch-components_paint__preview_browser_paint__preview__client__unittest.cc13
-rw-r--r--devel/electron31/files/patch-components_paint__preview_common_proto_paint__preview.proto13
-rw-r--r--devel/electron31/files/patch-components_paint__preview_player_player__compositor__delegate.cc13
-rw-r--r--devel/electron31/files/patch-components_password__manager_core_browser_features_password__features.cc20
-rw-r--r--devel/electron31/files/patch-components_password__manager_core_browser_features_password__features.h11
-rw-r--r--devel/electron31/files/patch-components_password__manager_core_browser_password__form__manager.cc29
-rw-r--r--devel/electron31/files/patch-components_password__manager_core_browser_password__manager.cc11
-rw-r--r--devel/electron31/files/patch-components_password__manager_core_browser_password__manager__client.h20
-rw-r--r--devel/electron31/files/patch-components_password__manager_core_browser_password__manager__switches.cc11
-rw-r--r--devel/electron31/files/patch-components_password__manager_core_browser_password__manager__switches.h11
-rw-r--r--devel/electron31/files/patch-components_password__manager_core_browser_password__manual__fallback__flow.cc11
-rw-r--r--devel/electron31/files/patch-components_password__manager_core_browser_password__manual__fallback__flow.h20
-rw-r--r--devel/electron31/files/patch-components_password__manager_core_browser_password__store_login__database__async__helper.cc11
-rw-r--r--devel/electron31/files/patch-components_password__manager_core_browser_password__store_login__database__unittest.cc11
-rw-r--r--devel/electron31/files/patch-components_password__manager_core_browser_stub__password__manager__client.cc11
-rw-r--r--devel/electron31/files/patch-components_password__manager_core_browser_stub__password__manager__client.h11
-rw-r--r--devel/electron31/files/patch-components_password__manager_core_browser_sync_password__sync__bridge.cc11
-rw-r--r--devel/electron31/files/patch-components_password__manager_core_common_password__manager__features.cc11
-rw-r--r--devel/electron31/files/patch-components_password__manager_core_common_password__manager__features.h11
-rw-r--r--devel/electron31/files/patch-components_password__manager_core_common_password__manager__pref__names.h11
-rw-r--r--devel/electron31/files/patch-components_performance__manager_public_features.h11
-rw-r--r--devel/electron31/files/patch-components_permissions_prediction__service_prediction__common.cc20
-rw-r--r--devel/electron31/files/patch-components_policy_core_browser_policy__pref__mapping__test.cc11
-rw-r--r--devel/electron31/files/patch-components_policy_core_common_cloud_cloud__policy__client.cc11
-rw-r--r--devel/electron31/files/patch-components_policy_core_common_cloud_cloud__policy__util.cc55
-rw-r--r--devel/electron31/files/patch-components_policy_core_common_policy__loader__common.cc20
-rw-r--r--devel/electron31/files/patch-components_policy_core_common_policy__paths.cc11
-rw-r--r--devel/electron31/files/patch-components_policy_core_common_policy__utils.cc11
-rw-r--r--devel/electron31/files/patch-components_policy_tools_generate__policy__source.py14
-rw-r--r--devel/electron31/files/patch-components_power__metrics_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-components_power__metrics_energy__metrics__provider.cc21
-rw-r--r--devel/electron31/files/patch-components_safe__browsing_content_common_file__type__policies__unittest.cc11
-rw-r--r--devel/electron31/files/patch-components_safe__browsing_content_resources_gen__file__type__proto.py20
-rw-r--r--devel/electron31/files/patch-components_safe__browsing_core_browser_db_v4__protocol__manager__util.cc11
-rw-r--r--devel/electron31/files/patch-components_safe__browsing_core_browser_realtime_url__lookup__service__base.cc11
-rw-r--r--devel/electron31/files/patch-components_safe__browsing_core_common_features.cc11
-rw-r--r--devel/electron31/files/patch-components_search__engines_search__engine__choice_search__engine__choice__service.cc11
-rw-r--r--devel/electron31/files/patch-components_search__engines_template__url__service.cc11
-rw-r--r--devel/electron31/files/patch-components_security__interstitials_content_utils.cc11
-rw-r--r--devel/electron31/files/patch-components_segmentation__platform_embedder_default__model_cross__device__user__segment.cc11
-rw-r--r--devel/electron31/files/patch-components_services_paint__preview__compositor_paint__preview__compositor__collection__impl.cc29
-rw-r--r--devel/electron31/files/patch-components_signin_public_base_signin__switches.cc20
-rw-r--r--devel/electron31/files/patch-components_signin_public_base_signin__switches.h11
-rw-r--r--devel/electron31/files/patch-components_soda_soda__util.cc29
-rw-r--r--devel/electron31/files/patch-components_startup__metric__utils_common_startup__metric__utils.cc11
-rw-r--r--devel/electron31/files/patch-components_storage__monitor_BUILD.gn20
-rw-r--r--devel/electron31/files/patch-components_storage__monitor_removable__device__constants.cc11
-rw-r--r--devel/electron31/files/patch-components_storage__monitor_removable__device__constants.h11
-rw-r--r--devel/electron31/files/patch-components_supervised__user_core_browser_supervised__user__preferences.cc11
-rw-r--r--devel/electron31/files/patch-components_supervised__user_core_browser_supervised__user__service.cc11
-rw-r--r--devel/electron31/files/patch-components_supervised__user_core_common_features.cc20
-rw-r--r--devel/electron31/files/patch-components_supervised__user_core_common_features.h11
-rw-r--r--devel/electron31/files/patch-components_supervised__user_core_common_pref__names.h11
-rw-r--r--devel/electron31/files/patch-components_sync__device__info_local__device__info__util.cc29
-rw-r--r--devel/electron31/files/patch-components_sync__device__info_local__device__info__util__linux.cc14
-rw-r--r--devel/electron31/files/patch-components_system__cpu_cpu__probe.cc12
-rw-r--r--devel/electron31/files/patch-components_translate_core_common_translate__util.cc11
-rw-r--r--devel/electron31/files/patch-components_update__client_update__query__params.cc11
-rw-r--r--devel/electron31/files/patch-components_url__formatter_spoof__checks_idn__spoof__checker.cc11
-rw-r--r--devel/electron31/files/patch-components_user__education_views_help__bubble__view.cc11
-rw-r--r--devel/electron31/files/patch-components_variations_service_variations__service.cc11
-rw-r--r--devel/electron31/files/patch-components_viz_common_features.cc20
-rw-r--r--devel/electron31/files/patch-components_viz_common_features.h20
-rw-r--r--devel/electron31/files/patch-components_viz_host_host__display__client.cc11
-rw-r--r--devel/electron31/files/patch-components_viz_host_host__display__client.h11
-rw-r--r--devel/electron31/files/patch-components_viz_service_display__embedder_skia__output__device__buffer__queue.cc11
-rw-r--r--devel/electron31/files/patch-components_viz_service_display__embedder_skia__output__surface__impl.cc11
-rw-r--r--devel/electron31/files/patch-components_viz_service_display__embedder_software__output__surface.cc20
-rw-r--r--devel/electron31/files/patch-components_viz_service_display__embedder_software__output__surface.h20
-rw-r--r--devel/electron31/files/patch-components_viz_service_display_skia__renderer.cc11
-rw-r--r--devel/electron31/files/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.cc20
-rw-r--r--devel/electron31/files/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.h11
-rw-r--r--devel/electron31/files/patch-components_viz_test_fake__display__client.cc11
-rw-r--r--devel/electron31/files/patch-components_viz_test_fake__display__client.h11
-rw-r--r--devel/electron31/files/patch-components_viz_test_mock__display__client.h11
-rw-r--r--devel/electron31/files/patch-content_app_content__main.cc11
-rw-r--r--devel/electron31/files/patch-content_app_content__main__runner__impl.cc129
-rw-r--r--devel/electron31/files/patch-content_browser_BUILD.gn16
-rw-r--r--devel/electron31/files/patch-content_browser_audio_audio__service.cc20
-rw-r--r--devel/electron31/files/patch-content_browser_browser__child__process__host__impl.cc19
-rw-r--r--devel/electron31/files/patch-content_browser_browser__child__process__host__impl.h20
-rw-r--r--devel/electron31/files/patch-content_browser_browser__child__process__host__impl__receiver__bindings.cc11
-rw-r--r--devel/electron31/files/patch-content_browser_browser__main__loop.cc37
-rw-r--r--devel/electron31/files/patch-content_browser_child__process__launcher__helper.h11
-rw-r--r--devel/electron31/files/patch-content_browser_child__process__launcher__helper__linux.cc139
-rw-r--r--devel/electron31/files/patch-content_browser_child__thread__type__switcher__linux.cc20
-rw-r--r--devel/electron31/files/patch-content_browser_compositor_viz__process__transport__factory.cc11
-rw-r--r--devel/electron31/files/patch-content_browser_devtools_devtools__frontend__host__impl.cc38
-rw-r--r--devel/electron31/files/patch-content_browser_devtools_devtools__frontend__host__impl.h11
-rw-r--r--devel/electron31/files/patch-content_browser_devtools_protocol_system__info__handler.cc11
-rw-r--r--devel/electron31/files/patch-content_browser_file__system__access_file__system__access__local__path__watcher.cc11
-rw-r--r--devel/electron31/files/patch-content_browser_font__access_font__enumeration__data__source.cc29
-rw-r--r--devel/electron31/files/patch-content_browser_gpu_compositor__util.cc20
-rw-r--r--devel/electron31/files/patch-content_browser_gpu_gpu__data__manager__impl.cc11
-rw-r--r--devel/electron31/files/patch-content_browser_gpu_gpu__data__manager__impl.h11
-rw-r--r--devel/electron31/files/patch-content_browser_gpu_gpu__data__manager__impl__private.cc11
-rw-r--r--devel/electron31/files/patch-content_browser_gpu_gpu__data__manager__impl__private.h20
-rw-r--r--devel/electron31/files/patch-content_browser_gpu_gpu__memory__buffer__manager__singleton.cc20
-rw-r--r--devel/electron31/files/patch-content_browser_gpu_gpu__process__host.cc19
-rw-r--r--devel/electron31/files/patch-content_browser_media_frameless__media__interface__proxy.h20
-rw-r--r--devel/electron31/files/patch-content_browser_media_media__keys__listener__manager__impl.cc11
-rw-r--r--devel/electron31/files/patch-content_browser_network__service__instance__impl.cc29
-rw-r--r--devel/electron31/files/patch-content_browser_ppapi__plugin__process__host__receiver__bindings.cc20
-rw-r--r--devel/electron31/files/patch-content_browser_renderer__host_delegated__frame__host.cc11
-rw-r--r--devel/electron31/files/patch-content_browser_renderer__host_input_input__device__change__observer.cc29
-rw-r--r--devel/electron31/files/patch-content_browser_renderer__host_media_service__video__capture__device__launcher.cc20
-rw-r--r--devel/electron31/files/patch-content_browser_renderer__host_pepper_pepper__file__io__host.cc20
-rw-r--r--devel/electron31/files/patch-content_browser_renderer__host_render__process__host__impl.cc64
-rw-r--r--devel/electron31/files/patch-content_browser_renderer__host_render__process__host__impl.h11
-rw-r--r--devel/electron31/files/patch-content_browser_renderer__host_render__view__host__impl.cc11
-rw-r--r--devel/electron31/files/patch-content_browser_renderer__host_render__widget__host__view__aura.cc47
-rw-r--r--devel/electron31/files/patch-content_browser_renderer__host_render__widget__host__view__aura.h11
-rw-r--r--devel/electron31/files/patch-content_browser_renderer__host_render__widget__host__view__event__handler.cc11
-rw-r--r--devel/electron31/files/patch-content_browser_sandbox__host__linux.cc18
-rw-r--r--devel/electron31/files/patch-content_browser_scheduler_responsiveness_jank__monitor__impl.cc11
-rw-r--r--devel/electron31/files/patch-content_browser_scheduler_responsiveness_native__event__observer.cc20
-rw-r--r--devel/electron31/files/patch-content_browser_scheduler_responsiveness_native__event__observer.h47
-rw-r--r--devel/electron31/files/patch-content_browser_utility__process__host.cc82
-rw-r--r--devel/electron31/files/patch-content_browser_utility__process__host.h20
-rw-r--r--devel/electron31/files/patch-content_browser_utility__process__host__receiver__bindings.cc33
-rw-r--r--devel/electron31/files/patch-content_browser_utility__sandbox__delegate.cc28
-rw-r--r--devel/electron31/files/patch-content_browser_v8__snapshot__files.cc11
-rw-r--r--devel/electron31/files/patch-content_browser_web__contents_web__contents__view__aura.cc29
-rw-r--r--devel/electron31/files/patch-content_browser_webui_web__ui__main__frame__observer.cc38
-rw-r--r--devel/electron31/files/patch-content_browser_webui_web__ui__main__frame__observer.h20
-rw-r--r--devel/electron31/files/patch-content_browser_zygote__host_zygote__host__impl__linux.cc81
-rw-r--r--devel/electron31/files/patch-content_browser_zygote__host_zygote__host__impl__linux.h29
-rw-r--r--devel/electron31/files/patch-content_child_BUILD.gn16
-rw-r--r--devel/electron31/files/patch-content_child_child__process.cc11
-rw-r--r--devel/electron31/files/patch-content_common_BUILD.gn36
-rw-r--r--devel/electron31/files/patch-content_common_features.cc20
-rw-r--r--devel/electron31/files/patch-content_common_features.h20
-rw-r--r--devel/electron31/files/patch-content_common_font__list__unittest.cc11
-rw-r--r--devel/electron31/files/patch-content_common_gpu__pre__sandbox__hook__bsd.cc71
-rw-r--r--devel/electron31/files/patch-content_common_gpu__pre__sandbox__hook__bsd.h23
-rw-r--r--devel/electron31/files/patch-content_common_gpu__pre__sandbox__hook__linux.h16
-rw-r--r--devel/electron31/files/patch-content_common_mojo__core__library__support.cc11
-rw-r--r--devel/electron31/files/patch-content_common_user__agent.cc37
-rw-r--r--devel/electron31/files/patch-content_gpu_gpu__child__thread.cc21
-rw-r--r--devel/electron31/files/patch-content_gpu_gpu__main.cc73
-rw-r--r--devel/electron31/files/patch-content_ppapi__plugin_ppapi__blink__platform__impl.cc29
-rw-r--r--devel/electron31/files/patch-content_ppapi__plugin_ppapi__blink__platform__impl.h11
-rw-r--r--devel/electron31/files/patch-content_ppapi__plugin_ppapi__plugin__main.cc23
-rw-r--r--devel/electron31/files/patch-content_public_browser_content__browser__client.cc11
-rw-r--r--devel/electron31/files/patch-content_public_browser_service__process__host.cc11
-rw-r--r--devel/electron31/files/patch-content_public_browser_zygote__host_zygote__host__linux.h16
-rw-r--r--devel/electron31/files/patch-content_public_common_content__features.cc35
-rw-r--r--devel/electron31/files/patch-content_public_common_content__switches.cc20
-rw-r--r--devel/electron31/files/patch-content_public_common_content__switches.h19
-rw-r--r--devel/electron31/files/patch-content_public_common_zygote_features.gni8
-rw-r--r--devel/electron31/files/patch-content_renderer_media_gpu_gpu__video__accelerator__factories__impl.cc11
-rw-r--r--devel/electron31/files/patch-content_renderer_render__thread__impl.cc38
-rw-r--r--devel/electron31/files/patch-content_renderer_renderer__blink__platform__impl.cc45
-rw-r--r--devel/electron31/files/patch-content_renderer_renderer__blink__platform__impl.h11
-rw-r--r--devel/electron31/files/patch-content_renderer_renderer__main__platform__delegate__linux.cc18
-rw-r--r--devel/electron31/files/patch-content_shell_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-content_shell_app_shell__main__delegate.cc11
-rw-r--r--devel/electron31/files/patch-content_shell_browser_shell__browser__main__parts.cc47
-rw-r--r--devel/electron31/files/patch-content_shell_browser_shell__paths.cc20
-rw-r--r--devel/electron31/files/patch-content_shell_renderer_shell__content__renderer__client.cc11
-rw-r--r--devel/electron31/files/patch-content_shell_utility_shell__content__utility__client.cc20
-rw-r--r--devel/electron31/files/patch-content_utility_services.cc99
-rw-r--r--devel/electron31/files/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.cc37
-rw-r--r--devel/electron31/files/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.h16
-rw-r--r--devel/electron31/files/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.cc29
-rw-r--r--devel/electron31/files/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.h11
-rw-r--r--devel/electron31/files/patch-content_utility_utility__main.cc128
-rw-r--r--devel/electron31/files/patch-content_utility_utility__thread__impl.cc21
-rw-r--r--devel/electron31/files/patch-content_zygote_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-content_zygote_zygote__linux.cc15
-rw-r--r--devel/electron31/files/patch-content_zygote_zygote__main__linux.cc58
-rw-r--r--devel/electron31/files/patch-device_bluetooth_bluetooth__adapter.cc11
-rw-r--r--devel/electron31/files/patch-device_bluetooth_cast__bluetooth.gni9
-rw-r--r--devel/electron31/files/patch-device_fido_fido__discovery__factory.cc11
-rw-r--r--devel/electron31/files/patch-device_gamepad_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-device_gamepad_gamepad__provider.cc11
-rw-r--r--devel/electron31/files/patch-device_gamepad_hid__writer__linux.cc11
-rw-r--r--devel/electron31/files/patch-electron_BUILD.gn60
-rw-r--r--devel/electron31/files/patch-electron_build_args_all.gn13
-rw-r--r--devel/electron31/files/patch-electron_build_args_release.gn11
-rw-r--r--devel/electron31/files/patch-electron_default__app_default__app.ts11
-rw-r--r--devel/electron31/files/patch-electron_filenames.gni13
-rw-r--r--devel/electron31/files/patch-electron_lib_browser_api_app.ts11
-rw-r--r--devel/electron31/files/patch-electron_lib_browser_api_dialog.ts11
-rw-r--r--devel/electron31/files/patch-electron_lib_browser_api_menu-item-roles.ts11
-rw-r--r--devel/electron31/files/patch-electron_lib_browser_api_power-monitor.ts11
-rw-r--r--devel/electron31/files/patch-electron_lib_browser_init.ts11
-rw-r--r--devel/electron31/files/patch-electron_lib_browser_rpc-server.ts11
-rw-r--r--devel/electron31/files/patch-electron_lib_renderer_api_clipboard.ts11
-rw-r--r--devel/electron31/files/patch-electron_script_lib_config.py12
-rw-r--r--devel/electron31/files/patch-electron_script_lib_utils.js11
-rw-r--r--devel/electron31/files/patch-electron_script_spec-runner.js11
-rw-r--r--devel/electron31/files/patch-electron_shell_app_electron__crash__reporter__client.cc20
-rw-r--r--devel/electron31/files/patch-electron_shell_app_electron__crash__reporter__client.h20
-rw-r--r--devel/electron31/files/patch-electron_shell_app_electron__main__delegate.cc54
-rw-r--r--devel/electron31/files/patch-electron_shell_app_node__main.cc38
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_api_electron__api__app.cc47
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_api_electron__api__base__window.cc38
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_api_electron__api__base__window.h11
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_api_electron__api__crash__reporter.cc72
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_api_electron__api__desktop__capturer.cc11
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_api_electron__api__power__monitor.cc23
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_api_electron__api__power__monitor.h11
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_api_electron__api__safe__storage.cc29
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_api_electron__api__web__contents.cc61
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_api_electron__api__web__contents.h11
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_api_process__metric.h20
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_browser.cc11
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_browser.h24
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_browser__linux.cc11
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_browser__process__impl.cc20
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_browser__process__impl.h29
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_electron__browser__main__parts.cc84
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_electron__browser__main__parts.h20
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_electron__browser__main__parts__posix.cc19
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_extensions_api_runtime_electron__runtime__api__delegate.cc11
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_native__window.cc11
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_native__window__views.cc200
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_native__window__views.h29
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_net_system__network__context__manager.cc11
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_osr_osr__host__display__client.cc11
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_osr_osr__host__display__client.h11
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_printing_printing__utils.cc11
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_relauncher__linux.cc32
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_ui_inspectable__web__contents__view.cc11
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_ui_inspectable__web__contents__view__delegate.h11
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_ui_views_electron__views__delegate.cc38
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_ui_views_electron__views__delegate.h11
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_ui_views_menu__bar.cc38
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_ui_views_menu__bar.h11
-rw-r--r--devel/electron31/files/patch-electron_shell_browser_ui_views_submenu__button.cc11
-rw-r--r--devel/electron31/files/patch-electron_shell_common_api_electron__api__clipboard.cc20
-rw-r--r--devel/electron31/files/patch-electron_shell_common_api_electron__api__native__image.cc11
-rw-r--r--devel/electron31/files/patch-electron_shell_common_api_electron__api__native__image.h11
-rw-r--r--devel/electron31/files/patch-electron_shell_common_api_electron__bindings.cc11
-rw-r--r--devel/electron31/files/patch-electron_shell_common_electron__command__line.cc11
-rw-r--r--devel/electron31/files/patch-electron_shell_common_electron__command__line.h11
-rw-r--r--devel/electron31/files/patch-electron_shell_common_electron__paths.h11
-rw-r--r--devel/electron31/files/patch-electron_shell_common_gin__converters_std__converter.h11
-rw-r--r--devel/electron31/files/patch-electron_shell_common_node__bindings.cc29
-rw-r--r--devel/electron31/files/patch-electron_shell_common_node__bindings__linux.cc69
-rw-r--r--devel/electron31/files/patch-electron_shell_common_platform__util.h11
-rw-r--r--devel/electron31/files/patch-electron_shell_renderer_api_electron__api__crash__reporter__renderer.cc36
-rw-r--r--devel/electron31/files/patch-electron_spec_api-app-spec.ts124
-rw-r--r--devel/electron31/files/patch-electron_spec_api-browser-window-spec.ts173
-rw-r--r--devel/electron31/files/patch-electron_spec_api-clipboard-spec.ts29
-rw-r--r--devel/electron31/files/patch-electron_spec_api-content-tracing-spec.ts11
-rw-r--r--devel/electron31/files/patch-electron_spec_api-crash-reporter-spec.ts56
-rw-r--r--devel/electron31/files/patch-electron_spec_api-desktop-capturer-spec.ts47
-rw-r--r--devel/electron31/files/patch-electron_spec_api-menu-spec.ts11
-rw-r--r--devel/electron31/files/patch-electron_spec_api-native-image-spec.ts11
-rw-r--r--devel/electron31/files/patch-electron_spec_api-net-log-spec.ts29
-rw-r--r--devel/electron31/files/patch-electron_spec_api-notification-dbus-spec.ts11
-rw-r--r--devel/electron31/files/patch-electron_spec_api-power-monitor-spec.ts11
-rw-r--r--devel/electron31/files/patch-electron_spec_api-process-spec.ts20
-rw-r--r--devel/electron31/files/patch-electron_spec_api-protocol-spec.ts11
-rw-r--r--devel/electron31/files/patch-electron_spec_api-safe-storage-spec.ts20
-rw-r--r--devel/electron31/files/patch-electron_spec_api-screen-spec.ts29
-rw-r--r--devel/electron31/files/patch-electron_spec_api-shell-spec.ts23
-rw-r--r--devel/electron31/files/patch-electron_spec_api-subframe-spec.ts11
-rw-r--r--devel/electron31/files/patch-electron_spec_api-tray-spec.ts11
-rw-r--r--devel/electron31/files/patch-electron_spec_api-utility-process-spec.ts20
-rw-r--r--devel/electron31/files/patch-electron_spec_api-web-frame-main-spec.ts11
-rw-r--r--devel/electron31/files/patch-electron_spec_chromium-spec.ts44
-rw-r--r--devel/electron31/files/patch-electron_spec_crash-spec.ts11
-rw-r--r--devel/electron31/files/patch-electron_spec_fixtures_api_safe-storage_decrypt-app_main.js11
-rw-r--r--devel/electron31/files/patch-electron_spec_fixtures_api_safe-storage_encrypt-app_main.js11
-rw-r--r--devel/electron31/files/patch-electron_spec_fixtures_crash-cases_safe-storage_index.js11
-rw-r--r--devel/electron31/files/patch-electron_spec_fixtures_native-addon_uv-dlopen_index.js11
-rw-r--r--devel/electron31/files/patch-electron_spec_node-spec.ts11
-rw-r--r--devel/electron31/files/patch-electron_spec_version-bump-spec.ts11
-rw-r--r--devel/electron31/files/patch-electron_spec_visibility-state-spec.ts11
-rw-r--r--devel/electron31/files/patch-electron_spec_webview-spec.ts11
-rw-r--r--devel/electron31/files/patch-extensions_browser_api_api__browser__context__keyed__service__factories.cc11
-rw-r--r--devel/electron31/files/patch-extensions_browser_api_management_management__api.cc11
-rw-r--r--devel/electron31/files/patch-extensions_browser_api_messaging_message__service.cc20
-rw-r--r--devel/electron31/files/patch-extensions_browser_api_networking__private_networking__private__delegate__factory.cc20
-rw-r--r--devel/electron31/files/patch-extensions_common_api___permission__features.json29
-rw-r--r--devel/electron31/files/patch-extensions_common_api_runtime.json10
-rw-r--r--devel/electron31/files/patch-extensions_common_command.cc11
-rw-r--r--devel/electron31/files/patch-extensions_common_features_feature.cc11
-rw-r--r--devel/electron31/files/patch-extensions_renderer_bindings_api__binding__util.cc11
-rw-r--r--devel/electron31/files/patch-extensions_renderer_bindings_argument__spec.cc11
-rw-r--r--devel/electron31/files/patch-extensions_shell_app_shell__main__delegate.cc20
-rw-r--r--devel/electron31/files/patch-extensions_shell_browser_api_runtime_shell__runtime__api__delegate.cc11
-rw-r--r--devel/electron31/files/patch-extensions_shell_browser_shell__browser__main__parts.cc11
-rw-r--r--devel/electron31/files/patch-extensions_shell_browser_shell__extensions__api__client.cc11
-rw-r--r--devel/electron31/files/patch-extensions_shell_browser_shell__extensions__api__client.h20
-rw-r--r--devel/electron31/files/patch-google__apis_gcm_engine_heartbeat__manager.cc29
-rw-r--r--devel/electron31/files/patch-gpu_command__buffer_common_gpu__memory__buffer__support.cc20
-rw-r--r--devel/electron31/files/patch-gpu_command__buffer_service_dawn__context__provider.cc11
-rw-r--r--devel/electron31/files/patch-gpu_command__buffer_service_gles2__cmd__decoder.cc11
-rw-r--r--devel/electron31/files/patch-gpu_command__buffer_service_shared__image_angle__vulkan__image__backing__factory.cc11
-rw-r--r--devel/electron31/files/patch-gpu_command__buffer_service_shared__image_external__vk__image__backing.cc20
-rw-r--r--devel/electron31/files/patch-gpu_command__buffer_service_shared__image_external__vk__image__backing__factory.cc11
-rw-r--r--devel/electron31/files/patch-gpu_command__buffer_service_shared__image_shared__image__factory.cc11
-rw-r--r--devel/electron31/files/patch-gpu_command__buffer_service_shared__image_shared__image__manager.cc11
-rw-r--r--devel/electron31/files/patch-gpu_command__buffer_service_shared__image_wrapped__sk__image__backing.cc11
-rw-r--r--devel/electron31/files/patch-gpu_command__buffer_service_webgpu__decoder__impl.cc20
-rw-r--r--devel/electron31/files/patch-gpu_command__buffer_tests_gl__gpu__memory__buffer__unittest.cc20
-rw-r--r--devel/electron31/files/patch-gpu_config_gpu__control__list.cc20
-rw-r--r--devel/electron31/files/patch-gpu_config_gpu__finch__features.cc20
-rw-r--r--devel/electron31/files/patch-gpu_config_gpu__info__collector.cc11
-rw-r--r--devel/electron31/files/patch-gpu_config_gpu__test__config.cc11
-rw-r--r--devel/electron31/files/patch-gpu_ipc_common_gpu__memory__buffer__support.cc20
-rw-r--r--devel/electron31/files/patch-gpu_ipc_common_gpu__memory__buffer__support.h11
-rw-r--r--devel/electron31/files/patch-gpu_ipc_service_gpu__init.cc74
-rw-r--r--devel/electron31/files/patch-gpu_ipc_service_gpu__memory__buffer__factory.cc20
-rw-r--r--devel/electron31/files/patch-gpu_ipc_service_x__util.h11
-rw-r--r--devel/electron31/files/patch-gpu_vulkan_generate__bindings.py11
-rw-r--r--devel/electron31/files/patch-gpu_vulkan_semaphore__handle.cc20
-rw-r--r--devel/electron31/files/patch-gpu_vulkan_vulkan__device__queue.cc20
-rw-r--r--devel/electron31/files/patch-gpu_vulkan_vulkan__device__queue.h11
-rw-r--r--devel/electron31/files/patch-gpu_vulkan_vulkan__function__pointers.cc20
-rw-r--r--devel/electron31/files/patch-gpu_vulkan_vulkan__function__pointers.h27
-rw-r--r--devel/electron31/files/patch-gpu_vulkan_vulkan__image.h20
-rw-r--r--devel/electron31/files/patch-gpu_vulkan_vulkan__util.cc11
-rw-r--r--devel/electron31/files/patch-headless_lib_browser_headless__browser__main__parts__posix.cc39
-rw-r--r--devel/electron31/files/patch-headless_lib_browser_headless__content__browser__client.h11
-rw-r--r--devel/electron31/files/patch-headless_lib_browser_headless__request__context__manager.cc11
-rw-r--r--devel/electron31/files/patch-headless_lib_browser_headless__web__contents__impl.cc11
-rw-r--r--devel/electron31/files/patch-headless_lib_headless__content__main__delegate.cc11
-rw-r--r--devel/electron31/files/patch-ipc_ipc__channel.h11
-rw-r--r--devel/electron31/files/patch-ipc_ipc__channel__common.cc11
-rw-r--r--devel/electron31/files/patch-ipc_ipc__channel__mojo.cc11
-rw-r--r--devel/electron31/files/patch-ipc_ipc__message__utils.cc11
-rw-r--r--devel/electron31/files/patch-ipc_ipc__message__utils.h11
-rw-r--r--devel/electron31/files/patch-media_BUILD.gn12
-rw-r--r--devel/electron31/files/patch-media_audio_BUILD.gn24
-rw-r--r--devel/electron31/files/patch-media_audio_alsa_audio__manager__alsa.cc54
-rw-r--r--devel/electron31/files/patch-media_audio_audio__input__device.cc11
-rw-r--r--devel/electron31/files/patch-media_audio_audio__output__proxy__unittest.cc14
-rw-r--r--devel/electron31/files/patch-media_audio_pulse_pulse__util.cc14
-rw-r--r--devel/electron31/files/patch-media_audio_sndio_audio__manager__sndio.cc244
-rw-r--r--devel/electron31/files/patch-media_audio_sndio_audio__manager__sndio.h69
-rw-r--r--devel/electron31/files/patch-media_audio_sndio_sndio__input.cc203
-rw-r--r--devel/electron31/files/patch-media_audio_sndio_sndio__input.h94
-rw-r--r--devel/electron31/files/patch-media_audio_sndio_sndio__output.cc190
-rw-r--r--devel/electron31/files/patch-media_audio_sndio_sndio__output.h91
-rw-r--r--devel/electron31/files/patch-media_base_audio__latency.cc11
-rw-r--r--devel/electron31/files/patch-media_base_libaom__thread__wrapper.cc24
-rw-r--r--devel/electron31/files/patch-media_base_libvpx__thread__wrapper.cc25
-rw-r--r--devel/electron31/files/patch-media_base_media__switches.cc114
-rw-r--r--devel/electron31/files/patch-media_base_media__switches.h56
-rw-r--r--devel/electron31/files/patch-media_base_user__input__monitor__unittest.cc29
-rw-r--r--devel/electron31/files/patch-media_base_video__frame.cc74
-rw-r--r--devel/electron31/files/patch-media_base_video__frame.h47
-rw-r--r--devel/electron31/files/patch-media_capture_video_create__video__capture__device__factory.cc20
-rw-r--r--devel/electron31/files/patch-media_capture_video_fake__video__capture__device__factory.cc11
-rw-r--r--devel/electron31/files/patch-media_capture_video_file__video__capture__device__factory.cc11
-rw-r--r--devel/electron31/files/patch-media_capture_video_linux_fake__v4l2__impl.cc11
-rw-r--r--devel/electron31/files/patch-media_capture_video_linux_fake__v4l2__impl.h25
-rw-r--r--devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__delegate.cc156
-rw-r--r--devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__delegate.h51
-rw-r--r--devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__device.h11
-rw-r--r--devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__device__impl.cc11
-rw-r--r--devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__device__impl.h11
-rw-r--r--devel/electron31/files/patch-media_capture_video_linux_video__capture__device__factory__v4l2.cc71
-rw-r--r--devel/electron31/files/patch-media_capture_video_linux_video__capture__device__factory__v4l2.h11
-rw-r--r--devel/electron31/files/patch-media_capture_video_video__capture__buffer__tracker__factory__impl.cc20
-rw-r--r--devel/electron31/files/patch-media_capture_video_video__capture__device__client.cc11
-rw-r--r--devel/electron31/files/patch-media_cdm_cdm__paths__unittest.cc11
-rw-r--r--devel/electron31/files/patch-media_cdm_library__cdm_cdm__paths.gni11
-rw-r--r--devel/electron31/files/patch-media_ffmpeg_scripts_build__ffmpeg.py83
-rw-r--r--devel/electron31/files/patch-media_ffmpeg_scripts_robo__lib_config.py56
-rw-r--r--devel/electron31/files/patch-media_gpu_buffer__validation.cc46
-rw-r--r--devel/electron31/files/patch-media_gpu_chromeos_gl__image__processor__backend.cc13
-rw-r--r--devel/electron31/files/patch-media_gpu_chromeos_libyuv__image__processor__backend.cc29
-rw-r--r--devel/electron31/files/patch-media_gpu_chromeos_mailbox__video__frame__converter.cc11
-rw-r--r--devel/electron31/files/patch-media_gpu_chromeos_native__pixmap__frame__resource.cc11
-rw-r--r--devel/electron31/files/patch-media_gpu_chromeos_platform__video__frame__utils.cc29
-rw-r--r--devel/electron31/files/patch-media_gpu_chromeos_video__decoder__pipeline.cc29
-rw-r--r--devel/electron31/files/patch-media_gpu_gpu__video__encode__accelerator__factory.cc11
-rw-r--r--devel/electron31/files/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.cc44
-rw-r--r--devel/electron31/files/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.h16
-rw-r--r--devel/electron31/files/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.cc26
-rw-r--r--devel/electron31/files/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.h23
-rw-r--r--devel/electron31/files/patch-media_gpu_vaapi_vaapi__video__decoder.cc11
-rw-r--r--devel/electron31/files/patch-media_gpu_vaapi_vaapi__wrapper.cc11
-rw-r--r--devel/electron31/files/patch-media_media__options.gni19
-rw-r--r--devel/electron31/files/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.cc20
-rw-r--r--devel/electron31/files/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.h11
-rw-r--r--devel/electron31/files/patch-media_mojo_mojom_video__frame__mojom__traits.cc11
-rw-r--r--devel/electron31/files/patch-media_video_fake__gpu__memory__buffer.cc38
-rw-r--r--devel/electron31/files/patch-media_video_gpu__memory__buffer__video__frame__pool.cc29
-rw-r--r--devel/electron31/files/patch-media_video_video__encode__accelerator__adapter.cc20
-rw-r--r--devel/electron31/files/patch-media_video_video__encode__accelerator__adapter__test.cc11
-rw-r--r--devel/electron31/files/patch-media_webrtc_audio__processor.cc11
-rw-r--r--devel/electron31/files/patch-media_webrtc_helpers.cc19
-rw-r--r--devel/electron31/files/patch-media_webrtc_helpers__unittests.cc38
-rw-r--r--devel/electron31/files/patch-mojo_core_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-mojo_core_channel.cc14
-rw-r--r--devel/electron31/files/patch-mojo_core_embedder_features.h11
-rw-r--r--devel/electron31/files/patch-mojo_public_c_system_thunks.cc38
-rw-r--r--devel/electron31/files/patch-mojo_public_tools_bindings_mojom.gni19
-rw-r--r--devel/electron31/files/patch-net_BUILD.gn78
-rw-r--r--devel/electron31/files/patch-net_base_features.cc24
-rw-r--r--devel/electron31/files/patch-net_base_mock__network__change__notifier.cc11
-rw-r--r--devel/electron31/files/patch-net_base_mock__network__change__notifier.h20
-rw-r--r--devel/electron31/files/patch-net_base_network__change__notifier.cc21
-rw-r--r--devel/electron31/files/patch-net_base_network__change__notifier__passive.cc11
-rw-r--r--devel/electron31/files/patch-net_base_network__interfaces__posix.h11
-rw-r--r--devel/electron31/files/patch-net_base_sockaddr__util__posix.cc12
-rw-r--r--devel/electron31/files/patch-net_base_sockaddr__util__posix__unittest.cc12
-rw-r--r--devel/electron31/files/patch-net_cert_cert__verify__proc.h11
-rw-r--r--devel/electron31/files/patch-net_disk__cache_simple_simple__file__tracker.cc20
-rw-r--r--devel/electron31/files/patch-net_dns_BUILD.gn31
-rw-r--r--devel/electron31/files/patch-net_dns_address__info.cc16
-rw-r--r--devel/electron31/files/patch-net_dns_address__sorter__posix.cc10
-rw-r--r--devel/electron31/files/patch-net_dns_dns__config__service__posix.cc27
-rw-r--r--devel/electron31/files/patch-net_dns_dns__reloader.cc10
-rw-r--r--devel/electron31/files/patch-net_dns_dns__util.cc11
-rw-r--r--devel/electron31/files/patch-net_dns_host__resolver__proc.cc13
-rw-r--r--devel/electron31/files/patch-net_dns_public_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-net_dns_public_resolv__reader.h10
-rw-r--r--devel/electron31/files/patch-net_dns_public_scoped__res__state.h10
-rw-r--r--devel/electron31/files/patch-net_filter_zstd__source__stream.cc10
-rw-r--r--devel/electron31/files/patch-net_http_http__auth__gssapi__posix.cc14
-rw-r--r--devel/electron31/files/patch-net_http_http__auth__gssapi__posix.h12
-rw-r--r--devel/electron31/files/patch-net_http_http__auth__handler__negotiate.cc11
-rw-r--r--devel/electron31/files/patch-net_http_http__auth__preferences.cc11
-rw-r--r--devel/electron31/files/patch-net_http_http__auth__preferences.h29
-rw-r--r--devel/electron31/files/patch-net_http_http__network__session.cc12
-rw-r--r--devel/electron31/files/patch-net_proxy__resolution_proxy__config__service.cc35
-rw-r--r--devel/electron31/files/patch-net_proxy__resolution_proxy__config__service__linux.cc40
-rw-r--r--devel/electron31/files/patch-net_socket_socket__posix.cc11
-rw-r--r--devel/electron31/files/patch-net_socket_socks5__client__socket.cc12
-rw-r--r--devel/electron31/files/patch-net_socket_tcp__socket__posix.cc20
-rw-r--r--devel/electron31/files/patch-net_socket_udp__socket__posix.cc39
-rw-r--r--devel/electron31/files/patch-net_socket_udp__socket__unittest.cc47
-rw-r--r--devel/electron31/files/patch-net_third__party_quiche_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-net_tools_cert__verify__tool_cert__verify__comparision__tool.cc29
-rw-r--r--devel/electron31/files/patch-net_tools_cert__verify__tool_cert__verify__tool.cc29
-rw-r--r--devel/electron31/files/patch-net_tools_net__watcher_net__watcher.cc29
-rw-r--r--devel/electron31/files/patch-net_traffic__annotation_network__traffic__annotation.h20
-rw-r--r--devel/electron31/files/patch-net_url__request_url__request__context.cc11
-rw-r--r--devel/electron31/files/patch-net_url__request_url__request__context.h11
-rw-r--r--devel/electron31/files/patch-net_url__request_url__request__context__builder.cc11
-rw-r--r--devel/electron31/files/patch-pdf_pdfium_pdfium__engine.cc20
-rw-r--r--devel/electron31/files/patch-printing_backend_cups__ipp__helper.cc11
-rw-r--r--devel/electron31/files/patch-printing_mojom_printing__context__mojom__traits.cc29
-rw-r--r--devel/electron31/files/patch-printing_mojom_printing__context__mojom__traits.h11
-rw-r--r--devel/electron31/files/patch-printing_print__settings.cc38
-rw-r--r--devel/electron31/files/patch-printing_print__settings.h47
-rw-r--r--devel/electron31/files/patch-printing_print__settings__conversion.cc11
-rw-r--r--devel/electron31/files/patch-printing_printing__context__linux.cc38
-rw-r--r--devel/electron31/files/patch-printing_sandbox_print__backend__sandbox__hook__linux.cc50
-rw-r--r--devel/electron31/files/patch-printing_sandbox_print__backend__sandbox__hook__linux.h16
-rw-r--r--devel/electron31/files/patch-remoting_base_chromoting__event.cc11
-rw-r--r--devel/electron31/files/patch-remoting_base_host__settings.cc20
-rw-r--r--devel/electron31/files/patch-remoting_client_display_sys__opengl.h11
-rw-r--r--devel/electron31/files/patch-remoting_codec_webrtc__video__encoder__vpx.cc11
-rw-r--r--devel/electron31/files/patch-remoting_host_base_desktop__environment__options.cc11
-rw-r--r--devel/electron31/files/patch-remoting_host_base_switches.cc18
-rw-r--r--devel/electron31/files/patch-remoting_host_base_switches.h18
-rw-r--r--devel/electron31/files/patch-remoting_host_basic__desktop__environment.cc11
-rw-r--r--devel/electron31/files/patch-remoting_host_chromoting__host.cc11
-rw-r--r--devel/electron31/files/patch-remoting_host_chromoting__host.h29
-rw-r--r--devel/electron31/files/patch-remoting_host_chromoting__host__context.cc11
-rw-r--r--devel/electron31/files/patch-remoting_host_chromoting__host__services__client.cc20
-rw-r--r--devel/electron31/files/patch-remoting_host_client__session.cc11
-rw-r--r--devel/electron31/files/patch-remoting_host_desktop__and__cursor__conditional__composer.cc20
-rw-r--r--devel/electron31/files/patch-remoting_host_desktop__capturer__proxy.cc29
-rw-r--r--devel/electron31/files/patch-remoting_host_desktop__capturer__wrapper.cc29
-rw-r--r--devel/electron31/files/patch-remoting_host_evaluate__capability.cc11
-rw-r--r--devel/electron31/files/patch-remoting_host_host__attributes.cc11
-rw-r--r--devel/electron31/files/patch-remoting_host_host__details.cc11
-rw-r--r--devel/electron31/files/patch-remoting_host_host__main.cc29
-rw-r--r--devel/electron31/files/patch-remoting_host_ipc__constants.cc20
-rw-r--r--devel/electron31/files/patch-remoting_host_it2me_it2me__host.cc29
-rw-r--r--devel/electron31/files/patch-remoting_host_it2me_it2me__native__messaging__host__main.cc47
-rw-r--r--devel/electron31/files/patch-remoting_host_me2me__desktop__environment.cc38
-rw-r--r--devel/electron31/files/patch-remoting_host_mouse__cursor__monitor__proxy.cc11
-rw-r--r--devel/electron31/files/patch-remoting_host_policy__watcher.cc11
-rw-r--r--devel/electron31/files/patch-remoting_host_remote__open__url_remote__open__url__client.cc20
-rw-r--r--devel/electron31/files/patch-remoting_host_remote__open__url_remote__open__url__util.cc11
-rw-r--r--devel/electron31/files/patch-remoting_host_remote__open__url_url__forwarder__configurator.cc11
-rw-r--r--devel/electron31/files/patch-remoting_host_remoting__me2me__host.cc169
-rw-r--r--devel/electron31/files/patch-remoting_host_setup_start__host__main.cc29
-rw-r--r--devel/electron31/files/patch-remoting_host_webauthn_remote__webauthn__caller__security__utils.cc29
-rw-r--r--devel/electron31/files/patch-remoting_host_webauthn_remote__webauthn__extension__notifier.cc28
-rw-r--r--devel/electron31/files/patch-remoting_protocol_webrtc__video__stream.cc11
-rw-r--r--devel/electron31/files/patch-sandbox_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-sandbox_features.gni11
-rw-r--r--devel/electron31/files/patch-sandbox_linux_BUILD.gn35
-rw-r--r--devel/electron31/files/patch-sandbox_linux_services_init__process__reaper.cc15
-rw-r--r--devel/electron31/files/patch-sandbox_linux_services_libc__interceptor.cc21
-rw-r--r--devel/electron31/files/patch-sandbox_policy_BUILD.gn39
-rw-r--r--devel/electron31/files/patch-sandbox_policy_features.cc23
-rw-r--r--devel/electron31/files/patch-sandbox_policy_features.h11
-rw-r--r--devel/electron31/files/patch-sandbox_policy_freebsd_sandbox__freebsd.cc248
-rw-r--r--devel/electron31/files/patch-sandbox_policy_freebsd_sandbox__freebsd.h281
-rw-r--r--devel/electron31/files/patch-sandbox_policy_mojom_sandbox.mojom15
-rw-r--r--devel/electron31/files/patch-sandbox_policy_openbsd_sandbox__openbsd.cc427
-rw-r--r--devel/electron31/files/patch-sandbox_policy_openbsd_sandbox__openbsd.h285
-rw-r--r--devel/electron31/files/patch-sandbox_policy_sandbox.cc22
-rw-r--r--devel/electron31/files/patch-sandbox_policy_sandbox.h24
-rw-r--r--devel/electron31/files/patch-sandbox_policy_sandbox__type.cc115
-rw-r--r--devel/electron31/files/patch-sandbox_policy_switches.cc26
-rw-r--r--devel/electron31/files/patch-sandbox_policy_switches.h25
-rw-r--r--devel/electron31/files/patch-services_audio_audio__sandbox__hook__linux.cc31
-rw-r--r--devel/electron31/files/patch-services_audio_audio__sandbox__hook__linux.h16
-rw-r--r--devel/electron31/files/patch-services_device_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-services_device_hid_BUILD.gn30
-rw-r--r--devel/electron31/files/patch-services_device_hid_hid__connection__fido.cc219
-rw-r--r--devel/electron31/files/patch-services_device_hid_hid__connection__fido.h63
-rw-r--r--devel/electron31/files/patch-services_device_hid_hid__connection__freebsd.cc243
-rw-r--r--devel/electron31/files/patch-services_device_hid_hid__connection__freebsd.h70
-rw-r--r--devel/electron31/files/patch-services_device_hid_hid__service.cc24
-rw-r--r--devel/electron31/files/patch-services_device_hid_hid__service__fido.cc399
-rw-r--r--devel/electron31/files/patch-services_device_hid_hid__service__fido.h68
-rw-r--r--devel/electron31/files/patch-services_device_hid_hid__service__freebsd.cc398
-rw-r--r--devel/electron31/files/patch-services_device_hid_hid__service__freebsd.h52
-rw-r--r--devel/electron31/files/patch-services_device_public_cpp_generic__sensor_sensor__reading.h11
-rw-r--r--devel/electron31/files/patch-services_device_public_mojom_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-services_device_serial_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-services_device_serial_serial__device__enumerator.cc20
-rw-r--r--devel/electron31/files/patch-services_device_serial_serial__io__handler__posix.cc11
-rw-r--r--devel/electron31/files/patch-services_device_time__zone__monitor_time__zone__monitor__linux.cc14
-rw-r--r--devel/electron31/files/patch-services_device_usb_BUILD.gn34
-rw-r--r--devel/electron31/files/patch-services_device_usb_usb__service.cc35
-rw-r--r--devel/electron31/files/patch-services_device_usb_usb__service__fake.cc52
-rw-r--r--devel/electron31/files/patch-services_device_usb_usb__service__fake.h51
-rw-r--r--devel/electron31/files/patch-services_network_BUILD.gn10
-rw-r--r--devel/electron31/files/patch-services_network_network__context.cc20
-rw-r--r--devel/electron31/files/patch-services_network_network__context.h11
-rw-r--r--devel/electron31/files/patch-services_network_network__sandbox__hook__linux.cc37
-rw-r--r--devel/electron31/files/patch-services_network_network__sandbox__hook__linux.h14
-rw-r--r--devel/electron31/files/patch-services_network_network__service.cc29
-rw-r--r--devel/electron31/files/patch-services_network_network__service.h29
-rw-r--r--devel/electron31/files/patch-services_network_public_cpp_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-services_network_public_cpp_features.cc11
-rw-r--r--devel/electron31/files/patch-services_network_public_mojom_BUILD.gn25
-rw-r--r--devel/electron31/files/patch-services_network_shared__dictionary_shared__dictionary__writer__in__memory.h11
-rw-r--r--devel/electron31/files/patch-services_on__device__model_on__device__model__service.h22
-rw-r--r--devel/electron31/files/patch-services_on__device__model_pre__sandbox__init.cc38
-rw-r--r--devel/electron31/files/patch-services_resource__coordinator_memory__instrumentation_queued__request__dispatcher.cc65
-rw-r--r--devel/electron31/files/patch-services_resource__coordinator_public_cpp_memory__instrumentation_BUILD.gn16
-rw-r--r--devel/electron31/files/patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics.h20
-rw-r--r--devel/electron31/files/patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics__bsd.cc61
-rw-r--r--devel/electron31/files/patch-services_screen__ai_public_cpp_utilities.cc29
-rw-r--r--devel/electron31/files/patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.cc18
-rw-r--r--devel/electron31/files/patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.h16
-rw-r--r--devel/electron31/files/patch-services_service__manager_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-services_service__manager_public_cpp_service__executable_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-services_tracing_public_cpp_stack__sampling_tracing__sampler__profiler.cc11
-rw-r--r--devel/electron31/files/patch-services_video__capture_public_mojom_video__capture__service.mojom15
-rw-r--r--devel/electron31/files/patch-services_video__capture_video__capture__service__impl.cc38
-rw-r--r--devel/electron31/files/patch-services_video__capture_video__capture__service__impl.h29
-rw-r--r--devel/electron31/files/patch-skia_ext_SkMemory__new__handler.cpp20
-rw-r--r--devel/electron31/files/patch-skia_ext_font__utils.cc20
-rw-r--r--devel/electron31/files/patch-skia_ext_skcolorspace__trfn.cc11
-rw-r--r--devel/electron31/files/patch-third__party_abseil-cpp_absl_base_config.h21
-rw-r--r--devel/electron31/files/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc65
-rw-r--r--devel/electron31/files/patch-third__party_abseil-cpp_absl_debugging_internal_elf__mem__image.h11
-rw-r--r--devel/electron31/files/patch-third__party_angle_BUILD.gn29
-rw-r--r--devel/electron31/files/patch-third__party_angle_src_common_platform.h19
-rw-r--r--devel/electron31/files/patch-third__party_angle_src_common_platform__helpers.h11
-rw-r--r--devel/electron31/files/patch-third__party_angle_src_common_system__utils.cpp11
-rw-r--r--devel/electron31/files/patch-third__party_angle_src_common_system__utils__linux.cpp35
-rw-r--r--devel/electron31/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__internal.h16
-rw-r--r--devel/electron31/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__libpci.cpp90
-rw-r--r--devel/electron31/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__linux.cpp35
-rw-r--r--devel/electron31/files/patch-third__party_angle_src_gpu__info__util_SystemInfo__x11.cpp60
-rw-r--r--devel/electron31/files/patch-third__party_angle_src_libANGLE_Display.cpp47
-rw-r--r--devel/electron31/files/patch-third__party_angle_src_libANGLE_formatutils.cpp11
-rw-r--r--devel/electron31/files/patch-third__party_angle_src_libANGLE_renderer_gl_glx_FunctionsGLX.cpp15
-rw-r--r--devel/electron31/files/patch-third__party_angle_src_libANGLE_renderer_vulkan_DisplayVk__api.h11
-rw-r--r--devel/electron31/files/patch-third__party_angle_util_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-third__party_blink_common_renderer__preferences_renderer__preferences__mojom__traits.cc11
-rw-r--r--devel/electron31/files/patch-third__party_blink_public_common_renderer__preferences_renderer__preferences.h11
-rw-r--r--devel/electron31/files/patch-third__party_blink_public_common_renderer__preferences_renderer__preferences__mojom__traits.h11
-rw-r--r--devel/electron31/files/patch-third__party_blink_public_platform_platform.h11
-rw-r--r--devel/electron31/files/patch-third__party_blink_public_platform_web__vector.h11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_bindings_scripts_bind__gen_style__format.py11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_build_scripts_run__with__pythonpath.py10
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_controller_blink__initializer.cc35
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.cc21
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.h47
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_core_editing_editing__behavior.cc11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_core_execution__context_navigator__base.cc11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_core_exported_web__view__impl.cc20
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_core_frame_web__frame__test.cc20
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_core_html_canvas_canvas__async__blob__creator.cc11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_core_inspector_inspector__memory__agent.cc11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_core_layout_layout__view.cc20
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_core_paint_paint__layer.cc11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_core_scroll_scrollbar__theme__aura.cc20
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_core_xml_xslt__processor.h14
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_core_xml_xslt__processor__libxslt.cc14
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_modules_media_audio_audio__device__factory.cc11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_modules_media_audio_audio__renderer__mixer__manager__test.cc11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_modules_ml_webnn_features.gni10
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_modules_ml_webnn_ml__graph__xnnpack.cc11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_modules_peerconnection_webrtc__audio__renderer__test.cc11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__thread__test.cc11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_modules_webgl_webgl__rendering__context__base.cc11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_modules_webgpu_gpu__queue.cc11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_fonts_font__cache.cc20
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_fonts_font__cache.h47
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_fonts_font__description.cc20
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_fonts_font__metrics.cc29
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_fonts_font__platform__data.cc20
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_fonts_font__unique__name__lookup.cc20
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_fonts_skia_font__cache__skia.cc20
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_graphics_begin__frame__provider.cc15
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_graphics_video__frame__submitter.cc11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_instrumentation_partition__alloc__memory__dump__provider.cc28
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_peerconnection_rtc__video__encoder__factory.cc17
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_runtime__enabled__features.json592
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_scheduler_common_thread.cc11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_video__capture_video__capture__impl.cc11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_widget_compositing_blink__categorized__worker__pool__delegate.cc11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_wtf_container__annotations.h11
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_wtf_math__extras.h23
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_wtf_stack__util.cc37
-rw-r--r--devel/electron31/files/patch-third__party_blink_renderer_platform_wtf_text_text__codec__icu.cc18
-rw-r--r--devel/electron31/files/patch-third__party_brotli_common_platform.h11
-rw-r--r--devel/electron31/files/patch-third__party_cpuinfo_cpuinfo.gni11
-rw-r--r--devel/electron31/files/patch-third__party_crashpad_crashpad_build_crashpad__buildconfig.gni11
-rw-r--r--devel/electron31/files/patch-third__party_crashpad_crashpad_client_BUILD.gn16
-rw-r--r--devel/electron31/files/patch-third__party_crashpad_crashpad_client_crashpad__client__posix.cc43
-rw-r--r--devel/electron31/files/patch-third__party_crashpad_crashpad_minidump_minidump__misc__info__writer.cc13
-rw-r--r--devel/electron31/files/patch-third__party_crashpad_crashpad_util_misc_address__types.h20
-rw-r--r--devel/electron31/files/patch-third__party_crashpad_crashpad_util_misc_capture__context.h22
-rw-r--r--devel/electron31/files/patch-third__party_crashpad_crashpad_util_misc_metrics.cc11
-rw-r--r--devel/electron31/files/patch-third__party_crashpad_crashpad_util_misc_uuid.cc11
-rw-r--r--devel/electron31/files/patch-third__party_crashpad_crashpad_util_posix_close__multiple.cc11
-rw-r--r--devel/electron31/files/patch-third__party_crashpad_crashpad_util_posix_drop__privileges.cc11
-rw-r--r--devel/electron31/files/patch-third__party_crashpad_crashpad_util_posix_signals.cc33
-rw-r--r--devel/electron31/files/patch-third__party_crashpad_crashpad_util_posix_symbolic__constants__posix.cc20
-rw-r--r--devel/electron31/files/patch-third__party_crc32c_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-third__party_dawn_include_dawn_native_VulkanBackend.h11
-rw-r--r--devel/electron31/files/patch-third__party_dawn_src_dawn_common_Platform.h14
-rw-r--r--devel/electron31/files/patch-third__party_dawn_src_dawn_native_vulkan_BackendVk.cpp11
-rw-r--r--devel/electron31/files/patch-third__party_electron__node_deps_cares_BUILD.gn18
-rw-r--r--devel/electron31/files/patch-third__party_electron__node_deps_uv_BUILD.gn46
-rw-r--r--devel/electron31/files/patch-third__party_electron__node_deps_uv_src_unix_pipe.c18
-rw-r--r--devel/electron31/files/patch-third__party_ffmpeg_BUILD.gn10
-rw-r--r--devel/electron31/files/patch-third__party_ffmpeg_configure13
-rw-r--r--devel/electron31/files/patch-third__party_ffmpeg_libavcodec_x86_cabac.h12
-rw-r--r--devel/electron31/files/patch-third__party_ffmpeg_libavutil_cpu.c14
-rw-r--r--devel/electron31/files/patch-third__party_ffmpeg_libavutil_mem.c12
-rw-r--r--devel/electron31/files/patch-third__party_ffmpeg_libavutil_random__seed.c14
-rw-r--r--devel/electron31/files/patch-third__party_ffmpeg_libavutil_x86_x86inc.asm23
-rw-r--r--devel/electron31/files/patch-third__party_fontconfig_include_config.h49
-rw-r--r--devel/electron31/files/patch-third__party_fontconfig_src_src_fccompat.c13
-rw-r--r--devel/electron31/files/patch-third__party_ipcz_src_reference__drivers_random.cc20
-rw-r--r--devel/electron31/files/patch-third__party_ipcz_src_standalone_base_logging.cc12
-rw-r--r--devel/electron31/files/patch-third__party_leveldatabase_env__chromium.cc12
-rw-r--r--devel/electron31/files/patch-third__party_libaom_source_libaom_aom__ports_aarch64__cpudetect.c49
-rw-r--r--devel/electron31/files/patch-third__party_libc++_src_src_chrono.cpp11
-rw-r--r--devel/electron31/files/patch-third__party_libc++_src_src_filesystem_filesystem__clock.cpp11
-rw-r--r--devel/electron31/files/patch-third__party_libc++abi_src_src_cxa__guard__impl.h24
-rw-r--r--devel/electron31/files/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_memory_singleton.h11
-rw-r--r--devel/electron31/files/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_synchronization_lock.h11
-rw-r--r--devel/electron31/files/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_thread__checker.h20
-rw-r--r--devel/electron31/files/patch-third__party_libsync_src_include_sync_sync.h12
-rw-r--r--devel/electron31/files/patch-third__party_libsync_src_sync.c25
-rw-r--r--devel/electron31/files/patch-third__party_libusb_BUILD.gn52
-rw-r--r--devel/electron31/files/patch-third__party_libusb_src_libusb_core.c11
-rw-r--r--devel/electron31/files/patch-third__party_libusb_src_libusb_os_threads__posix.c24
-rw-r--r--devel/electron31/files/patch-third__party_libvpx_source_libvpx_vpx__ports_aarch64__cpudetect.c27
-rw-r--r--devel/electron31/files/patch-third__party_lzma__sdk_C_CpuArch.c44
-rw-r--r--devel/electron31/files/patch-third__party_maldoca_BUILD.gn13
-rw-r--r--devel/electron31/files/patch-third__party_maldoca_src_maldoca_base_get__runfiles__dir.cc32
-rw-r--r--devel/electron31/files/patch-third__party_maldoca_src_maldoca_service_common_process__doc__wrapper.cc29
-rw-r--r--devel/electron31/files/patch-third__party_material__color__utilities_src_cpp_palettes_tones.cc11
-rw-r--r--devel/electron31/files/patch-third__party_nasm_BUILD.gn16
-rw-r--r--devel/electron31/files/patch-third__party_nasm_config_config-linux.h102
-rw-r--r--devel/electron31/files/patch-third__party_node_node.gni11
-rw-r--r--devel/electron31/files/patch-third__party_node_node.py11
-rw-r--r--devel/electron31/files/patch-third__party_pdfium_core_fxge_cfx__fontmapper.cpp11
-rw-r--r--devel/electron31/files/patch-third__party_pdfium_core_fxge_linux_fx__linux__impl.cpp23
-rw-r--r--devel/electron31/files/patch-third__party_pdfium_fxjs_fx__date__helpers.cpp22
-rw-r--r--devel/electron31/files/patch-third__party_pdfium_pdfium.gni11
-rw-r--r--devel/electron31/files/patch-third__party_pdfium_xfa_fxfa_parser_cxfa__timezoneprovider.cpp41
-rw-r--r--devel/electron31/files/patch-third__party_perfetto_include_perfetto_base_build__config.h66
-rw-r--r--devel/electron31/files/patch-third__party_perfetto_include_perfetto_base_thread__utils.h22
-rw-r--r--devel/electron31/files/patch-third__party_perfetto_include_perfetto_base_time.h34
-rw-r--r--devel/electron31/files/patch-third__party_perfetto_include_perfetto_ext_base_event__fd.h11
-rw-r--r--devel/electron31/files/patch-third__party_perfetto_include_perfetto_ext_base_thread__utils.h15
-rw-r--r--devel/electron31/files/patch-third__party_perfetto_include_perfetto_tracing_internal_track__event__legacy.h11
-rw-r--r--devel/electron31/files/patch-third__party_perfetto_protos_perfetto_trace_ftrace_v4l2.proto56
-rw-r--r--devel/electron31/files/patch-third__party_perfetto_src_base_event__fd.cc22
-rw-r--r--devel/electron31/files/patch-third__party_perfetto_src_base_periodic__task.cc20
-rw-r--r--devel/electron31/files/patch-third__party_perfetto_src_base_string__utils.cc15
-rw-r--r--devel/electron31/files/patch-third__party_perfetto_src_base_subprocess__posix.cc22
-rw-r--r--devel/electron31/files/patch-third__party_perfetto_src_base_test_vm__test__utils.cc11
-rw-r--r--devel/electron31/files/patch-third__party_perfetto_src_base_thread__task__runner.cc14
-rw-r--r--devel/electron31/files/patch-third__party_perfetto_src_base_unix__socket.cc26
-rw-r--r--devel/electron31/files/patch-third__party_perfetto_src_tracing_core_clock__snapshots.cc12
-rw-r--r--devel/electron31/files/patch-third__party_perfetto_src_tracing_ipc_memfd.cc12
-rw-r--r--devel/electron31/files/patch-third__party_perfetto_src_tracing_track.cc11
-rw-r--r--devel/electron31/files/patch-third__party_protobuf_src_google_protobuf_stubs_platform__macros.h11
-rw-r--r--devel/electron31/files/patch-third__party_skia_src_ports_SkMemory__malloc.cpp20
-rw-r--r--devel/electron31/files/patch-third__party_skia_src_ports_SkOSFile__posix.cpp11
-rw-r--r--devel/electron31/files/patch-third__party_speech-dispatcher_libspeechd__version.h32
-rw-r--r--devel/electron31/files/patch-third__party_speech-dispatcher_speechd__types.h142
-rw-r--r--devel/electron31/files/patch-third__party_sqlite_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-third__party_sqlite_src_amalgamation_sqlite3.c32
-rw-r--r--devel/electron31/files/patch-third__party_swiftshader_src_Reactor_Debug.cpp11
-rw-r--r--devel/electron31/files/patch-third__party_swiftshader_src_System_Configurator.cpp12
-rw-r--r--devel/electron31/files/patch-third__party_swiftshader_src_System_Linux_MemFd.cpp37
-rw-r--r--devel/electron31/files/patch-third__party_swiftshader_src_Vulkan_VkSemaphoreExternalLinux.hpp20
-rw-r--r--devel/electron31/files/patch-third__party_swiftshader_src_WSI_libXCB.cpp20
-rw-r--r--devel/electron31/files/patch-third__party_swiftshader_third__party_llvm-10.0_configs_linux_include_llvm_Config_config.h174
-rw-r--r--devel/electron31/files/patch-third__party_swiftshader_third__party_llvm-subzero_build_Linux_include_llvm_Config_config.h47
-rw-r--r--devel/electron31/files/patch-third__party_swiftshader_third__party_marl_src_memory.cpp11
-rw-r--r--devel/electron31/files/patch-third__party_swiftshader_third__party_marl_src_thread.cpp11
-rw-r--r--devel/electron31/files/patch-third__party_test__fonts_fontconfig_BUILD.gn15
-rw-r--r--devel/electron31/files/patch-third__party_test__fonts_fontconfig_fontconfig__util__linux.cc27
-rw-r--r--devel/electron31/files/patch-third__party_test__fonts_fontconfig_generate__fontconfig__caches.cc11
-rw-r--r--devel/electron31/files/patch-third__party_tflite_features.gni13
-rw-r--r--devel/electron31/files/patch-third__party_unrar_src_crypt.cpp11
-rw-r--r--devel/electron31/files/patch-third__party_vulkan-deps_vulkan-loader_src_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-third__party_vulkan-deps_vulkan-loader_src_loader_vk__loader__platform.h19
-rw-r--r--devel/electron31/files/patch-third__party_vulkan-deps_vulkan-validation-layers_src_layers_external_vma_vk__mem__alloc.h11
-rw-r--r--devel/electron31/files/patch-third__party_vulkan__memory__allocator_include_vk__mem__alloc.h11
-rw-r--r--devel/electron31/files/patch-third__party_wayland_BUILD.gn14
-rw-r--r--devel/electron31/files/patch-third__party_wayland_include_config.h29
-rw-r--r--devel/electron31/files/patch-third__party_webrtc_BUILD.gn12
-rw-r--r--devel/electron31/files/patch-third__party_webrtc_modules_audio__device_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_egl__dmabuf.cc18
-rw-r--r--devel/electron31/files/patch-third__party_webrtc_modules_desktop__capture_linux_x11_x__server__pixel__buffer.cc15
-rw-r--r--devel/electron31/files/patch-third__party_webrtc_rtc__base_byte__order.h11
-rw-r--r--devel/electron31/files/patch-third__party_webrtc_rtc__base_ip__address.cc12
-rw-r--r--devel/electron31/files/patch-third__party_webrtc_rtc__base_net__test__helpers.cc10
-rw-r--r--devel/electron31/files/patch-third__party_webrtc_rtc__base_network.cc15
-rw-r--r--devel/electron31/files/patch-third__party_webrtc_rtc__base_physical__socket__server.cc114
-rw-r--r--devel/electron31/files/patch-third__party_webrtc_rtc__base_physical__socket__server.h11
-rw-r--r--devel/electron31/files/patch-third__party_webrtc_rtc__base_platform__thread__types.cc37
-rw-r--r--devel/electron31/files/patch-third__party_webrtc_rtc__base_third__party_sigslot_sigslot.h23
-rw-r--r--devel/electron31/files/patch-third__party_webrtc_system__wrappers_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-third__party_widevine_cdm_widevine.gni11
-rw-r--r--devel/electron31/files/patch-third__party_zlib_BUILD.gn31
-rw-r--r--devel/electron31/files/patch-third__party_zlib_cpu__features.c51
-rw-r--r--devel/electron31/files/patch-tools_generate__shim__headers_generate__shim__headers.py21
-rw-r--r--devel/electron31/files/patch-tools_generate__stubs_rules.gni10
-rw-r--r--devel/electron31/files/patch-tools_gn_build_build__linux.ninja.template11
-rw-r--r--devel/electron31/files/patch-tools_gn_build_gen.py34
-rw-r--r--devel/electron31/files/patch-tools_gn_src_base_files_file__posix.cc11
-rw-r--r--devel/electron31/files/patch-tools_gn_src_gn_version.h15
-rw-r--r--devel/electron31/files/patch-tools_gn_src_util_exe__path.cc90
-rw-r--r--devel/electron31/files/patch-tools_grit_grit_node_base.py12
-rw-r--r--devel/electron31/files/patch-tools_json__schema__compiler_cpp__bundle__generator.py11
-rw-r--r--devel/electron31/files/patch-tools_json__schema__compiler_feature__compiler.py11
-rw-r--r--devel/electron31/files/patch-tools_memory_partition__allocator_inspect__utils.h11
-rw-r--r--devel/electron31/files/patch-tools_perf_chrome__telemetry__build_BUILD.gn20
-rw-r--r--devel/electron31/files/patch-tools_protoc__wrapper_protoc__wrapper.py24
-rw-r--r--devel/electron31/files/patch-tools_variations_fieldtrial__to__struct.py11
-rw-r--r--devel/electron31/files/patch-ui_aura_client_drag__drop__client.h11
-rw-r--r--devel/electron31/files/patch-ui_aura_screen__ozone.cc11
-rw-r--r--devel/electron31/files/patch-ui_aura_screen__ozone.h20
-rw-r--r--devel/electron31/files/patch-ui_base_clipboard_clipboard__constants.cc11
-rw-r--r--devel/electron31/files/patch-ui_base_clipboard_clipboard__constants.h11
-rw-r--r--devel/electron31/files/patch-ui_base_clipboard_clipboard__non__backed.cc11
-rw-r--r--devel/electron31/files/patch-ui_base_cursor_cursor__factory.cc11
-rw-r--r--devel/electron31/files/patch-ui_base_cursor_cursor__factory.h11
-rw-r--r--devel/electron31/files/patch-ui_base_dragdrop_os__exchange__data__provider__factory.cc20
-rw-r--r--devel/electron31/files/patch-ui_base_dragdrop_os__exchange__data__provider__non__backed.cc11
-rw-r--r--devel/electron31/files/patch-ui_base_ime_dummy__text__input__client.cc11
-rw-r--r--devel/electron31/files/patch-ui_base_ime_dummy__text__input__client.h11
-rw-r--r--devel/electron31/files/patch-ui_base_ime_fake__text__input__client.cc11
-rw-r--r--devel/electron31/files/patch-ui_base_ime_fake__text__input__client.h11
-rw-r--r--devel/electron31/files/patch-ui_base_ime_init_input__method__initializer.cc29
-rw-r--r--devel/electron31/files/patch-ui_base_ime_linux_linux__input__method__context__factory.cc20
-rw-r--r--devel/electron31/files/patch-ui_base_ime_text__input__client.h11
-rw-r--r--devel/electron31/files/patch-ui_base_resource_resource__bundle.cc11
-rw-r--r--devel/electron31/files/patch-ui_base_test_skia__gold__pixel__diff.cc11
-rw-r--r--devel/electron31/files/patch-ui_base_test_ui__controls.h11
-rw-r--r--devel/electron31/files/patch-ui_base_ui__base__features.cc20
-rw-r--r--devel/electron31/files/patch-ui_base_ui__base__switches.cc18
-rw-r--r--devel/electron31/files/patch-ui_base_ui__base__switches.h16
-rw-r--r--devel/electron31/files/patch-ui_base_webui_web__ui__util.cc20
-rw-r--r--devel/electron31/files/patch-ui_base_x_x11__cursor__factory.cc20
-rw-r--r--devel/electron31/files/patch-ui_base_x_x11__cursor__factory.h20
-rw-r--r--devel/electron31/files/patch-ui_base_x_x11__cursor__loader.cc41
-rw-r--r--devel/electron31/files/patch-ui_base_x_x11__display__manager.cc20
-rw-r--r--devel/electron31/files/patch-ui_base_x_x11__display__util.cc365
-rw-r--r--devel/electron31/files/patch-ui_base_x_x11__shm__image__pool.cc71
-rw-r--r--devel/electron31/files/patch-ui_base_x_x11__util.cc23
-rw-r--r--devel/electron31/files/patch-ui_base_x_x11__util.h13
-rw-r--r--devel/electron31/files/patch-ui_color_color__id.h11
-rw-r--r--devel/electron31/files/patch-ui_color_color__provider__utils.cc11
-rw-r--r--devel/electron31/files/patch-ui_color_system__theme.h11
-rw-r--r--devel/electron31/files/patch-ui_compositor_compositor.cc11
-rw-r--r--devel/electron31/files/patch-ui_compositor_compositor.h11
-rw-r--r--devel/electron31/files/patch-ui_compositor_compositor__observer.h11
-rw-r--r--devel/electron31/files/patch-ui_display_screen.cc11
-rw-r--r--devel/electron31/files/patch-ui_display_screen.h20
-rw-r--r--devel/electron31/files/patch-ui_events_devices_x11_device__data__manager__x11.cc10
-rw-r--r--devel/electron31/files/patch-ui_events_event.cc29
-rw-r--r--devel/electron31/files/patch-ui_events_event__switches.cc11
-rw-r--r--devel/electron31/files/patch-ui_events_event__switches.h11
-rw-r--r--devel/electron31/files/patch-ui_events_keycodes_dom_keycode__converter.cc38
-rw-r--r--devel/electron31/files/patch-ui_events_keycodes_dom_keycode__converter.h11
-rw-r--r--devel/electron31/files/patch-ui_gfx_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-ui_gfx_canvas__skia.cc11
-rw-r--r--devel/electron31/files/patch-ui_gfx_font__fallback__linux.cc11
-rw-r--r--devel/electron31/files/patch-ui_gfx_font__render__params.h20
-rw-r--r--devel/electron31/files/patch-ui_gfx_font__render__params__linux.cc20
-rw-r--r--devel/electron31/files/patch-ui_gfx_font__util.cc20
-rw-r--r--devel/electron31/files/patch-ui_gfx_gpu__memory__buffer.cc11
-rw-r--r--devel/electron31/files/patch-ui_gfx_gpu__memory__buffer.h20
-rw-r--r--devel/electron31/files/patch-ui_gfx_linux_dmabuf__uapi.h36
-rw-r--r--devel/electron31/files/patch-ui_gfx_linux_gbm__wrapper.cc11
-rw-r--r--devel/electron31/files/patch-ui_gfx_mojom_buffer__types__mojom__traits.cc20
-rw-r--r--devel/electron31/files/patch-ui_gfx_mojom_native__handle__types__mojom__traits.cc34
-rw-r--r--devel/electron31/files/patch-ui_gfx_mojom_native__handle__types__mojom__traits.h36
-rw-r--r--devel/electron31/files/patch-ui_gfx_native__pixmap__handle.cc62
-rw-r--r--devel/electron31/files/patch-ui_gfx_native__pixmap__handle.h38
-rw-r--r--devel/electron31/files/patch-ui_gfx_native__widget__types.h20
-rw-r--r--devel/electron31/files/patch-ui_gfx_platform__font__skia.cc20
-rw-r--r--devel/electron31/files/patch-ui_gfx_render__text__api__fuzzer.cc20
-rw-r--r--devel/electron31/files/patch-ui_gfx_render__text__fuzzer.cc20
-rw-r--r--devel/electron31/files/patch-ui_gfx_switches.cc11
-rw-r--r--devel/electron31/files/patch-ui_gfx_switches.h11
-rw-r--r--devel/electron31/files/patch-ui_gfx_x_generated__protos_dri3.cc11
-rw-r--r--devel/electron31/files/patch-ui_gfx_x_generated__protos_shm.cc11
-rw-r--r--devel/electron31/files/patch-ui_gfx_x_xlib__support.cc21
-rw-r--r--devel/electron31/files/patch-ui_gl_BUILD.gn35
-rw-r--r--devel/electron31/files/patch-ui_gl_gl__bindings.h11
-rw-r--r--devel/electron31/files/patch-ui_gl_gl__context.cc11
-rw-r--r--devel/electron31/files/patch-ui_gl_gl__fence.cc11
-rw-r--r--devel/electron31/files/patch-ui_gl_gl__implementation.cc11
-rw-r--r--devel/electron31/files/patch-ui_gl_gl__switches.cc29
-rw-r--r--devel/electron31/files/patch-ui_gl_sync__control__vsync__provider.cc38
-rw-r--r--devel/electron31/files/patch-ui_gl_sync__control__vsync__provider.h20
-rw-r--r--devel/electron31/files/patch-ui_gtk_gtk__compat.cc53
-rw-r--r--devel/electron31/files/patch-ui_gtk_printing_print__dialog__gtk.cc11
-rw-r--r--devel/electron31/files/patch-ui_message__center_views_message__popup__view.cc11
-rw-r--r--devel/electron31/files/patch-ui_native__theme_native__theme.h11
-rw-r--r--devel/electron31/files/patch-ui_native__theme_native__theme__base.cc11
-rw-r--r--devel/electron31/files/patch-ui_native__theme_native__theme__features.cc20
-rw-r--r--devel/electron31/files/patch-ui_ozone_common_egl__util.cc14
-rw-r--r--devel/electron31/files/patch-ui_ozone_common_features.cc11
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_headless_headless__surface__factory.cc20
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_headless_ozone__platform__headless.cc11
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_headless_vulkan__implementation__headless.cc29
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_wayland_common_wayland__util.cc11
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.cc11
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.h11
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_wayland_gpu_vulkan__implementation__wayland.cc14
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_wayland_host_wayland__connection.cc11
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_wayland_host_wayland__input__method__context.cc11
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_wayland_host_wayland__popup.cc11
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.cc11
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.h11
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_wayland_host_wayland__window.cc44
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_wayland_host_wayland__window.h38
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_wayland_host_xdg__toplevel__wrapper__impl.cc11
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_wayland_host_zwp__text__input__wrapper__v1.cc21
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_wayland_ozone__platform__wayland.cc54
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_x11_vulkan__implementation__x11.cc14
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_x11_x11__screen__ozone.cc29
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_x11_x11__screen__ozone.h38
-rw-r--r--devel/electron31/files/patch-ui_ozone_platform_x11_x11__window.cc11
-rw-r--r--devel/electron31/files/patch-ui_ozone_test_mock__platform__window__delegate.h11
-rw-r--r--devel/electron31/files/patch-ui_platform__window_platform__window__delegate.cc11
-rw-r--r--devel/electron31/files/patch-ui_platform__window_platform__window__delegate.h11
-rw-r--r--devel/electron31/files/patch-ui_platform__window_platform__window__init__properties.h20
-rw-r--r--devel/electron31/files/patch-ui_qt_BUILD.gn11
-rw-r--r--devel/electron31/files/patch-ui_strings_translations_app__locale__settings__bn.xtb11
-rw-r--r--devel/electron31/files/patch-ui_strings_translations_app__locale__settings__ja.xtb11
-rw-r--r--devel/electron31/files/patch-ui_strings_translations_app__locale__settings__ko.xtb11
-rw-r--r--devel/electron31/files/patch-ui_strings_translations_app__locale__settings__ml.xtb11
-rw-r--r--devel/electron31/files/patch-ui_strings_translations_app__locale__settings__th.xtb11
-rw-r--r--devel/electron31/files/patch-ui_strings_translations_app__locale__settings__zh-CN.xtb11
-rw-r--r--devel/electron31/files/patch-ui_strings_translations_app__locale__settings__zh-TW.xtb11
-rw-r--r--devel/electron31/files/patch-ui_views_controls_prefix__selector.cc11
-rw-r--r--devel/electron31/files/patch-ui_views_controls_prefix__selector.h11
-rw-r--r--devel/electron31/files/patch-ui_views_controls_textfield_textfield.cc64
-rw-r--r--devel/electron31/files/patch-ui_views_controls_textfield_textfield.h20
-rw-r--r--devel/electron31/files/patch-ui_views_corewm_tooltip__aura.cc11
-rw-r--r--devel/electron31/files/patch-ui_views_examples_widget__example.cc11
-rw-r--r--devel/electron31/files/patch-ui_views_focus_focus__manager.cc20
-rw-r--r--devel/electron31/files/patch-ui_views_style_platform__style.cc29
-rw-r--r--devel/electron31/files/patch-ui_views_test_ui__controls__factory__desktop__aura__ozone.cc11
-rw-r--r--devel/electron31/files/patch-ui_views_views__delegate.cc11
-rw-r--r--devel/electron31/files/patch-ui_views_views__delegate.h11
-rw-r--r--devel/electron31/files/patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.cc11
-rw-r--r--devel/electron31/files/patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.h20
-rw-r--r--devel/electron31/files/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__platform.cc29
-rw-r--r--devel/electron31/files/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__platform__impl__interactive__uitest.cc11
-rw-r--r--devel/electron31/files/patch-ui_views_widget_root__view.cc11
-rw-r--r--devel/electron31/files/patch-ui_views_widget_widget.cc20
-rw-r--r--devel/electron31/files/patch-ui_views_window_custom__frame__view.cc11
-rw-r--r--devel/electron31/files/patch-ui_views_window_dialog__delegate.cc11
-rw-r--r--devel/electron31/files/patch-ui_views_window_frame__background.cc11
-rw-r--r--devel/electron31/files/patch-v8_BUILD.gn65
-rw-r--r--devel/electron31/files/patch-v8_include_v8-internal.h11
-rw-r--r--devel/electron31/files/patch-v8_include_v8config.h37
-rw-r--r--devel/electron31/files/patch-v8_src_api_api.cc20
-rw-r--r--devel/electron31/files/patch-v8_src_base_atomicops.h24
-rw-r--r--devel/electron31/files/patch-v8_src_base_platform_memory.h16
-rw-r--r--devel/electron31/files/patch-v8_src_base_platform_platform-freebsd.cc32
-rw-r--r--devel/electron31/files/patch-v8_src_base_platform_platform-openbsd.cc28
-rw-r--r--devel/electron31/files/patch-v8_src_base_platform_platform-posix.cc62
-rw-r--r--devel/electron31/files/patch-v8_src_base_small-vector.h11
-rw-r--r--devel/electron31/files/patch-v8_src_base_sys-info.cc11
-rw-r--r--devel/electron31/files/patch-v8_src_diagnostics_perf-jit.cc11
-rw-r--r--devel/electron31/files/patch-v8_src_diagnostics_perf-jit.h11
-rw-r--r--devel/electron31/files/patch-v8_src_execution_isolate.cc27
-rw-r--r--devel/electron31/files/patch-v8_src_flags_flags.cc36
-rw-r--r--devel/electron31/files/patch-v8_src_sandbox_sandbox.cc11
-rw-r--r--devel/electron31/files/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.cc11
-rw-r--r--devel/electron31/files/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.h10
-rw-r--r--devel/electron31/files/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-generic.cc42
-rw-r--r--devel/electron31/files/patch-v8_src_trap-handler_handler-inside-posix.cc26
-rw-r--r--devel/electron31/files/patch-v8_src_trap-handler_handler-inside-posix.h11
-rw-r--r--devel/electron31/files/patch-v8_src_trap-handler_trap-handler.h11
-rw-r--r--devel/electron31/files/patch-v8_src_wasm_baseline_ia32_liftoff-assembler-ia32-inl.h128
-rw-r--r--devel/electron31/files/patch-v8_tools_run.py11
-rw-r--r--devel/electron31/files/yarn.lock7334
-rw-r--r--devel/electron31/pkg-descr8
-rw-r--r--devel/electron31/pkg-plist211
1408 files changed, 45252 insertions, 0 deletions
diff --git a/devel/Makefile b/devel/Makefile
index a9aa0ae362d9..9ae9125c81cd 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -628,6 +628,7 @@
SUBDIR += electron28
SUBDIR += electron29
SUBDIR += electron30
+ SUBDIR += electron31
SUBDIR += elf
SUBDIR += elf-dissector
SUBDIR += elfcat
diff --git a/devel/electron31/Makefile b/devel/electron31/Makefile
new file mode 100644
index 000000000000..579f65afc46b
--- /dev/null
+++ b/devel/electron31/Makefile
@@ -0,0 +1,438 @@
+PORTNAME= electron
+DISTVERSIONPREFIX= v
+DISTVERSION= ${ELECTRON_VER:S/-beta./.b/}
+PULSEMV= 16
+PULSEV= ${PULSEMV}.1
+CATEGORIES= devel
+MASTER_SITES= https://commondatastorage.googleapis.com/chromium-browser-official/:chromium \
+ https://freedesktop.org/software/pulseaudio/releases/:pulseaudio
+PKGNAMESUFFIX= ${ELECTRON_VER_MAJOR}
+DISTFILES= chromium-${CHROMIUM_VER}${EXTRACT_SUFX}:chromium \
+ pulseaudio-${PULSEV}.tar.gz:pulseaudio \
+ electron-yarn-cache-${ELECTRON_VER}${EXTRACT_SUFX}:prefetch
+DIST_SUBDIR= ${PORTNAME}
+
+MAINTAINER= tagattie@FreeBSD.org
+COMMENT= Build cross-platform desktop apps with JavaScript, HTML, and CSS
+WWW= https://electronjs.org/
+
+LICENSE= BSD3CLAUSE LGPL21 MPL11 MIT
+LICENSE_COMB= multi
+LICENSE_FILE= ${WRKSRC}/electron/LICENSE
+
+ONLY_FOR_ARCHS= aarch64 amd64 i386
+
+FETCH_DEPENDS= yarn${NODEJS_SUFFIX}>0:www/yarn${NODEJS_SUFFIX}
+EXTRACT_DEPENDS=yarn${NODEJS_SUFFIX}>0:www/yarn${NODEJS_SUFFIX}
+PATCH_DEPENDS= git:devel/git \
+ jq:textproc/jq
+BUILD_DEPENDS= gperf:devel/gperf \
+ yasm:devel/yasm \
+ ${LOCALBASE}/libdata/pkgconfig/dri.pc:graphics/mesa-dri \
+ rustc:lang/rust \
+ ${LOCALBASE}/include/linux/videodev2.h:multimedia/v4l_compat \
+ node${NODEJS_VERSION}>0:www/node${NODEJS_VERSION} \
+ npm${NODEJS_SUFFIX}>0:www/npm${NODEJS_SUFFIX}
+LIB_DEPENDS= libatk-bridge-2.0.so:accessibility/at-spi2-core \
+ libatspi.so:accessibility/at-spi2-core \
+ libasound.so:audio/alsa-lib \
+ libFLAC.so:audio/flac \
+ libopus.so:audio/opus \
+ libsndio.so:audio/sndio \
+ libdbus-1.so:devel/dbus \
+ libicuuc.so:devel/icu \
+ libepoll-shim.so:devel/libepoll-shim \
+ libevent.so:devel/libevent \
+ libffi.so:devel/libffi \
+ libnotify.so:devel/libnotify \
+ libpci.so:devel/libpci \
+ libnspr4.so:devel/nspr \
+ libre2.so:devel/re2 \
+ libdrm.so:graphics/libdrm \
+ libpng.so:graphics/png \
+ libwayland-client.so:graphics/wayland \
+ libwebp.so:graphics/webp \
+ libdav1d.so:multimedia/dav1d \
+ libva.so:multimedia/libva \
+ libopenh264.so:multimedia/openh264 \
+ libfreetype.so:print/freetype2 \
+ libharfbuzz.so:print/harfbuzz \
+ libsecret-1.so:security/libsecret \
+ libnss3.so:security/nss \
+ libexpat.so:textproc/expat2 \
+ libxkbcommon.so:x11/libxkbcommon \
+ libxshmfence.so:x11/libxshmfence \
+ libfontconfig.so:x11-fonts/fontconfig
+RUN_DEPENDS= xdg-open:devel/xdg-utils
+TEST_DEPENDS= git:devel/git \
+ ${PYTHON_PKGNAMEPREFIX}python-dbusmock>0:devel/py-python-dbusmock@${PY_FLAVOR} \
+ npm${NODEJS_SUFFIX}>0:www/npm${NODEJS_SUFFIX}
+
+USES= bison compiler:c++17-lang cpe gettext-tools gl gmake gnome \
+ iconv:wchar_t jpeg localbase:ldflags ninja nodejs:20,build \
+ pkgconfig python:build,test shebangfix tar:xz xorg
+
+CPE_VENDOR= electronjs
+USE_GITHUB= yes
+GH_TAGNAME= ${DISTVERSIONPREFIX}${ELECTRON_VER}
+GH_TUPLE= nodejs:node:v${NODE_VER}:node \
+ nodejs:nan:${NAN_VER}:nan \
+ Squirrel:Squirrel.Mac:${SQUIRREL_MAC_VER}:squirrel_mac \
+ ReactiveCocoa:ReactiveObjC:${REACTIVEOBJC_VER}:reactiveobjc \
+ Mantle:Mantle:${MANTLE_VER}:mantle \
+ EngFlow:reclient-configs:${ENGFLOW_RECLIENT_CONFIGS_VER}:reclient_configs
+USE_GL= gbm gl glesv2
+USE_GNOME= atk cairo gdkpixbuf2 gtk30 libxml2 libxslt pango
+USE_LDCONFIG= ${DATADIR}
+USE_XORG= x11 xcb xcomposite xcursor xdamage xext xfixes xi xrandr \
+ xrender xscrnsaver xtst
+
+SHEBANG_FILES= chrome/tools/build/linux/chrome-wrapper buildtools/linux64/clang-format
+
+MAKE_ARGS= -C out/${BUILDTYPE}
+MAKE_ENV+= C_INCLUDE_PATH=${LOCALBASE}/include \
+ CPLUS_INCLUDE_PATH=${LOCALBASE}/include
+ALL_TARGET= electron electron:node_headers
+POST_BUILD_TARGETS= licenses version
+POST_BUILD_DIST_TARGETS=electron_dist_zip electron_chromedriver_zip \
+ electron_mksnapshot_zip
+
+DATADIR= ${PREFIX}/share/${PORTNAME}${PKGNAMESUFFIX}
+BINARY_ALIAS= python3=${PYTHON_CMD}
+
+NO_WRKSUBDIR= yes
+WRKSRC_SUBDIR= src
+
+GN_ARGS+= clang_use_chrome_plugins=false \
+ enable_backup_ref_ptr_support=false \
+ enable_hangout_services_extension=true \
+ enable_log_error_not_reached=true \
+ enable_nacl=false \
+ enable_remoting=false \
+ fatal_linker_warnings=false \
+ icu_use_data_file=false \
+ is_clang=true \
+ optimize_webui=true \
+ toolkit_views=true \
+ treat_warnings_as_errors=false \
+ use_allocator_shim=false \
+ use_aura=true \
+ use_custom_libcxx=true \
+ use_custom_libunwind=true \
+ use_lld=true \
+ use_partition_alloc=true \
+ use_partition_alloc_as_malloc=false \
+ use_sysroot=false \
+ use_system_freetype=false \
+ use_system_harfbuzz=true \
+ use_system_libffi=true \
+ use_system_libjpeg=true \
+ use_udev=false \
+ chrome_pgo_phase=0 \
+ extra_cflags="${CFLAGS}" \
+ extra_cxxflags="${CXXFLAGS} -I${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/pulseaudio-${PULSEV}/src -DPA_MAJOR=${PULSEMV}" \
+ extra_ldflags="${LDFLAGS}" \
+ ffmpeg_branding="${FFMPEG_BRAND}" \
+ override_electron_version="${ELECTRON_VER}"
+
+# Audio backends
+GN_ARGS+= use_alsa=true \
+ use_pulseaudio=true \
+ use_sndio=true
+
+# TODO: investigate building with these options:
+# use_system_minigbm
+GN_BOOTSTRAP_FLAGS= --no-clean --no-rebuild --skip-generate-buildfiles
+
+PLIST_SUB= ELECTRON_VER=${ELECTRON_VER} \
+ ELECTRON_VER_MAJOR=${ELECTRON_VER_MAJOR}
+
+OPTIONS_DEFINE= CODECS CUPS DEBUG DIST DRIVER KERBEROS LTO PIPEWIRE
+OPTIONS_DEFAULT= CODECS CUPS DRIVER KERBEROS PIPEWIRE
+OPTIONS_EXCLUDE_aarch64=LTO
+OPTIONS_RADIO= KERBEROS
+OPTIONS_RADIO_KERBEROS= HEIMDAL HEIMDAL_BASE MIT
+OPTIONS_SUB= yes
+CODECS_DESC= Compile and enable patented codecs like H.264
+DIST_DESC= Build distribution zip files
+DRIVER_DESC= Install chromedriver
+HEIMDAL_BASE_DESC= Heimdal Kerberos (base)
+HEIMDAL_DESC= Heimdal Kerberos (security/heimdal)
+MIT_DESC= MIT Kerberos (security/krb5)
+PIPEWIRE_DESC= Screen capture via PipeWire
+
+CODECS_VARS= GN_ARGS+=proprietary_codecs=true \
+ FFMPEG_BRAND="Chrome"
+CODECS_VARS_OFF= GN_ARGS+=proprietary_codecs=false \
+ FFMPEG_BRAND="Chromium"
+
+CUPS_LIB_DEPENDS= libcups.so:print/cups
+CUPS_VARS= GN_ARGS+=use_cups=true
+CUPS_VARS_OFF= GN_ARGS+=use_cups=false
+
+DEBUG_BUILD_DEPENDS= esbuild:devel/esbuild
+DEBUG_VARS= BUILDTYPE=Debug \
+ GN_FILE=testing.gn \
+ GN_ARGS+=is_debug=true \
+ GN_ARGS+=is_component_build=false \
+ GN_ARGS+=symbol_level=1 \
+ GN_BOOTSTRAP_FLAGS+=--debug \
+ WANTSPACE="21 GB"
+DEBUG_VARS_OFF= BUILDTYPE=Release \
+ GN_FILE=release.gn \
+ GN_ARGS+=blink_symbol_level=0 \
+ GN_ARGS+=is_debug=false \
+ GN_ARGS+=is_official_build=true \
+ GN_ARGS+=symbol_level=0 \
+ WANTSPACE="14 GB"
+
+DIST_IMPLIES= DRIVER
+DRIVER_MAKE_ARGS= chromedriver
+
+HEIMDAL_LIB_DEPENDS= libkrb5.so.26:security/heimdal
+KERBEROS_VARS= GN_ARGS+=use_kerberos=true
+KERBEROS_VARS_OFF= GN_ARGS+=use_kerberos=false
+
+LTO_VARS= GN_ARGS+=use_thin_lto=true \
+ GN_ARGS+=thin_lto_enable_optimizations=true \
+ WANTSPACE="14 GB"
+LTO_VARS_OFF= GN_ARGS+=use_thin_lto=false
+
+MIT_LIB_DEPENDS= libkrb5.so.3:security/krb5
+
+PIPEWIRE_LIB_DEPENDS= libpipewire-0.3.so:multimedia/pipewire
+PIPEWIRE_VARS= GN_ARGS+=rtc_use_pipewire=true \
+ GN_ARGS+=rtc_link_pipewire=true
+PIPEWIRE_VARS_OFF= GN_ARGS+=rtc_use_pipewire=false \
+ GN_ARGS+=rtc_link_pipewire=false
+
+# See ${WRKSRC}/electron/DEPS for CHROMIUM_VER
+CHROMIUM_VER= 126.0.6478.127
+# See ${WRKSRC}/electron/DEPS for NODE_VER
+NODE_VER= 20.15.0
+# See ${WRKSRC}/electron/DEPS for NAN_VER
+NAN_VER= e14bdcd1f72d62bca1d541b66da43130384ec213
+# See ${WRKSRC}/electron/DEPS for SQUIRREL_MAC_VER
+SQUIRREL_MAC_VER= 0e5d146ba13101a1302d59ea6e6e0b3cace4ae38
+# See ${WRKSRC}/electron/DEPS for REACTIVEOBJC_VER
+REACTIVEOBJC_VER= 74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76
+# See ${WRKSRC}/electron/DEPS for MANTLE_VER
+MANTLE_VER= 78d3966b3c331292ea29ec38661b25df0a245948
+# See ${WRKSRC}/electron/DEPS for ENGFLOW_RECLIENT_CONFIGS_VER
+ENGFLOW_RECLIENT_CONFIGS_VER= 955335c30a752e9ef7bff375baab5e0819b6c00d
+
+YARN_TIMESTAMP= 61171200
+
+.include "Makefile.version"
+.include <bsd.port.pre.mk>
+
+.if ${PORT_OPTIONS:MHEIMDAL_BASE} && !exists(/usr/lib/libkrb5.so)
+IGNORE= you have selected HEIMDAL_BASE but do not have Heimdal installed in base
+.endif
+
+.if ${COMPILER_VERSION} < 180
+LLVM_DEFAULT= 18
+BUILD_DEPENDS+= clang${LLVM_DEFAULT}:devel/llvm${LLVM_DEFAULT}
+BINARY_ALIAS+= cpp=${LOCALBASE}/bin/clang-cpp${LLVM_DEFAULT} \
+ cc=${LOCALBASE}/bin/clang${LLVM_DEFAULT} \
+ c++=${LOCALBASE}/bin/clang++${LLVM_DEFAULT} \
+ ar=${LOCALBASE}/bin/llvm-ar${LLVM_DEFAULT} \
+ nm=${LOCALBASE}/bin/llvm-nm${LLVM_DEFAULT} \
+ ld=${LOCALBASE}/bin/ld.lld${LLVM_DEFAULT}
+.else
+BINARY_ALIAS+= ar=/usr/bin/llvm-ar \
+ nm=/usr/bin/llvm-nm
+.endif
+CFLAGS+= -Wno-error=implicit-function-declaration
+
+.if ${ARCH} == "aarch64"
+PLIST_SUB+= AARCH64="" \
+ AMD64="@comment " \
+ I386="@comment " \
+ NOT_AARCH64="@comment "
+FFMPEG_TARGET= arm64
+.elif ${ARCH} == "amd64"
+BUILD_DEPENDS+= nasm:devel/nasm
+PLIST_SUB+= AARCH64="@comment " \
+ AMD64="" \
+ I386="@comment " \
+ NOT_AARCH64=""
+FFMPEG_TARGET= x64
+.elif ${ARCH} == "i386"
+BUILD_DEPENDS+= nasm:devel/nasm
+PLIST_SUB+= AARCH64="@comment " \
+ AMD64="@comment " \
+ I386="" \
+ NOT_AARCH64=""
+FFMPEG_TARGET= ia32
+.endif
+
+FFMPEG_BDIR= ${WRKSRC}/third_party/ffmpeg/build.${FFMPEG_TARGET}.freebsd/${FFMPEG_BRAND}
+FFMPEG_CDIR= ${WRKSRC}/third_party/ffmpeg/chromium/config/${FFMPEG_BRAND}/freebsd/${FFMPEG_TARGET}
+
+# Allow relocations against read-only segments (override lld default)
+LDFLAGS_i386= -Wl,-znotext
+
+# TODO: -isystem, would be just as ugly as this approach, but more reliably
+# build would fail without C_INCLUDE_PATH/CPLUS_INCLUDE_PATH env var set.
+MAKE_ENV+= C_INCLUDE_PATH=${LOCALBASE}/include \
+ CPLUS_INCLUDE_PATH=${LOCALBASE}/include
+
+# rust
+RUSTC_VERSION!= rustc -V 2>/dev/null || true
+MAKE_ENV+= RUSTC_BOOTSTRAP=1
+GN_ARGS+= enable_rust=true \
+ rust_sysroot_absolute="${LOCALBASE}" \
+ rustc_version="${RUSTC_VERSION}"
+
+pre-everything::
+ @${ECHO_MSG}
+ @${ECHO_MSG} "To build electron, you should have around 2GB of memory"
+ @${ECHO_MSG} "and around ${WANTSPACE} of free disk space."
+ @${ECHO_MSG}
+
+pre-fetch:
+ @${MKDIR} ${DISTDIR}/${DIST_SUBDIR}
+ if [ ! -f ${DISTDIR}/${DIST_SUBDIR}/electron-yarn-cache-${ELECTRON_VER}${EXTRACT_SUFX} ]; \
+ then ${MKDIR} ${WRKDIR}; \
+ ${ECHO_CMD} 'yarn-offline-mirror "./yarn-offline-cache"' >> \
+ ${WRKDIR}/.yarnrc; \
+ ${CP} ${FILESDIR}/package.json ${FILESDIR}/yarn.lock ${WRKDIR}; \
+ cd ${WRKDIR} && ${SETENV} HOME=${WRKDIR} XDG_CACHE_HOME=${WRKDIR}/.cache \
+ yarn --frozen-lockfile --ignore-scripts; \
+ ${MTREE_CMD} -cbnSp yarn-offline-cache | ${MTREE_CMD} -C | ${SED} \
+ -e 's:time=[0-9.]*:time=${YARN_TIMESTAMP}.000000000:' \
+ -e 's:\([gu]id\)=[0-9]*:\1=0:g' \
+ -e 's:mode=\([0-9]\)7[0-9][0-9]:mode=\1755:' \
+ -e 's:mode=\([0-9]\)6[0-9][0-9]:mode=\1644:' \
+ -e 's:flags=.*:flags=none:' \
+ -e 's:^\.:./yarn-offline-cache:' > yarn-offline-cache.mtree; \
+ ${TAR} cJf ${DISTDIR}/${DIST_SUBDIR}/electron-yarn-cache-${ELECTRON_VER}${EXTRACT_SUFX} \
+ @yarn-offline-cache.mtree; \
+ ${RM} -r ${WRKDIR}; \
+ fi
+
+post-extract:
+# Move extracted sources to appropriate locations
+ ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/chromium-${CHROMIUM_VER} ${WRKSRC}
+ ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${PORTNAME}-${ELECTRON_VER} ${WRKSRC}/electron
+ ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${GH_PROJECT_nan}-${NAN_VER} \
+ ${WRKSRC}/third_party/nan
+ ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${GH_PROJECT_node}-${NODE_VER} \
+ ${WRKSRC}/third_party/electron_node
+ ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${GH_PROJECT_squirrel_mac}-${SQUIRREL_MAC_VER} \
+ ${WRKSRC}/third_party/squirrel.mac
+ ${MKDIR} ${WRKSRC}/third_party/squirrel.mac/vendor
+ ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${GH_PROJECT_reactiveobjc}-${REACTIVEOBJC_VER} \
+ ${WRKSRC}/third_party/squirrel.mac/vendor/ReactiveObjC
+ ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${GH_PROJECT_mantle}-${MANTLE_VER} \
+ ${WRKSRC}/third_party/squirrel.mac/vendor/Mantle
+ ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${GH_PROJECT_reclient_configs}-${ENGFLOW_RECLIENT_CONFIGS_VER} \
+ ${WRKSRC}/third_party/engflow-reclient-configs
+# Install node modules for electron
+ ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/yarn-offline-cache ${WRKDIR}
+ ${ECHO_CMD} 'yarn-offline-mirror "../../../yarn-offline-cache"' >> ${WRKSRC}/electron/.yarnrc
+ ${MV} ${WRKSRC}/electron/package.json ${WRKSRC}/electron/package.json.bak
+ ${CP} ${FILESDIR}/package.json ${WRKSRC}/electron
+ cd ${WRKSRC}/electron && \
+ ${SETENV} HOME=${WRKDIR} XDG_CACHE_HOME=${WRKDIR}/.cache yarn --frozen-lockfile --offline
+
+pre-patch:
+ ${SH} ${FILESDIR}/apply-electron-patches.sh ${WRKSRC}
+ # ${FIND} ${WRKSRC} -type f -name '*.orig' -print -delete
+ # ${FIND} ${WRKSRC} -type f -name '*~' -print -delete
+
+pre-configure:
+ # We used to remove bundled libraries to be sure that chromium uses
+ # system libraries and not shipped ones.
+ # cd ${WRKSRC} && ${PYTHON_CMD} \
+ #./build/linux/unbundle/remove_bundled_libraries.py [list of preserved]
+ cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} ${PYTHON_CMD} \
+ ./build/linux/unbundle/replace_gn_files.py --system-libraries \
+ dav1d flac fontconfig freetype harfbuzz-ng icu libdrm libevent \
+ libpng libusb libwebp libxml libxslt openh264 opus || ${FALSE}
+ # Chromium uses an unreleased version of FFmpeg, so configure it
+ cd ${WRKSRC}/media/ffmpeg && \
+ ${PYTHON_CMD} scripts/build_ffmpeg.py freebsd ${FFMPEG_TARGET} \
+ --config-only --branding=${FFMPEG_BRAND}
+ cd ${FFMPEG_BDIR} && ${GMAKE} ffversion.h
+ ${MKDIR} ${FFMPEG_CDIR}
+.for _e in config.h config.asm config_components.h libavcodec libavformat libavutil
+ -${CP} -pR ${FFMPEG_BDIR}/${_e} ${FFMPEG_CDIR}
+.endfor
+ touch ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/pulseaudio-${PULSEV}/src/pulse/version.h
+
+do-configure:
+ # GN generator bootstrapping and generating ninja files
+ cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} CC=${CC} CXX=${CXX} LD=${CXX} \
+ READELF=${READELF} AR=${AR} NM=${NM} ${PYTHON_CMD} \
+ ./tools/gn/bootstrap/bootstrap.py ${GN_BOOTSTRAP_FLAGS}
+ cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} ./out/${BUILDTYPE}/gn gen out/${BUILDTYPE} \
+ --args='import("//electron/build/args/${GN_FILE}") ${GN_ARGS}'
+
+ # Setup nodejs dependency
+ @${MKDIR} ${WRKSRC}/third_party/node/freebsd/node-freebsd/bin
+ ${LN} -sf ${LOCALBASE}/bin/node ${WRKSRC}/third_party/node/freebsd/node-freebsd/bin/node
+
+ # Setup buildtools/freebsd
+ @${MKDIR} ${WRKSRC}/buildtools/freebsd
+ ${LN} -sf ${WRKSRC}/buildtools/linux64/clang-format ${WRKSRC}/buildtools/freebsd
+ ${LN} -sf ${WRKSRC}/out/${BUILDTYPE}/gn ${WRKSRC}/buildtools/freebsd
+ ${LN} -sf /usr/bin/strip ${WRKSRC}/buildtools/freebsd/strip
+
+post-build:
+ cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
+ ${MAKE_CMD} ${MAKE_ARGS} ${POST_BUILD_TARGETS}
+
+post-build-DIST-on:
+ cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
+ ${MAKE_CMD} ${MAKE_ARGS} ${POST_BUILD_DIST_TARGETS}
+ cd ${WRKSRC}/out/${BUILDTYPE} && \
+ ${CP} chromedriver.zip chromedriver-v${ELECTRON_VER}-freebsd-${ARCH:S/amd64/x64/:S/i386/ia32/}.zip && \
+ ${CP} dist.zip electron-v${ELECTRON_VER}-freebsd-${ARCH:S/amd64/x64/:S/i386/ia32/}.zip && \
+ ${CP} mksnapshot.zip mksnapshot-v${ELECTRON_VER}-freebsd-${ARCH:S/amd64/x64/:S/i386/ia32/}.zip && \
+ ${SHA256} -r *-v${ELECTRON_VER}-freebsd-*.zip | ${SED} -e 's/ / */' > SHASUMS256.txt
+
+do-install:
+ ${MKDIR} ${STAGEDIR}${DATADIR}
+.for f in electron mksnapshot v8_context_snapshot_generator
+ ${INSTALL_PROGRAM} ${WRKSRC}/out/${BUILDTYPE}/${f} ${STAGEDIR}${DATADIR}
+.endfor
+.for f in libEGL.so libGLESv2.so libffmpeg.so libvk_swiftshader.so
+ ${INSTALL_LIB} ${WRKSRC}/out/${BUILDTYPE}/${f} ${STAGEDIR}${DATADIR}
+.endfor
+ ${INSTALL_LIB} ${WRKSRC}/out/${BUILDTYPE}/libvulkan.so.1 ${STAGEDIR}${DATADIR}/libvulkan.so
+.for f in LICENSE LICENSES.chromium.html snapshot_blob.bin v8_context_snapshot.bin version vk_swiftshader_icd.json
+ ${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/${f} ${STAGEDIR}${DATADIR}
+.endfor
+.for f in chrome_100_percent.pak chrome_200_percent.pak resources.pak
+ ${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/${f} ${STAGEDIR}${DATADIR}
+.endfor
+ ${MKDIR} ${STAGEDIR}${DATADIR}/locales
+ ${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/locales/*.pak ${STAGEDIR}${DATADIR}/locales
+ ${MKDIR} ${STAGEDIR}${DATADIR}/resources
+.for f in default_app.asar
+ ${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/resources/${f} ${STAGEDIR}${DATADIR}/resources
+.endfor
+ cd ${WRKSRC}/out/${BUILDTYPE}/gen && ${COPYTREE_SHARE} node_headers ${STAGEDIR}${DATADIR}
+ cd ${WRKSRC}/out/${BUILDTYPE} && ${COPYTREE_SHARE} gen/electron/buildflags ${STAGEDIR}${DATADIR}
+ cd ${WRKSRC}/out/${BUILDTYPE} && ${COPYTREE_SHARE} gen/v8/embedded.S ${STAGEDIR}${DATADIR}
+ ${RLN} ${STAGEDIR}${DATADIR}/electron ${STAGEDIR}${PREFIX}/bin/electron${PKGNAMESUFFIX}
+
+post-install-DIST-on:
+ ${MKDIR} ${STAGEDIR}${DATADIR}/releases
+ ${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/SHASUMS256.txt ${STAGEDIR}${DATADIR}/releases
+ ${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/*-v${ELECTRON_VER}-freebsd-*.zip ${STAGEDIR}${DATADIR}/releases
+
+post-install-DRIVER-on:
+ ${INSTALL_PROGRAM} ${WRKSRC}/out/${BUILDTYPE}/chromedriver.unstripped \
+ ${STAGEDIR}${DATADIR}/chromedriver
+
+do-test:
+# Note 1: "npm install" will run before actual tests are executed
+# Note 2: Xvfb or something similar is necessary for headless testing
+ cd ${WRKSRC}/electron && \
+ ${SETENV} ${TEST_ENV} ELECTRON_OUT_DIR=${BUILDTYPE} LOCAL_GIT_DIRECTORY=${LOCALBASE} \
+ npm run test -- --ci
+
+.include <bsd.port.post.mk>
diff --git a/devel/electron31/Makefile.version b/devel/electron31/Makefile.version
new file mode 100644
index 000000000000..97a99643e05e
--- /dev/null
+++ b/devel/electron31/Makefile.version
@@ -0,0 +1,2 @@
+ELECTRON_VER= 31.2.1
+ELECTRON_VER_MAJOR= ${ELECTRON_VER:C/\..*//}
diff --git a/devel/electron31/distinfo b/devel/electron31/distinfo
new file mode 100644
index 000000000000..269552926320
--- /dev/null
+++ b/devel/electron31/distinfo
@@ -0,0 +1,21 @@
+TIMESTAMP = 1721194519
+SHA256 (electron/chromium-126.0.6478.127.tar.xz) = 6caf331dc78089f8bffcadc289fafd527ed3a56aaf5e9307c4227411133f0f7e
+SIZE (electron/chromium-126.0.6478.127.tar.xz) = 4167068116
+SHA256 (electron/pulseaudio-16.1.tar.gz) = 027266c62f2a84422ac45fa721a649508f0f1628fb1fd9242315ac54ce2d7c92
+SIZE (electron/pulseaudio-16.1.tar.gz) = 2763111
+SHA256 (electron/electron-yarn-cache-31.2.1.tar.xz) = 8b9a13b091dacb8b4f3ea7bb44826d7cf3062bc2700462d20a261da3d61ca189
+SIZE (electron/electron-yarn-cache-31.2.1.tar.xz) = 29172376
+SHA256 (electron/electron-electron-v31.2.1_GH0.tar.gz) = dfcef2efc3ca13f30ada6f466919099923b6dcd5d7f7df246d7657681ad52ad0
+SIZE (electron/electron-electron-v31.2.1_GH0.tar.gz) = 13826490
+SHA256 (electron/nodejs-node-v20.15.0_GH0.tar.gz) = 355d48c780d49c8bd5063016bc56c642db2840f6392d037cf74fd864c53f6922
+SIZE (electron/nodejs-node-v20.15.0_GH0.tar.gz) = 115459744
+SHA256 (electron/nodejs-nan-e14bdcd1f72d62bca1d541b66da43130384ec213_GH0.tar.gz) = 02edf8d5b3fef9af94d8a1355da60564a57e7f2c99cb422bce042400607ed2eb
+SIZE (electron/nodejs-nan-e14bdcd1f72d62bca1d541b66da43130384ec213_GH0.tar.gz) = 180646
+SHA256 (electron/Squirrel-Squirrel.Mac-0e5d146ba13101a1302d59ea6e6e0b3cace4ae38_GH0.tar.gz) = f4ebb40a8d85dbb7ef02aa0571b2f8e22182c6d73b6992484a53c90047779d01
+SIZE (electron/Squirrel-Squirrel.Mac-0e5d146ba13101a1302d59ea6e6e0b3cace4ae38_GH0.tar.gz) = 2112918
+SHA256 (electron/ReactiveCocoa-ReactiveObjC-74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76_GH0.tar.gz) = 88e65f116c7a06fccedb43970fba63080a57a4e5dc29147d2cdfe1ee58dd0546
+SIZE (electron/ReactiveCocoa-ReactiveObjC-74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76_GH0.tar.gz) = 1136238
+SHA256 (electron/Mantle-Mantle-78d3966b3c331292ea29ec38661b25df0a245948_GH0.tar.gz) = a365df6d83e0be3cc000b70bd39734d80c28f0d9983ebe44698337a2ca464bb1
+SIZE (electron/Mantle-Mantle-78d3966b3c331292ea29ec38661b25df0a245948_GH0.tar.gz) = 62962
+SHA256 (electron/EngFlow-reclient-configs-955335c30a752e9ef7bff375baab5e0819b6c00d_GH0.tar.gz) = c148f76220fc41a89ffeaf370c2cc175577be184688b12aa6fec5f8ac6c714c4
+SIZE (electron/EngFlow-reclient-configs-955335c30a752e9ef7bff375baab5e0819b6c00d_GH0.tar.gz) = 13014
diff --git a/devel/electron31/files/apply-electron-patches.sh b/devel/electron31/files/apply-electron-patches.sh
new file mode 100644
index 000000000000..367de24e9a71
--- /dev/null
+++ b/devel/electron31/files/apply-electron-patches.sh
@@ -0,0 +1,26 @@
+#! /bin/sh
+
+PATH=/bin:/usr/bin:/usr/local/bin
+
+GIT_CMD="git"
+PATCH_CMD="${GIT_CMD} apply"
+#PATCH_FLAGS="--numstat --check" # for debugging
+PATCH_FLAGS="--verbose --reject"
+
+WRKSRC=$1
+PATCH_CONF=${WRKSRC}/electron/patches/config.json
+
+${GIT_CMD} status "${WRKSRC}" > /dev/null 2>&1 && IS_GIT_REPO=1
+
+PATCHD_REPOD_PAIRS=$(jq -r '.[] | .patch_dir + ":" + .repo' "${PATCH_CONF}")
+for prp in ${PATCHD_REPOD_PAIRS}; do
+ pd=$(echo "${prp}" | awk -F: '{print $1}' | sed -e 's/src/./')
+ rd=$(echo "${prp}" | awk -F: '{print $2}' | sed -e 's/src/./')
+ (cd "${WRKSRC}/${rd}" && \
+ if [ -n "${IS_GIT_REPO}" ]; then
+ PATCH_FLAGS="${PATCH_FLAGS} --directory=$(${GIT_CMD} rev-parse --show-prefix)"
+ fi && \
+ while read -r p; do
+ ${PATCH_CMD} ${PATCH_FLAGS} "${WRKSRC}/${pd}/${p}"
+ done < "${WRKSRC}/${pd}/.patches")
+done
diff --git a/devel/electron31/files/package.json b/devel/electron31/files/package.json
new file mode 100644
index 000000000000..fbeee6954fbe
--- /dev/null
+++ b/devel/electron31/files/package.json
@@ -0,0 +1,152 @@
+{
+ "name": "electron",
+ "version": "0.0.0-development",
+ "repository": "https://github.com/electron/electron",
+ "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
+ "devDependencies": {
+ "@azure/storage-blob": "^12.9.0",
+ "@electron/asar": "^3.2.1",
+ "@electron/docs-parser": "^1.2.0",
+ "@electron/fiddle-core": "^1.0.4",
+ "@electron/github-app-auth": "^2.0.0",
+ "@electron/lint-roller": "^1.12.1",
+ "@electron/typescript-definitions": "^8.15.2",
+ "@octokit/rest": "^19.0.7",
+ "@primer/octicons": "^10.0.0",
+ "@types/basic-auth": "^1.1.3",
+ "@types/busboy": "^1.5.0",
+ "@types/chai": "^4.2.12",
+ "@types/chai-as-promised": "^7.1.3",
+ "@types/dirty-chai": "^2.0.2",
+ "@types/express": "^4.17.13",
+ "@types/minimist": "^1.2.0",
+ "@types/mocha": "^7.0.2",
+ "@types/node": "^20.9.0",
+ "@types/semver": "^7.3.3",
+ "@types/send": "^0.14.5",
+ "@types/split": "^1.0.0",
+ "@types/stream-json": "^1.5.1",
+ "@types/temp": "^0.8.34",
+ "@types/uuid": "^3.4.6",
+ "@types/w3c-web-serial": "^1.0.3",
+ "@types/webpack": "^5.28.0",
+ "@types/webpack-env": "^1.17.0",
+ "@typescript-eslint/eslint-plugin": "^5.59.7",
+ "@typescript-eslint/parser": "^5.59.7",
+ "buffer": "^6.0.3",
+ "check-for-leaks": "^1.2.1",
+ "colors": "1.4.0",
+ "dotenv-safe": "^4.0.4",
+ "dugite": "^2.3.0",
+ "eslint": "^8.41.0",
+ "eslint-config-standard": "^14.1.1",
+ "eslint-plugin-import": "^2.26.0",
+ "eslint-plugin-mocha": "^7.0.1",
+ "eslint-plugin-node": "^11.1.0",
+ "eslint-plugin-promise": "^4.2.1",
+ "eslint-plugin-standard": "^4.0.1",
+ "eslint-plugin-unicorn": "^46.0.1",
+ "events": "^3.2.0",
+ "express": "^4.19.2",
+ "folder-hash": "^2.1.1",
+ "got": "^11.8.5",
+ "husky": "^8.0.1",
+ "lint": "^1.1.2",
+ "lint-staged": "^10.2.11",
+ "minimist": "^1.2.6",
+ "null-loader": "^4.0.0",
+ "pre-flight": "^1.1.0",
+ "process": "^0.11.10",
+ "remark-cli": "^10.0.0",
+ "remark-preset-lint-markdown-style-guide": "^4.0.0",
+ "semver": "^7.5.2",
+ "shx": "^0.3.2",
+ "stream-json": "^1.7.1",
+ "tap-xunit": "^2.4.1",
+ "temp": "^0.8.3",
+ "timers-browserify": "1.4.2",
+ "ts-loader": "^8.0.2",
+ "ts-node": "6.2.0",
+ "typescript": "^5.1.2",
+ "url": "^0.11.0",
+ "webpack": "^5.76.0",
+ "webpack-cli": "^4.10.0",
+ "wrapper-webpack-plugin": "^2.2.0"
+ },
+ "private": true,
+ "scripts": {
+ "asar": "asar",
+ "generate-version-json": "node script/generate-version-json.js",
+ "lint": "node ./script/lint.js && npm run lint:docs",
+ "lint:js": "node ./script/lint.js --js",
+ "lint:clang-format": "python3 script/run-clang-format.py -r -c shell/ || (echo \"\\nCode not formatted correctly.\" && exit 1)",
+ "lint:clang-tidy": "ts-node ./script/run-clang-tidy.ts",
+ "lint:cpp": "node ./script/lint.js --cc",
+ "lint:objc": "node ./script/lint.js --objc",
+ "lint:py": "node ./script/lint.js --py",
+ "lint:gn": "node ./script/lint.js --gn",
+ "lint:docs": "remark docs -qf && npm run lint:js-in-markdown && npm run create-typescript-definitions && npm run lint:ts-check-js-in-markdown && npm run lint:docs-fiddles && npm run lint:docs-relative-links && npm run lint:markdown",
+ "lint:docs-fiddles": "standard \"docs/fiddles/**/*.js\"",
+ "lint:docs-relative-links": "electron-lint-markdown-links --root docs \"**/*.md\"",
+ "lint:markdown": "node ./script/lint.js --md",
+ "lint:ts-check-js-in-markdown": "electron-lint-markdown-ts-check --root docs \"**/*.md\" --ignore \"breaking-changes.md\"",
+ "lint:js-in-markdown": "electron-lint-markdown-standard --root docs \"**/*.md\"",
+ "create-api-json": "node script/create-api-json.js",
+ "create-typescript-definitions": "npm run create-api-json && electron-typescript-definitions --api=electron-api.json && node spec/ts-smoke/runner.js",
+ "gn-typescript-definitions": "npm run create-typescript-definitions && shx cp electron.d.ts",
+ "pre-flight": "pre-flight",
+ "gn-check": "node ./script/gn-check.js",
+ "gn-format": "python3 script/run-gn-format.py",
+ "precommit": "lint-staged",
+ "preinstall": "node -e 'process.exit(0)'",
+ "pretest": "npm run create-typescript-definitions",
+ "prepack": "check-for-leaks",
+ "repl": "node ./script/start.js --interactive",
+ "start": "node ./script/start.js",
+ "test": "node ./script/spec-runner.js",
+ "tsc": "tsc",
+ "webpack": "webpack"
+ },
+ "license": "MIT",
+ "author": "Electron Community",
+ "keywords": [
+ "electron"
+ ],
+ "lint-staged": {
+ "*.{js,ts}": [
+ "node script/lint.js --js --fix --only --"
+ ],
+ "*.{js,ts,d.ts}": [
+ "ts-node script/gen-filenames.ts"
+ ],
+ "*.{cc,mm,c,h}": [
+ "python3 script/run-clang-format.py -r -c --fix"
+ ],
+ "*.md": [
+ "npm run lint:docs"
+ ],
+ "*.{gn,gni}": [
+ "npm run gn-check",
+ "npm run gn-format"
+ ],
+ "*.py": [
+ "node script/lint.js --py --fix --only --"
+ ],
+ "docs/api/**/*.md": [
+ "ts-node script/gen-filenames.ts",
+ "electron-markdownlint --config .markdownlint.autofix.json --fix",
+ "git add filenames.auto.gni"
+ ],
+ "{*.patch,.patches}": [
+ "node script/lint.js --patches --only --",
+ "ts-node script/check-patch-diff.ts"
+ ],
+ "DEPS": [
+ "node script/gen-hunspell-filenames.js",
+ "node script/gen-libc++-filenames.js"
+ ]
+ },
+ "resolutions": {
+ "nan": "nodejs/nan#e14bdcd1f72d62bca1d541b66da43130384ec213"
+ }
+}
diff --git a/devel/electron31/files/patch-BUILD.gn b/devel/electron31/files/patch-BUILD.gn
new file mode 100644
index 000000000000..091ab0089175
--- /dev/null
+++ b/devel/electron31/files/patch-BUILD.gn
@@ -0,0 +1,89 @@
+--- BUILD.gn.orig 2024-06-30 11:48:28 UTC
++++ BUILD.gn
+@@ -65,7 +65,7 @@ declare_args() {
+ root_extra_deps = []
+ }
+
+-if (is_official_build) {
++if (is_official_build && !is_bsd) {
+ # An official (maximally optimized!) component (optimized for build times)
+ # build doesn't make sense and usually doesn't work.
+ assert(!is_component_build)
+@@ -97,7 +97,6 @@ group("gn_all") {
+ "//codelabs",
+ "//components:components_unittests",
+ "//components/gwp_asan:gwp_asan_unittests",
+- "//infra/orchestrator:orchestrator_all",
+ "//net:net_unittests",
+ "//sandbox:sandbox_unittests",
+ "//services:services_unittests",
+@@ -428,7 +427,7 @@ group("gn_all") {
+ }
+ }
+
+- if (is_linux || is_chromeos || is_android) {
++ if ((is_linux && !is_bsd) || is_chromeos || is_android) {
+ deps += [
+ "//third_party/breakpad:breakpad_unittests",
+ "//third_party/breakpad:core-2-minidump",
+@@ -624,6 +623,15 @@ group("gn_all") {
+ }
+ }
+
++ if (is_bsd) {
++ deps -= [
++ "//third_party/breakpad:dump_syms($host_toolchain)",
++ "//third_party/breakpad:microdump_stackwalk($host_toolchain)",
++ "//third_party/breakpad:minidump_dump($host_toolchain)",
++ "//third_party/breakpad:minidump_stackwalk($host_toolchain)",
++ ]
++ }
++
+ if (is_mac) {
+ deps += [
+ "//third_party/breakpad:dump_syms",
+@@ -670,7 +678,7 @@ group("gn_all") {
+ host_os == "win") {
+ deps += [ "//chrome/test/mini_installer:mini_installer_tests" ]
+ }
+- } else if (!is_android && !is_ios && !is_fuchsia) {
++ } else if (!is_android && !is_ios && !is_fuchsia && !is_bsd) {
+ deps += [ "//third_party/breakpad:symupload($host_toolchain)" ]
+ }
+
+@@ -1093,7 +1101,7 @@ if (use_blink && !is_cronet_build) {
+ ]
+ }
+
+- if (!is_chromeos_ash && !is_ios && !is_fuchsia && !is_android && !is_castos) {
++ if (!is_chromeos_ash && !is_ios && !is_fuchsia && !is_android && !is_castos && !is_bsd) {
+ script_test("chrome_wpt_tests") {
+ script = "//third_party/blink/tools/run_wpt_tests.py"
+ args = [
+@@ -1188,7 +1196,7 @@ if (use_blink && !is_cronet_build) {
+ data_deps += [ "//content/web_test:web_test_common_mojom_js_data_deps" ]
+ }
+
+- if (!is_win && !is_android) {
++ if (!is_win && !is_android && !is_bsd) {
+ data_deps +=
+ [ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ]
+ }
+@@ -1197,7 +1205,7 @@ if (use_blink && !is_cronet_build) {
+ data_deps += [ "//third_party/breakpad:dump_syms($host_toolchain)" ]
+ }
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux && !is_bsd) || is_chromeos) {
+ data_deps += [ "//third_party/breakpad:dump_syms($host_toolchain)" ]
+ }
+
+@@ -1657,7 +1665,7 @@ group("chromium_builder_perf") {
+ data_deps += [ "//chrome/test:performance_browser_tests" ]
+ }
+
+- if (!is_win) {
++ if (!is_win && !is_bsd) {
+ data_deps +=
+ [ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ]
+ }
diff --git a/devel/electron31/files/patch-apps_ui_views_app__window__frame__view.cc b/devel/electron31/files/patch-apps_ui_views_app__window__frame__view.cc
new file mode 100644
index 000000000000..bce8c0c59c91
--- /dev/null
+++ b/devel/electron31/files/patch-apps_ui_views_app__window__frame__view.cc
@@ -0,0 +1,11 @@
+--- apps/ui/views/app_window_frame_view.cc.orig 2024-06-18 21:43:16 UTC
++++ apps/ui/views/app_window_frame_view.cc
+@@ -148,7 +148,7 @@ gfx::Rect AppWindowFrameView::GetWindowBoundsForClient
+ gfx::Rect window_bounds = client_bounds;
+ // TODO(crbug.com/40118868): Revisit once build flag switch of lacros-chrome is
+ // complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Get the difference between the widget's client area bounds and window
+ // bounds, and grow |window_bounds| by that amount.
+ gfx::Insets native_frame_insets =
diff --git a/devel/electron31/files/patch-ash_display_mirror__window__controller.cc b/devel/electron31/files/patch-ash_display_mirror__window__controller.cc
new file mode 100644
index 000000000000..76b5d1103bda
--- /dev/null
+++ b/devel/electron31/files/patch-ash_display_mirror__window__controller.cc
@@ -0,0 +1,14 @@
+--- ash/display/mirror_window_controller.cc.orig 2023-10-19 19:57:56 UTC
++++ ash/display/mirror_window_controller.cc
+@@ -294,7 +294,11 @@ void MirrorWindowController::UpdateWindow(
+ if (!base::Contains(display_info_list, iter->first,
+ &display::ManagedDisplayInfo::id)) {
+ CloseAndDeleteHost(iter->second, true);
++#if defined(__llvm__)
++ mirroring_host_info_map_.erase(iter++);
++#else
+ iter = mirroring_host_info_map_.erase(iter);
++#endif
+ } else {
+ ++iter;
+ }
diff --git a/devel/electron31/files/patch-base_BUILD.gn b/devel/electron31/files/patch-base_BUILD.gn
new file mode 100644
index 000000000000..1481256d549e
--- /dev/null
+++ b/devel/electron31/files/patch-base_BUILD.gn
@@ -0,0 +1,157 @@
+--- base/BUILD.gn.orig 2024-06-30 11:48:27 UTC
++++ base/BUILD.gn
+@@ -200,7 +200,7 @@ buildflag_header("ios_cronet_buildflags") {
+ flags = [ "CRONET_BUILD=$is_cronet_build" ]
+ }
+
+-enable_message_pump_epoll = is_linux || is_chromeos || is_android
++enable_message_pump_epoll = (is_linux || is_chromeos || is_android) && !is_bsd
+ buildflag_header("message_pump_buildflags") {
+ header = "message_pump_buildflags.h"
+ header_dir = "base/message_loop"
+@@ -1143,11 +1143,24 @@ component("base") {
+ # Needed for <atomic> if using newer C++ library than sysroot, except if
+ # building inside the cros_sdk environment - use host_toolchain as a
+ # more robust check for this.
+- if (!use_sysroot && (is_android || is_chromeos || (is_linux && !is_castos)) &&
++ if (!use_sysroot && (is_android || is_chromeos || (is_linux && !is_castos && !is_bsd)) &&
+ host_toolchain != "//build/toolchain/cros:host") {
+ libs += [ "atomic" ]
+ }
+
++ # *BSD needs libkvm
++ if (is_bsd) {
++ libs += [ "kvm" ]
++ }
++
++ if (is_freebsd) {
++ libs += [
++ "execinfo",
++ "util",
++ "z",
++ ]
++ }
++
+ if (use_allocator_shim) {
+ if (is_apple) {
+ sources += [ "allocator/early_zone_registration_apple.h" ]
+@@ -1167,7 +1180,7 @@ component("base") {
+
+ # Allow more direct string conversions on platforms with native utf8
+ # strings
+- if (is_apple || is_chromeos || is_castos || is_cast_android || is_fuchsia) {
++ if (is_apple || is_chromeos || is_castos || is_cast_android || is_fuchsia || is_bsd) {
+ defines += [ "SYSTEM_NATIVE_UTF8" ]
+ }
+
+@@ -2127,6 +2140,22 @@ component("base") {
+ ]
+ }
+
++ if (is_openbsd) {
++ sources += [
++ "process/process_handle_openbsd.cc",
++ "process/process_iterator_openbsd.cc",
++ "process/process_metrics_openbsd.cc",
++ "system/sys_info_openbsd.cc",
++ ]
++ } else if (is_freebsd) {
++ sources += [
++ "process/process_handle_freebsd.cc",
++ "process/process_iterator_freebsd.cc",
++ "process/process_metrics_freebsd.cc",
++ "system/sys_info_freebsd.cc",
++ ]
++ }
++
+ # iOS
+ if (is_ios) {
+ sources += [
+@@ -2272,6 +2301,33 @@ component("base") {
+ }
+ }
+
++ if (is_bsd) {
++ sources -= [
++ "files/file_path_watcher_inotify.cc",
++ "files/scoped_file_linux.cc",
++ "process/set_process_title_linux.cc",
++ "process/set_process_title_linux.h",
++ "system/sys_info_linux.cc",
++ "process/process_iterator_linux.cc",
++ "process/process_linux.cc",
++ "process/process_metrics_linux.cc",
++ "process/process_handle_linux.cc",
++ "profiler/stack_copier_signal.cc",
++ "profiler/stack_copier_signal.h",
++ "profiler/thread_delegate_posix.cc",
++ "profiler/thread_delegate_posix.h",
++ "threading/platform_thread_linux.cc",
++ "stack_canary_linux.cc",
++ "stack_canary_linux.h",
++ ]
++ sources += [
++ "files/file_path_watcher_kqueue.cc",
++ "files/file_path_watcher_kqueue.h",
++ "files/file_path_watcher_bsd.cc",
++ "threading/platform_thread_bsd.cc",
++ ]
++ }
++
+ if (use_blink) {
+ sources += [
+ "files/file_path_watcher.cc",
+@@ -2282,7 +2338,7 @@ component("base") {
+ }
+
+ if (dep_libevent) {
+- deps += [ "//third_party/libevent" ]
++ public_deps += [ "//third_party/libevent" ]
+ }
+
+ if (use_libevent) {
+@@ -3095,7 +3151,7 @@ if (is_apple) {
+ }
+ }
+
+-if (!is_nacl && (is_linux || is_chromeos)) {
++if (!is_nacl && !is_bsd && (is_linux || is_chromeos)) {
+ # This test must compile with -fstack-protector-all
+ source_set("stack_canary_linux_unittests") {
+ testonly = true
+@@ -3744,7 +3800,7 @@ test("base_unittests") {
+ ]
+ }
+
+- if (is_linux || is_chromeos) {
++ if (!is_bsd && (is_linux || is_chromeos)) {
+ sources += [
+ "debug/proc_maps_linux_unittest.cc",
+ "files/scoped_file_linux_unittest.cc",
+@@ -3771,7 +3827,7 @@ test("base_unittests") {
+ "posix/file_descriptor_shuffle_unittest.cc",
+ "posix/unix_domain_socket_unittest.cc",
+ ]
+- if (!is_nacl && !is_apple) {
++ if (!is_nacl && !is_apple && !is_bsd) {
+ sources += [
+ "profiler/stack_base_address_posix_unittest.cc",
+ "profiler/stack_copier_signal_unittest.cc",
+@@ -3782,7 +3838,7 @@ test("base_unittests") {
+
+ # Allow more direct string conversions on platforms with native utf8
+ # strings
+- if (is_apple || is_chromeos || is_castos || is_cast_android || is_fuchsia) {
++ if (is_apple || is_chromeos || is_castos || is_cast_android || is_fuchsia || is_bsd) {
+ defines += [ "SYSTEM_NATIVE_UTF8" ]
+ }
+
+@@ -4050,7 +4106,7 @@ test("base_unittests") {
+ }
+ }
+
+- if (is_fuchsia || is_linux || is_chromeos) {
++ if ((is_fuchsia || is_linux || is_chromeos) && !is_bsd) {
+ sources += [
+ "debug/elf_reader_unittest.cc",
+ "debug/test_elf_image_builder.cc",
diff --git a/devel/electron31/files/patch-base_allocator_dispatcher_tls.h b/devel/electron31/files/patch-base_allocator_dispatcher_tls.h
new file mode 100644
index 000000000000..e0cc1924a403
--- /dev/null
+++ b/devel/electron31/files/patch-base_allocator_dispatcher_tls.h
@@ -0,0 +1,11 @@
+--- base/allocator/dispatcher/tls.h.orig 2024-06-18 21:43:17 UTC
++++ base/allocator/dispatcher/tls.h
+@@ -77,7 +77,7 @@ struct BASE_EXPORT MMapAllocator {
+ constexpr static size_t AllocationChunkSize = 16384;
+ #elif BUILDFLAG(IS_ANDROID) && defined(ARCH_CPU_64_BITS)
+ constexpr static size_t AllocationChunkSize = 16384;
+-#elif BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64)
++#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64)
+ constexpr static size_t AllocationChunkSize = 16384;
+ #else
+ constexpr static size_t AllocationChunkSize = 4096;
diff --git a/devel/electron31/files/patch-base_allocator_partition__allocator_partition__alloc.gni b/devel/electron31/files/patch-base_allocator_partition__allocator_partition__alloc.gni
new file mode 100644
index 000000000000..c157cfbc783c
--- /dev/null
+++ b/devel/electron31/files/patch-base_allocator_partition__allocator_partition__alloc.gni
@@ -0,0 +1,20 @@
+--- base/allocator/partition_allocator/partition_alloc.gni.orig 2024-06-18 21:43:17 UTC
++++ base/allocator/partition_allocator/partition_alloc.gni
+@@ -33,7 +33,7 @@ has_memory_tagging =
+ use_large_empty_slot_span_ring = is_mac
+
+ has_memory_tagging =
+- current_cpu == "arm64" && is_clang && !is_asan && (is_linux || is_android)
++ current_cpu == "arm64" && is_clang && !is_asan && !is_bsd && (is_linux || is_android)
+
+ declare_args() {
+ # Causes all the allocations to be routed via allocator_shim.cc. Usually,
+@@ -373,7 +373,7 @@ declare_args() {
+ # dependencies that use partition_allocator are compiled in AOSP against a
+ # version of glibc that does not include pkeys syscall numbers.
+ enable_pkeys =
+- (is_linux || is_chromeos) && target_cpu == "x64" && !is_cronet_build
++ !is_bsd && (is_linux || is_chromeos) && target_cpu == "x64" && !is_cronet_build
+ }
+ assert(!enable_pkeys || ((is_linux || is_chromeos) && target_cpu == "x64"),
+ "Pkeys are only supported on x64 linux and ChromeOS")
diff --git a/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_BUILD.gn b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_BUILD.gn
new file mode 100644
index 000000000000..a0cb0c519272
--- /dev/null
+++ b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_BUILD.gn
@@ -0,0 +1,11 @@
+--- base/allocator/partition_allocator/src/partition_alloc/BUILD.gn.orig 2024-06-18 21:43:17 UTC
++++ base/allocator/partition_allocator/src/partition_alloc/BUILD.gn
+@@ -884,7 +884,7 @@ if (is_clang_or_gcc) {
+ configs -= [ "//build/config/compiler:enable_arc" ]
+ }
+ }
+- if (is_chromeos || is_linux) {
++ if ((is_chromeos || is_linux) && !is_bsd) {
+ shim_headers += [
+ "shim/allocator_shim_override_cpp_symbols.h",
+ "shim/allocator_shim_override_glibc_weak_symbols.h",
diff --git a/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_address__space__randomization.h b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_address__space__randomization.h
new file mode 100644
index 000000000000..af6e66a8624c
--- /dev/null
+++ b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_address__space__randomization.h
@@ -0,0 +1,20 @@
+--- base/allocator/partition_allocator/src/partition_alloc/address_space_randomization.h.orig 2024-06-18 21:43:17 UTC
++++ base/allocator/partition_allocator/src/partition_alloc/address_space_randomization.h
+@@ -38,7 +38,7 @@ AslrMask(uintptr_t bits) {
+
+ #if defined(ARCH_CPU_64_BITS)
+
+- #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
++ #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) && !BUILDFLAG(IS_BSD)
+
+ // We shouldn't allocate system pages at all for sanitizer builds. However,
+ // we do, and if random hint addresses interfere with address ranges
+@@ -125,7 +125,7 @@ AslrMask(uintptr_t bits) {
+ return AslrAddress(0x20000000ULL);
+ }
+ #elif defined(ARCH_CPU_ARM64)
+- #if BUILDFLAG(IS_LINUX)
++ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ // Linux on arm64 can use 39, 42, 48, or 52-bit user space, depending on
+ // page size and number of levels of translation pages used. We use
diff --git a/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator.h b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator.h
new file mode 100644
index 000000000000..1147ec64b3d2
--- /dev/null
+++ b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator.h
@@ -0,0 +1,11 @@
+--- base/allocator/partition_allocator/src/partition_alloc/page_allocator.h.orig 2024-04-15 20:33:42 UTC
++++ base/allocator/partition_allocator/src/partition_alloc/page_allocator.h
+@@ -259,7 +259,7 @@ constexpr PA_COMPONENT_EXPORT(
+ // recommitted. Do not assume that this will not change over time.
+ constexpr PA_COMPONENT_EXPORT(
+ PARTITION_ALLOC) bool DecommittedMemoryIsAlwaysZeroed() {
+-#if BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ return false;
+ #else
+ return true;
diff --git a/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__constants.h b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__constants.h
new file mode 100644
index 000000000000..c71ace41d01d
--- /dev/null
+++ b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__constants.h
@@ -0,0 +1,11 @@
+--- base/allocator/partition_allocator/src/partition_alloc/page_allocator_constants.h.orig 2024-04-15 20:33:42 UTC
++++ base/allocator/partition_allocator/src/partition_alloc/page_allocator_constants.h
+@@ -26,7 +26,7 @@
+ #define PAGE_ALLOCATOR_CONSTANTS_DECLARE_CONSTEXPR __attribute__((const))
+
+ #elif (BUILDFLAG(IS_ANDROID) && defined(ARCH_CPU_64_BITS)) || \
+- (BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64))
++ ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64))
+ // This should work for all POSIX (if needed), but currently all other
+ // supported OS/architecture combinations use either hard-coded values
+ // (such as x86) or have means to determine these values without needing
diff --git a/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.h b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.h
new file mode 100644
index 000000000000..9f12a5acc856
--- /dev/null
+++ b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.h
@@ -0,0 +1,16 @@
+--- base/allocator/partition_allocator/src/partition_alloc/page_allocator_internals_posix.h.orig 2024-02-21 00:20:30 UTC
++++ base/allocator/partition_allocator/src/partition_alloc/page_allocator_internals_posix.h
+@@ -411,8 +411,12 @@ void DiscardSystemPagesInternal(uintptr_t address, siz
+
+ void DiscardSystemPagesInternal(uintptr_t address, size_t length) {
+ void* ptr = reinterpret_cast<void*>(address);
+-#if BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
++#if BUILDFLAG(IS_BSD)
++ int ret = madvise(ptr, length, MADV_FREE);
++#else
+ int ret = madvise(ptr, length, MADV_FREE_REUSABLE);
++#endif
+ if (ret) {
+ // MADV_FREE_REUSABLE sometimes fails, so fall back to MADV_DONTNEED.
+ ret = madvise(ptr, length, MADV_DONTNEED);
diff --git a/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_stack__trace__posix.cc b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_stack__trace__posix.cc
new file mode 100644
index 000000000000..1ee5c9aea368
--- /dev/null
+++ b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_stack__trace__posix.cc
@@ -0,0 +1,34 @@
+--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/debug/stack_trace_posix.cc.orig 2024-02-21 00:20:30 UTC
++++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/debug/stack_trace_posix.cc
+@@ -13,11 +13,11 @@
+ #include "partition_alloc/partition_alloc_base/posix/eintr_wrapper.h"
+ #include "partition_alloc/partition_alloc_base/strings/safe_sprintf.h"
+
+-#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_APPLE)
++#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD)
+ #include <link.h> // For ElfW() macro.
+ #endif
+
+-#if BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ #include <dlfcn.h>
+ #endif
+
+@@ -25,7 +25,7 @@ namespace {
+
+ namespace {
+
+-#if !BUILDFLAG(IS_APPLE)
++#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD)
+
+ // On Android the 'open' function has two versions:
+ // int open(const char *pathname, int flags);
+@@ -369,7 +369,7 @@ void PrintStackTraceInternal(const void** trace, size_
+ }
+ #endif // !BUILDFLAG(IS_APPLE)
+
+-#if BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ // Since /proc/self/maps is not available, use dladdr() to obtain module
+ // names and offsets inside the modules from the given addresses.
+ void PrintStackTraceInternal(const void* const* trace, size_t size) {
diff --git a/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_rand__util__posix.cc b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_rand__util__posix.cc
new file mode 100644
index 000000000000..067756bb2822
--- /dev/null
+++ b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_rand__util__posix.cc
@@ -0,0 +1,13 @@
+--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/rand_util_posix.cc.orig 2024-02-21 00:20:30 UTC
++++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/rand_util_posix.cc
+@@ -102,6 +102,10 @@ void RandBytes(void* output, size_t output_length) {
+ if (getentropy(output, output_length) == 0) {
+ return;
+ }
++#elif BUILDFLAG(IS_BSD)
++ if (getentropy(output, output_length) == 0) {
++ return;
++ }
+ #endif
+ // If getrandom(2) above returned with an error and the /dev/urandom fallback
+ // took place on Linux/ChromeOS bots, they would fail with a CHECK in
diff --git a/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread.h b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread.h
new file mode 100644
index 000000000000..161bdc68e794
--- /dev/null
+++ b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread.h
@@ -0,0 +1,11 @@
+--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread.h.orig 2024-02-21 00:20:30 UTC
++++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread.h
+@@ -37,6 +37,8 @@ typedef mach_port_t PlatformThreadId;
+ typedef zx_handle_t PlatformThreadId;
+ #elif BUILDFLAG(IS_APPLE)
+ typedef mach_port_t PlatformThreadId;
++#elif BUILDFLAG(IS_BSD)
++typedef uint64_t PlatformThreadId;
+ #elif BUILDFLAG(IS_POSIX)
+ typedef pid_t PlatformThreadId;
+ #endif
diff --git a/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__internal__posix.h b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__internal__posix.h
new file mode 100644
index 000000000000..35a8106e9704
--- /dev/null
+++ b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__internal__posix.h
@@ -0,0 +1,11 @@
+--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread_internal_posix.h.orig 2023-11-29 21:39:39 UTC
++++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread_internal_posix.h
+@@ -10,7 +10,7 @@ namespace partition_alloc::internal::base::internal {
+
+ namespace partition_alloc::internal::base::internal {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Current thread id is cached in thread local storage for performance reasons.
+ // In some rare cases it's important to invalidate that cache explicitly (e.g.
+ // after going through clone() syscall which does not call pthread_atfork()
diff --git a/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__posix.cc b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__posix.cc
new file mode 100644
index 000000000000..87717522b862
--- /dev/null
+++ b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__posix.cc
@@ -0,0 +1,11 @@
+--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread_posix.cc.orig 2024-02-21 00:20:30 UTC
++++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread_posix.cc
+@@ -18,7 +18,7 @@
+ #include "partition_alloc/partition_alloc_base/logging.h"
+ #include "partition_alloc/partition_alloc_base/threading/platform_thread_internal_posix.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <sys/syscall.h>
+ #include <atomic>
+ #endif
diff --git a/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__config.h b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__config.h
new file mode 100644
index 000000000000..7d0a25865400
--- /dev/null
+++ b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__config.h
@@ -0,0 +1,20 @@
+--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_config.h.orig 2024-06-18 21:43:17 UTC
++++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_config.h
+@@ -232,7 +232,7 @@ constexpr bool kUseLazyCommit = false;
+ // On these platforms, lock all the partitions before fork(), and unlock after.
+ // This may be required on more platforms in the future.
+ #define PA_CONFIG_HAS_ATFORK_HANDLER() \
+- (BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
++ (BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
+
+ // PartitionAlloc uses PartitionRootEnumerator to acquire all
+ // PartitionRoots at BeforeFork and to release at AfterFork.
+@@ -279,7 +279,7 @@ constexpr bool kUseLazyCommit = false;
+ //
+ // Also enabled on ARM64 macOS and iOS, as the 16kiB pages on this platform lead
+ // to larger slot spans.
+-#if BUILDFLAG(IS_LINUX) || (BUILDFLAG(IS_APPLE) && defined(ARCH_CPU_ARM64))
++#if BUILDFLAG(IS_LINUX) || (BUILDFLAG(IS_APPLE) && defined(ARCH_CPU_ARM64)) || BUILDFLAG(IS_BSD)
+ #define PA_CONFIG_PREFER_SMALLER_SLOT_SPANS() 1
+ #else
+ #define PA_CONFIG_PREFER_SMALLER_SLOT_SPANS() 0
diff --git a/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__constants.h b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__constants.h
new file mode 100644
index 000000000000..2a2c302a833c
--- /dev/null
+++ b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__constants.h
@@ -0,0 +1,11 @@
+--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_constants.h.orig 2024-06-18 21:43:17 UTC
++++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_constants.h
+@@ -316,7 +316,7 @@ constexpr size_t kNumPools = kMaxPoolHandle - 1;
+ // 8GB for each of the glued pools).
+ #if PA_BUILDFLAG(HAS_64_BIT_POINTERS)
+ #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) || \
+- PA_BUILDFLAG(ENABLE_POINTER_COMPRESSION)
++ PA_BUILDFLAG(ENABLE_POINTER_COMPRESSION) || BUILDFLAG(IS_BSD)
+ constexpr size_t kPoolMaxSize = 8 * kGiB;
+ #else
+ constexpr size_t kPoolMaxSize = 16 * kGiB;
diff --git a/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__forward.h b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__forward.h
new file mode 100644
index 000000000000..03cf424478d2
--- /dev/null
+++ b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__forward.h
@@ -0,0 +1,16 @@
+--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_forward.h.orig 2023-11-29 21:39:39 UTC
++++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_forward.h
+@@ -28,9 +28,13 @@ namespace internal {
+ // the second one 16. We could technically return something different for
+ // malloc() and operator new(), but this would complicate things, and most of
+ // our allocations are presumably coming from operator new() anyway.
++#if defined(__i386__) && defined(OS_FREEBSD)
++constexpr size_t kAlignment = 8;
++#else
+ constexpr size_t kAlignment =
+ std::max(alignof(max_align_t),
+ static_cast<size_t>(__STDCPP_DEFAULT_NEW_ALIGNMENT__));
++#endif
+ static_assert(kAlignment <= 16,
+ "PartitionAlloc doesn't support a fundamental alignment larger "
+ "than 16 bytes.");
diff --git a/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__root.cc b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__root.cc
new file mode 100644
index 000000000000..cbc9fece2760
--- /dev/null
+++ b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_partition__root.cc
@@ -0,0 +1,29 @@
+--- base/allocator/partition_allocator/src/partition_alloc/partition_root.cc.orig 2024-06-18 21:43:17 UTC
++++ base/allocator/partition_allocator/src/partition_alloc/partition_root.cc
+@@ -48,7 +48,7 @@
+ #include "wow64apiset.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <pthread.h>
+ #endif
+
+@@ -280,7 +280,7 @@ void PartitionAllocMallocInitOnce() {
+ return;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // When fork() is called, only the current thread continues to execute in the
+ // child process. If the lock is held, but *not* by this thread when fork() is
+ // called, we have a deadlock.
+@@ -957,7 +957,7 @@ void PartitionRoot::Init(PartitionOptions opts) {
+ // apple OSes.
+ PA_CHECK((internal::SystemPageSize() == (size_t{1} << 12)) ||
+ (internal::SystemPageSize() == (size_t{1} << 14)));
+-#elif BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64)
++#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64)
+ // Check runtime pagesize. Though the code is currently the same, it is
+ // not merged with the IS_APPLE case above as a 1 << 16 case needs to be
+ // added here in the future, to allow 64 kiB pagesize. That is only
diff --git a/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_spinning__mutex.cc b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_spinning__mutex.cc
new file mode 100644
index 000000000000..ce2b6988121c
--- /dev/null
+++ b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_spinning__mutex.cc
@@ -0,0 +1,53 @@
+--- base/allocator/partition_allocator/src/partition_alloc/spinning_mutex.cc.orig 2024-02-21 00:20:30 UTC
++++ base/allocator/partition_allocator/src/partition_alloc/spinning_mutex.cc
+@@ -17,7 +17,16 @@
+ #endif
+
+ #if PA_CONFIG(HAS_LINUX_KERNEL)
++#if defined(OS_OPENBSD)
++#include <sys/time.h>
++#include <sys/futex.h>
++#elif defined(OS_FREEBSD)
++#include <sys/types.h>
++#include <sys/thr.h>
++#include <sys/umtx.h>
++#else
+ #include <linux/futex.h>
++#endif
+ #include <sys/syscall.h>
+ #include <unistd.h>
+
+@@ -109,8 +118,16 @@ void SpinningMutex::FutexWait() {
+ // |kLockedContended| anymore. Note that even without spurious wakeups, the
+ // value of |state_| is not guaranteed when this returns, as another thread
+ // may get the lock before we get to run.
++#if defined(OS_FREEBSD)
++ int err = _umtx_op(&state_, UMTX_OP_WAIT_UINT_PRIVATE,
++ kLockedContended, nullptr, nullptr);
++#elif defined(OS_OPENBSD)
++ int err = futex(reinterpret_cast<volatile unsigned int *>(&state_), FUTEX_WAIT | FUTEX_PRIVATE_FLAG,
++ kLockedContended, nullptr, nullptr);
++#else
+ int err = syscall(SYS_futex, &state_, FUTEX_WAIT | FUTEX_PRIVATE_FLAG,
+ kLockedContended, nullptr, nullptr, 0);
++#endif
+
+ if (err) {
+ // These are programming error, check them.
+@@ -122,8 +139,16 @@ void SpinningMutex::FutexWake() {
+
+ void SpinningMutex::FutexWake() {
+ int saved_errno = errno;
++#if defined(OS_FREEBSD)
++ long retval = _umtx_op(&state_, UMTX_OP_WAKE_PRIVATE,
++ 1 /* wake up a single waiter */, nullptr, nullptr);
++#elif defined(OS_OPENBSD)
++ long retval = futex(reinterpret_cast<volatile unsigned int *>(&state_), FUTEX_WAKE | FUTEX_PRIVATE_FLAG,
++ 1 /* wake up a single waiter */, nullptr, nullptr);
++#else
+ long retval = syscall(SYS_futex, &state_, FUTEX_WAKE | FUTEX_PRIVATE_FLAG,
+ 1 /* wake up a single waiter */, nullptr, nullptr, 0);
++#endif
+ PA_CHECK(retval != -1);
+ errno = saved_errno;
+ }
diff --git a/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_stack_stack.cc b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_stack_stack.cc
new file mode 100644
index 000000000000..b4e4639938db
--- /dev/null
+++ b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_stack_stack.cc
@@ -0,0 +1,50 @@
+--- base/allocator/partition_allocator/src/partition_alloc/stack/stack.cc.orig 2024-06-18 21:43:17 UTC
++++ base/allocator/partition_allocator/src/partition_alloc/stack/stack.cc
+@@ -18,6 +18,10 @@
+ #include <pthread.h>
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include <pthread_np.h>
++#endif
++
+ #if defined(LIBC_GLIBC)
+ extern "C" void* __libc_stack_end;
+ #endif
+@@ -48,6 +52,36 @@ void* GetStackTop() {
+
+ void* GetStackTop() {
+ return pthread_get_stackaddr_np(pthread_self());
++}
++
++#elif defined(OS_OPENBSD)
++
++void* GetStackTop() {
++ stack_t ss;
++ if (pthread_stackseg_np(pthread_self(), &ss) != 0)
++ return nullptr;
++ return reinterpret_cast<uint8_t*>(ss.ss_sp);
++}
++
++#elif defined(OS_FREEBSD)
++
++void* GetStackTop() {
++ pthread_attr_t attr;
++ int error = pthread_attr_init(&attr);
++ if (error) {
++ return nullptr;
++ }
++ error = pthread_attr_get_np(pthread_self(), &attr);
++ if (!error) {
++ void* base;
++ size_t size;
++ error = pthread_attr_getstack(&attr, &base, &size);
++ PA_CHECK(!error);
++ pthread_attr_destroy(&attr);
++ return reinterpret_cast<uint8_t*>(base) + size;
++ }
++ pthread_attr_destroy(&attr);
++ return nullptr;
+ }
+
+ #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
diff --git a/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_thread__isolation_pkey.cc b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_thread__isolation_pkey.cc
new file mode 100644
index 000000000000..a0c2b745eac2
--- /dev/null
+++ b/devel/electron31/files/patch-base_allocator_partition__allocator_src_partition__alloc_thread__isolation_pkey.cc
@@ -0,0 +1,11 @@
+--- base/allocator/partition_allocator/src/partition_alloc/thread_isolation/pkey.cc.orig 2024-02-21 00:20:30 UTC
++++ base/allocator/partition_allocator/src/partition_alloc/thread_isolation/pkey.cc
+@@ -16,7 +16,7 @@
+ #include "partition_alloc/partition_alloc_check.h"
+ #include "partition_alloc/thread_isolation/thread_isolation.h"
+
+-#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+ #error "This pkey code is currently only supported on Linux and ChromeOS"
+ #endif
+
diff --git a/devel/electron31/files/patch-base_atomicops.h b/devel/electron31/files/patch-base_atomicops.h
new file mode 100644
index 000000000000..7c186aff0e5b
--- /dev/null
+++ b/devel/electron31/files/patch-base_atomicops.h
@@ -0,0 +1,14 @@
+--- base/atomicops.h.orig 2023-03-30 00:33:38 UTC
++++ base/atomicops.h
+@@ -71,7 +71,11 @@ typedef intptr_t Atomic64;
+
+ // Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or
+ // Atomic64 routines below, depending on your architecture.
++#if !defined(OS_OPENBSD) && defined(__i386__)
++typedef Atomic32 AtomicWord;
++#else
+ typedef intptr_t AtomicWord;
++#endif
+
+ // Atomically execute:
+ // result = *ptr;
diff --git a/devel/electron31/files/patch-base_base__paths__posix.cc b/devel/electron31/files/patch-base_base__paths__posix.cc
new file mode 100644
index 000000000000..609b1e0ebf9c
--- /dev/null
+++ b/devel/electron31/files/patch-base_base__paths__posix.cc
@@ -0,0 +1,108 @@
+--- base/base_paths_posix.cc.orig 2024-06-18 21:43:17 UTC
++++ base/base_paths_posix.cc
+@@ -15,6 +15,7 @@
+ #include <ostream>
+ #include <string>
+
++#include "base/command_line.h"
+ #include "base/environment.h"
+ #include "base/files/file_path.h"
+ #include "base/files/file_util.h"
+@@ -26,9 +27,13 @@
+ #include "base/process/process_metrics.h"
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_FREEBSD)
++#if BUILDFLAG(IS_BSD)
+ #include <sys/param.h>
+ #include <sys/sysctl.h>
++#if BUILDFLAG(IS_OPENBSD)
++#include <kvm.h>
++#define MAXTOKENS 2
++#endif
+ #elif BUILDFLAG(IS_SOLARIS) || BUILDFLAG(IS_AIX)
+ #include <stdlib.h>
+ #endif
+@@ -49,8 +54,7 @@ bool PathProviderPosix(int key, FilePath* result) {
+ *result = bin_dir;
+ return true;
+ #elif BUILDFLAG(IS_FREEBSD)
+- int name[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
+- std::optional<std::string> bin_dir = StringSysctl(name, std::size(name));
++ std::optional<std::string> bin_dir = StringSysctl({ CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 });
+ if (!bin_dir.has_value() || bin_dir.value().length() <= 1) {
+ NOTREACHED_IN_MIGRATION() << "Unable to resolve path.";
+ return false;
+@@ -67,13 +71,65 @@ bool PathProviderPosix(int key, FilePath* result) {
+ *result = FilePath(bin_dir);
+ return true;
+ #elif BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_AIX)
+- // There is currently no way to get the executable path on OpenBSD
+- char* cpath;
+- if ((cpath = getenv("CHROME_EXE_PATH")) != NULL)
+- *result = FilePath(cpath);
+- else
+- *result = FilePath("/usr/local/chrome/chrome");
+- return true;
++ char *cpath;
++#if !BUILDFLAG(IS_AIX)
++ struct kinfo_file *files;
++ kvm_t *kd = NULL;
++ char errbuf[_POSIX2_LINE_MAX];
++ static char retval[PATH_MAX];
++ int cnt;
++ struct stat sb;
++ pid_t cpid = getpid();
++ bool ret = false;
++
++ const base::CommandLine* command_line =
++ base::CommandLine::ForCurrentProcess();
++
++ VLOG(1) << "PathProviderPosix argv: " << command_line->argv()[0];
++
++ if (realpath(command_line->argv()[0].c_str(), retval) == NULL)
++ goto out;
++
++ if (stat(command_line->argv()[0].c_str(), &sb) < 0)
++ goto out;
++
++ if (!command_line->HasSwitch("no-sandbox")) {
++ ret = true;
++ *result = FilePath(retval);
++ VLOG(1) << "PathProviderPosix (sandbox) result: " << retval;
++ goto out;
++ }
++
++ if ((kd = kvm_openfiles(NULL, NULL, NULL, (int)KVM_NO_FILES, errbuf)) == NULL)
++ goto out;
++
++ if ((files = kvm_getfiles(kd, KERN_FILE_BYPID, cpid,
++ sizeof(struct kinfo_file), &cnt)) == NULL)
++ goto out;
++
++ for (int i = 0; i < cnt; i++) {
++ if (files[i].fd_fd == KERN_FILE_TEXT &&
++ files[i].va_fsid == static_cast<uint32_t>(sb.st_dev) &&
++ files[i].va_fileid == sb.st_ino) {
++ ret = true;
++ *result = FilePath(retval);
++ VLOG(1) << "PathProviderPosix result: " << retval;
++ }
++ }
++out:
++ if (kd)
++ kvm_close(kd);
++ if (!ret) {
++#endif
++ if ((cpath = getenv("CHROME_EXE_PATH")) != NULL)
++ *result = FilePath(cpath);
++ else
++ *result = FilePath("/usr/local/chrome/chrome");
++ return true;
++#if !BUILDFLAG(IS_AIX)
++ }
++ return ret;
++#endif
+ #endif
+ }
+ case DIR_SRC_TEST_DATA_ROOT: {
diff --git a/devel/electron31/files/patch-base_compiler__specific.h b/devel/electron31/files/patch-base_compiler__specific.h
new file mode 100644
index 000000000000..097e96957384
--- /dev/null
+++ b/devel/electron31/files/patch-base_compiler__specific.h
@@ -0,0 +1,11 @@
+--- base/compiler_specific.h.orig 2024-02-21 00:20:30 UTC
++++ base/compiler_specific.h
+@@ -316,7 +316,7 @@
+ //
+ // In some cases it's desirable to remove this, e.g. on hot functions, or if
+ // we have purposely changed the reference canary.
+-#if defined(COMPILER_GCC) || defined(__clang__)
++#if (defined(COMPILER_GCC) || defined(__clang__)) && !defined(__OpenBSD__) && !defined(__FreeBSD__)
+ #if HAS_ATTRIBUTE(__no_stack_protector__)
+ #define NO_STACK_PROTECTOR __attribute__((__no_stack_protector__))
+ #else
diff --git a/devel/electron31/files/patch-base_debug_debugger__posix.cc b/devel/electron31/files/patch-base_debug_debugger__posix.cc
new file mode 100644
index 000000000000..8e33d145b459
--- /dev/null
+++ b/devel/electron31/files/patch-base_debug_debugger__posix.cc
@@ -0,0 +1,69 @@
+--- base/debug/debugger_posix.cc.orig 2024-06-18 21:43:17 UTC
++++ base/debug/debugger_posix.cc
+@@ -41,6 +41,10 @@
+ #include <sys/sysctl.h>
+ #endif
+
++#if BUILDFLAG(IS_OPENBSD)
++#include <sys/proc.h>
++#endif
++
+ #if BUILDFLAG(IS_FREEBSD)
+ #include <sys/user.h>
+ #endif
+@@ -100,32 +104,51 @@ bool BeingDebugged() {
+
+ // Caution: struct kinfo_proc is marked __APPLE_API_UNSTABLE. The source and
+ // binary interfaces may change.
++#if BUILDFLAG(IS_OPENBSD)
++ struct kinfo_proc *info;
++ size_t info_size;
++#else
+ struct kinfo_proc info;
+ size_t info_size = sizeof(info);
++#endif
+
+ #if BUILDFLAG(IS_OPENBSD)
+ if (sysctl(mib, std::size(mib), NULL, &info_size, NULL, 0) < 0)
+ return -1;
+
+- mib[5] = (info_size / sizeof(struct kinfo_proc));
++ mib[5] = static_cast<int>((info_size / sizeof(struct kinfo_proc)));
++ if ((info = reinterpret_cast<kinfo_proc*>(malloc(info_size))) == NULL) {
++ is_set = true;
++ being_debugged = false;
++ return being_debugged;
++ }
++
++ int sysctl_result = sysctl(mib, std::size(mib), info, &info_size, NULL, 0);
+ #endif
+
++#if !BUILDFLAG(IS_OPENBSD)
+ int sysctl_result = sysctl(mib, std::size(mib), &info, &info_size, NULL, 0);
++#endif
+ DCHECK_EQ(sysctl_result, 0);
+ if (sysctl_result != 0) {
+ is_set = true;
+ being_debugged = false;
+- return being_debugged;
++ goto out;
+ }
+
+ // This process is being debugged if the P_TRACED flag is set.
+ is_set = true;
+ #if BUILDFLAG(IS_FREEBSD)
+ being_debugged = (info.ki_flag & P_TRACED) != 0;
+-#elif BUILDFLAG(IS_BSD)
+- being_debugged = (info.p_flag & P_TRACED) != 0;
++#elif BUILDFLAG(IS_OPENBSD)
++ being_debugged = (info->p_psflags & PS_TRACED) != 0;
+ #else
+ being_debugged = (info.kp_proc.p_flag & P_TRACED) != 0;
++#endif
++
++out:
++#if BUILDFLAG(IS_OPENBSD)
++ free(info);
+ #endif
+ return being_debugged;
+ }
diff --git a/devel/electron31/files/patch-base_debug_elf__reader.cc b/devel/electron31/files/patch-base_debug_elf__reader.cc
new file mode 100644
index 000000000000..c2f0797d9ef2
--- /dev/null
+++ b/devel/electron31/files/patch-base_debug_elf__reader.cc
@@ -0,0 +1,13 @@
+--- base/debug/elf_reader.cc.orig 2024-06-18 21:43:17 UTC
++++ base/debug/elf_reader.cc
+@@ -50,6 +50,10 @@ constexpr char kGnuNoteName[] = "GNU";
+
+ constexpr char kGnuNoteName[] = "GNU";
+
++#ifndef NT_GNU_BUILD_ID
++#define NT_GNU_BUILD_ID 3
++#endif
++
+ // Returns a pointer to the header of the ELF binary mapped into memory, or a
+ // null pointer if the header is invalid. Here and below |elf_mapped_base| is a
+ // pointer to the start of the ELF image.
diff --git a/devel/electron31/files/patch-base_debug_proc__maps__linux.cc b/devel/electron31/files/patch-base_debug_proc__maps__linux.cc
new file mode 100644
index 000000000000..07a7720761ce
--- /dev/null
+++ b/devel/electron31/files/patch-base_debug_proc__maps__linux.cc
@@ -0,0 +1,11 @@
+--- base/debug/proc_maps_linux.cc.orig 2024-06-18 21:43:17 UTC
++++ base/debug/proc_maps_linux.cc
+@@ -18,7 +18,7 @@
+ #include "base/strings/string_split.h"
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include <inttypes.h>
+ #endif
+
diff --git a/devel/electron31/files/patch-base_debug_stack__trace.cc b/devel/electron31/files/patch-base_debug_stack__trace.cc
new file mode 100644
index 000000000000..c1f5f05350a2
--- /dev/null
+++ b/devel/electron31/files/patch-base_debug_stack__trace.cc
@@ -0,0 +1,29 @@
+--- base/debug/stack_trace.cc.orig 2024-06-18 21:43:17 UTC
++++ base/debug/stack_trace.cc
+@@ -254,7 +254,7 @@ bool StackTrace::WillSymbolizeToStreamForTesting() {
+ // Symbols are not expected to be reliable when gn args specifies
+ // symbol_level=0.
+ return false;
+-#elif defined(__UCLIBC__) || defined(_AIX)
++#elif defined(__UCLIBC__) || defined(_AIX) || BUILDFLAG(IS_BSD)
+ // StackTrace::OutputToStream() is not implemented under uclibc, nor AIX.
+ // See https://crbug.com/706728
+ return false;
+@@ -316,7 +316,7 @@ std::string StackTrace::ToStringWithPrefix(cstring_vie
+
+ std::string StackTrace::ToStringWithPrefix(cstring_view prefix_string) const {
+ std::stringstream stream;
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if !defined(__UCLIBC__) && !defined(_AIX) && !BUILDFLAG(IS_BSD)
+ OutputToStreamWithPrefix(&stream, prefix_string);
+ #endif
+ return stream.str();
+@@ -340,7 +340,7 @@ std::ostream& operator<<(std::ostream& os, const Stack
+ }
+
+ std::ostream& operator<<(std::ostream& os, const StackTrace& s) {
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if !defined(__UCLIBC__) && !defined(_AIX) && !BUILDFLAG(IS_BSD)
+ s.OutputToStream(&os);
+ #else
+ os << "StackTrace::OutputToStream not implemented.";
diff --git a/devel/electron31/files/patch-base_debug_stack__trace__posix.cc b/devel/electron31/files/patch-base_debug_stack__trace__posix.cc
new file mode 100644
index 000000000000..fc1cc65380a1
--- /dev/null
+++ b/devel/electron31/files/patch-base_debug_stack__trace__posix.cc
@@ -0,0 +1,101 @@
+--- base/debug/stack_trace_posix.cc.orig 2024-06-18 21:43:17 UTC
++++ base/debug/stack_trace_posix.cc
+@@ -46,7 +46,7 @@
+ // execinfo.h and backtrace(3) are really only present in glibc and in macOS
+ // libc.
+ #if BUILDFLAG(IS_APPLE) || \
+- (defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(__AIX))
++ (defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(__AIX) && !BUILDFLAG(IS_BSD))
+ #define HAVE_BACKTRACE
+ #include <execinfo.h>
+ #endif
+@@ -64,8 +64,10 @@
+ #include <AvailabilityMacros.h>
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
++#if !BUILDFLAG(IS_BSD)
+ #include <sys/prctl.h>
++#endif
+
+ #include "base/debug/proc_maps_linux.h"
+ #endif
+@@ -306,7 +308,7 @@ void PrintToStderr(const char* output) {
+ std::ignore = HANDLE_EINTR(write(STDERR_FILENO, output, strlen(output)));
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void AlarmSignalHandler(int signal, siginfo_t* info, void* void_context) {
+ // We have seen rare cases on AMD linux where the default signal handler
+ // either does not run or a thread (Probably an AMD driver thread) prevents
+@@ -323,7 +325,11 @@ void AlarmSignalHandler(int signal, siginfo_t* info, v
+ "Warning: Default signal handler failed to terminate process.\n");
+ PrintToStderr("Calling exit_group() directly to prevent timeout.\n");
+ // See: https://man7.org/linux/man-pages/man2/exit_group.2.html
++#if BUILDFLAG(IS_BSD)
++ _exit(EXIT_FAILURE);
++#else
+ syscall(SYS_exit_group, EXIT_FAILURE);
++#endif
+ }
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) ||
+ // BUILDFLAG(IS_CHROMEOS)
+@@ -540,7 +546,7 @@ void StackDumpSignalHandler(int signal, siginfo_t* inf
+ _exit(EXIT_FAILURE);
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Set an alarm to trigger in case the default handler does not terminate
+ // the process. See 'AlarmSignalHandler' for more details.
+ struct sigaction action;
+@@ -565,6 +571,7 @@ void StackDumpSignalHandler(int signal, siginfo_t* inf
+ // signals that do not re-raise autonomously), such as signals delivered via
+ // kill() and asynchronous hardware faults such as SEGV_MTEAERR, which would
+ // otherwise be lost when re-raising the signal via raise().
++#if !BUILDFLAG(IS_BSD)
+ long retval = syscall(SYS_rt_tgsigqueueinfo, getpid(), syscall(SYS_gettid),
+ info->si_signo, info);
+ if (retval == 0) {
+@@ -579,6 +586,7 @@ void StackDumpSignalHandler(int signal, siginfo_t* inf
+ if (errno != EPERM) {
+ _exit(EXIT_FAILURE);
+ }
++#endif
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) ||
+ // BUILDFLAG(IS_CHROMEOS)
+
+@@ -768,6 +776,7 @@ class SandboxSymbolizeHelper {
+ return -1;
+ }
+
++#if !BUILDFLAG(IS_BSD)
+ // This class is copied from
+ // third_party/crashpad/crashpad/util/linux/scoped_pr_set_dumpable.h.
+ // It aims at ensuring the process is dumpable before opening /proc/self/mem.
+@@ -860,11 +869,15 @@ class SandboxSymbolizeHelper {
+ r.base = cur_base;
+ }
+ }
++#endif
+
+ // Parses /proc/self/maps in order to compile a list of all object file names
+ // for the modules that are loaded in the current process.
+ // Returns true on success.
+ bool CacheMemoryRegions() {
++#if BUILDFLAG(IS_BSD)
++ return false;
++#else
+ // Reads /proc/self/maps.
+ std::string contents;
+ if (!ReadProcMaps(&contents)) {
+@@ -882,6 +895,7 @@ class SandboxSymbolizeHelper {
+
+ is_initialized_ = true;
+ return true;
++#endif
+ }
+
+ // Opens all object files and caches their file descriptors.
diff --git a/devel/electron31/files/patch-base_features.cc b/devel/electron31/files/patch-base_features.cc
new file mode 100644
index 000000000000..e1133a7e008e
--- /dev/null
+++ b/devel/electron31/files/patch-base_features.cc
@@ -0,0 +1,20 @@
+--- base/features.cc.orig 2024-06-18 21:43:17 UTC
++++ base/features.cc
+@@ -9,7 +9,7 @@
+ #include "base/threading/platform_thread.h"
+ #include "build/buildflag.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "base/message_loop/message_pump_libevent.h"
+ #endif
+
+@@ -98,7 +98,7 @@ void Init(EmitThreadControllerProfilerMetadata
+ sequence_manager::internal::ThreadController::InitializeFeatures(
+ emit_thread_controller_profiler_metadata);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ MessagePumpLibevent::InitializeFeatures();
+ #endif
+
diff --git a/devel/electron31/files/patch-base_files_dir__reader__linux.h b/devel/electron31/files/patch-base_files_dir__reader__linux.h
new file mode 100644
index 000000000000..1cb59f9d7461
--- /dev/null
+++ b/devel/electron31/files/patch-base_files_dir__reader__linux.h
@@ -0,0 +1,39 @@
+--- base/files/dir_reader_linux.h.orig 2024-06-18 21:43:17 UTC
++++ base/files/dir_reader_linux.h
+@@ -21,10 +21,16 @@
+ #include "base/logging.h"
+ #include "base/posix/eintr_wrapper.h"
+
++#include "build/build_config.h"
++
+ // See the comments in dir_reader_posix.h about this.
+
+ namespace base {
+
++#if BUILDFLAG(IS_BSD)
++#include <dirent.h>
++typedef struct dirent linux_dirent;
++#else
+ struct linux_dirent {
+ uint64_t d_ino;
+ int64_t d_off;
+@@ -32,6 +38,7 @@ struct linux_dirent {
+ unsigned char d_type;
+ char d_name[0];
+ };
++#endif
+
+ class DirReaderLinux {
+ public:
+@@ -66,7 +73,11 @@ class DirReaderLinux {
+ if (offset_ != size_)
+ return true;
+
++#if BUILDFLAG(IS_BSD)
++ const int r = getdents(fd_, reinterpret_cast<char *>(buf_), sizeof(buf_));
++#else
+ const long r = syscall(__NR_getdents64, fd_, buf_, sizeof(buf_));
++#endif
+ if (r == 0)
+ return false;
+ if (r < 0) {
diff --git a/devel/electron31/files/patch-base_files_dir__reader__posix.h b/devel/electron31/files/patch-base_files_dir__reader__posix.h
new file mode 100644
index 000000000000..2285fb726f8e
--- /dev/null
+++ b/devel/electron31/files/patch-base_files_dir__reader__posix.h
@@ -0,0 +1,20 @@
+--- base/files/dir_reader_posix.h.orig 2022-06-17 14:20:10 UTC
++++ base/files/dir_reader_posix.h
+@@ -17,7 +17,7 @@
+ // seems worse than falling back to enumerating all file descriptors so we will
+ // probably never implement this on the Mac.
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "base/files/dir_reader_linux.h"
+ #else
+ #include "base/files/dir_reader_fallback.h"
+@@ -25,7 +25,7 @@
+
+ namespace base {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ typedef DirReaderLinux DirReaderPosix;
+ #else
+ typedef DirReaderFallback DirReaderPosix;
diff --git a/devel/electron31/files/patch-base_files_file__path__watcher.h b/devel/electron31/files/patch-base_files_file__path__watcher.h
new file mode 100644
index 000000000000..463c96aaf79a
--- /dev/null
+++ b/devel/electron31/files/patch-base_files_file__path__watcher.h
@@ -0,0 +1,11 @@
+--- base/files/file_path_watcher.h.orig 2024-02-21 00:20:30 UTC
++++ base/files/file_path_watcher.h
+@@ -105,7 +105,7 @@ class BASE_EXPORT FilePathWatcher {
+ Type type = Type::kNonRecursive;
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // The callback will return the full path to a changed file instead of
+ // the watched path supplied as |path| when Watch is called.
+ // So the full path can be different from the watched path when a folder is
diff --git a/devel/electron31/files/patch-base_files_file__path__watcher__bsd.cc b/devel/electron31/files/patch-base_files_file__path__watcher__bsd.cc
new file mode 100644
index 000000000000..5bac3095f9f0
--- /dev/null
+++ b/devel/electron31/files/patch-base_files_file__path__watcher__bsd.cc
@@ -0,0 +1,57 @@
+--- base/files/file_path_watcher_bsd.cc.orig 2022-10-24 13:33:33 UTC
++++ base/files/file_path_watcher_bsd.cc
+@@ -0,0 +1,54 @@
++// Copyright 2021 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include <memory>
++
++#include "base/files/file_path_watcher.h"
++#include "base/files/file_path_watcher_kqueue.h"
++#include "base/memory/ptr_util.h"
++#include "build/build_config.h"
++
++namespace base {
++
++namespace {
++
++class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate {
++ public:
++ FilePathWatcherImpl() = default;
++ FilePathWatcherImpl(const FilePathWatcherImpl&) = delete;
++ FilePathWatcherImpl& operator=(const FilePathWatcherImpl&) = delete;
++ ~FilePathWatcherImpl() override = default;
++
++ bool Watch(const FilePath& path,
++ Type type,
++ const FilePathWatcher::Callback& callback) override {
++ DCHECK(!impl_.get());
++ if (type == Type::kRecursive) {
++ if (!FilePathWatcher::RecursiveWatchAvailable())
++ return false;
++ } else {
++ impl_ = std::make_unique<FilePathWatcherKQueue>();
++ }
++ DCHECK(impl_.get());
++ return impl_->Watch(path, type, callback);
++ }
++
++ void Cancel() override {
++ if (impl_.get())
++ impl_->Cancel();
++ set_cancelled();
++ }
++
++ private:
++ std::unique_ptr<PlatformDelegate> impl_;
++};
++
++} // namespace
++
++FilePathWatcher::FilePathWatcher() {
++ DETACH_FROM_SEQUENCE(sequence_checker_);
++ impl_ = std::make_unique<FilePathWatcherImpl>();
++}
++
++} // namespace base
diff --git a/devel/electron31/files/patch-base_files_file__path__watcher__kqueue.h b/devel/electron31/files/patch-base_files_file__path__watcher__kqueue.h
new file mode 100644
index 000000000000..821858b75711
--- /dev/null
+++ b/devel/electron31/files/patch-base_files_file__path__watcher__kqueue.h
@@ -0,0 +1,10 @@
+--- base/files/file_path_watcher_kqueue.h.orig 2022-02-07 13:39:41 UTC
++++ base/files/file_path_watcher_kqueue.h
+@@ -5,6 +5,7 @@
+ #ifndef BASE_FILES_FILE_PATH_WATCHER_KQUEUE_H_
+ #define BASE_FILES_FILE_PATH_WATCHER_KQUEUE_H_
+
++#include <sys/time.h>
+ #include <sys/event.h>
+
+ #include <memory>
diff --git a/devel/electron31/files/patch-base_files_file__path__watcher__unittest.cc b/devel/electron31/files/patch-base_files_file__path__watcher__unittest.cc
new file mode 100644
index 000000000000..5c6e20e67ca0
--- /dev/null
+++ b/devel/electron31/files/patch-base_files_file__path__watcher__unittest.cc
@@ -0,0 +1,29 @@
+--- base/files/file_path_watcher_unittest.cc.orig 2024-06-18 21:43:17 UTC
++++ base/files/file_path_watcher_unittest.cc
+@@ -847,7 +847,7 @@ TEST_F(FilePathWatcherTest, WatchDirectory) {
+ }
+ delegate.RunUntilEventsMatch(event_expecter);
+
+-#if !BUILDFLAG(IS_APPLE)
++#if !BUILDFLAG(IS_APPLE) && BUILDFLAG(IS_BSD)
+ ASSERT_TRUE(WriteFile(file1, "content v2"));
+ // Mac implementation does not detect files modified in a directory.
+ // TODO(crbug.com/40263777): Expect that no events are fired on Mac.
+@@ -1783,7 +1783,7 @@ enum Permission { Read, Write, Execute };
+
+ enum Permission { Read, Write, Execute };
+
+-#if BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ bool ChangeFilePermissions(const FilePath& path, Permission perm, bool allow) {
+ struct stat stat_buf;
+
+@@ -1817,7 +1817,7 @@ bool ChangeFilePermissions(const FilePath& path, Permi
+
+ } // namespace
+
+-#if BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_APPLE) && BUILDFLAG(IS_BSD)
+ // Linux implementation of FilePathWatcher doesn't catch attribute changes.
+ // http://crbug.com/78043
+ // Windows implementation of FilePathWatcher catches attribute changes that
diff --git a/devel/electron31/files/patch-base_files_file__util__posix.cc b/devel/electron31/files/patch-base_files_file__util__posix.cc
new file mode 100644
index 000000000000..106fb7b35e7c
--- /dev/null
+++ b/devel/electron31/files/patch-base_files_file__util__posix.cc
@@ -0,0 +1,53 @@
+--- base/files/file_util_posix.cc.orig 2024-06-18 21:43:17 UTC
++++ base/files/file_util_posix.cc
+@@ -819,33 +819,34 @@ bool CreateDirectoryAndGetError(const FilePath& full_p
+ File::Error* error) {
+ ScopedBlockingCall scoped_blocking_call(
+ FROM_HERE, BlockingType::MAY_BLOCK); // For call to mkdir().
++ const FilePath kFileSystemRoot("/");
+ std::vector<FilePath> subpaths;
+
+ // Collect a list of all parent directories.
+ FilePath last_path = full_path;
+- subpaths.push_back(full_path);
++ if (full_path != kFileSystemRoot)
++ subpaths.push_back(full_path);
+ for (FilePath path = full_path.DirName();
+- path.value() != last_path.value(); path = path.DirName()) {
++ (path.value() != last_path.value() &&
++ (path != kFileSystemRoot)); path = path.DirName()) {
+ subpaths.push_back(path);
+ last_path = path;
+ }
+
+ // Iterate through the parents and create the missing ones.
+ for (const FilePath& subpath : base::Reversed(subpaths)) {
+- if (DirectoryExists(subpath))
+- continue;
+- if (mkdir(subpath.value().c_str(), 0700) == 0)
+- continue;
+- // Mkdir failed, but it might have failed with EEXIST, or some other error
+- // due to the directory appearing out of thin air. This can occur if
+- // two processes are trying to create the same file system tree at the same
+- // time. Check to see if it exists and make sure it is a directory.
+- int saved_errno = errno;
+- if (!DirectoryExists(subpath)) {
+- if (error)
+- *error = File::OSErrorToFileError(saved_errno);
+- errno = saved_errno;
+- return false;
++ if (!PathExists(subpath)) {
++ if ((mkdir(subpath.value().c_str(), 0700) == -1) &&
++ ((full_path != subpath) ? (errno != ENOENT) : (-1))) {
++ int saved_errno = errno;
++ if (error)
++ *error = File::OSErrorToFileError(saved_errno);
++ return false;
++ }
++ } else if (!DirectoryExists(subpath)) {
++ if (error)
++ *error = File::OSErrorToFileError(ENOTDIR);
++ return false;
+ }
+ }
+ return true;
diff --git a/devel/electron31/files/patch-base_files_file__util__unittest.cc b/devel/electron31/files/patch-base_files_file__util__unittest.cc
new file mode 100644
index 000000000000..6c2056ebeb30
--- /dev/null
+++ b/devel/electron31/files/patch-base_files_file__util__unittest.cc
@@ -0,0 +1,20 @@
+--- base/files/file_util_unittest.cc.orig 2024-06-18 21:43:17 UTC
++++ base/files/file_util_unittest.cc
+@@ -3835,7 +3835,7 @@ TEST_F(FileUtilTest, ReadFileToStringWithNamedPipe) {
+ }
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD)
+ TEST_F(FileUtilTest, ReadFileToStringWithProcFileSystem) {
+ FilePath file_path("/proc/cpuinfo");
+ std::string data = "temp";
+@@ -4568,7 +4568,7 @@ TEST(FileUtilMultiThreadedTest, MultiThreadedTempFiles
+ NULL);
+ #else
+ size_t bytes_written =
+- ::write(::fileno(output_file.get()), content.c_str(), content.length());
++ ::write(fileno(output_file.get()), content.c_str(), content.length());
+ #endif
+ EXPECT_EQ(content.length(), bytes_written);
+ ::fflush(output_file.get());
diff --git a/devel/electron31/files/patch-base_files_important__file__writer__cleaner.cc b/devel/electron31/files/patch-base_files_important__file__writer__cleaner.cc
new file mode 100644
index 000000000000..80f08d51a819
--- /dev/null
+++ b/devel/electron31/files/patch-base_files_important__file__writer__cleaner.cc
@@ -0,0 +1,12 @@
+--- base/files/important_file_writer_cleaner.cc.orig 2022-02-28 16:54:41 UTC
++++ base/files/important_file_writer_cleaner.cc
+@@ -25,7 +25,8 @@ namespace base {
+ namespace {
+
+ base::Time GetUpperBoundTime() {
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_FUCHSIA)
++// needed because of .CreationTime() pledge
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // If process creation time is not available then use instance creation
+ // time as the upper-bound for old files. Modification times may be
+ // rounded-down to coarse-grained increments, e.g. FAT has 2s granularity,
diff --git a/devel/electron31/files/patch-base_files_scoped__file.cc b/devel/electron31/files/patch-base_files_scoped__file.cc
new file mode 100644
index 000000000000..350c73cc76e7
--- /dev/null
+++ b/devel/electron31/files/patch-base_files_scoped__file.cc
@@ -0,0 +1,11 @@
+--- base/files/scoped_file.cc.orig 2022-02-28 16:54:41 UTC
++++ base/files/scoped_file.cc
+@@ -31,7 +31,7 @@ void ScopedFDCloseTraits::Free(int fd) {
+ int ret = IGNORE_EINTR(close(fd));
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_APPLE) || \
+- BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // NB: Some file descriptors can return errors from close() e.g. network
+ // filesystems such as NFS and Linux input devices. On Linux, macOS, and
+ // Fuchsia's POSIX layer, errors from close other than EBADF do not indicate
diff --git a/devel/electron31/files/patch-base_functional_unretained__traits.h b/devel/electron31/files/patch-base_functional_unretained__traits.h
new file mode 100644
index 000000000000..40e618bb5141
--- /dev/null
+++ b/devel/electron31/files/patch-base_functional_unretained__traits.h
@@ -0,0 +1,11 @@
+--- base/functional/unretained_traits.h.orig 2024-04-15 20:33:42 UTC
++++ base/functional/unretained_traits.h
+@@ -93,7 +93,7 @@ struct SupportsUnretainedImpl {
+ // official builds, and then in non-test code as well.
+ #if defined(FORCE_UNRETAINED_COMPLETENESS_CHECKS_FOR_TESTS) || \
+ (!defined(UNIT_TEST) && !defined(OFFICIAL_BUILD) && \
+- (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)))
++ (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)))
+ static_assert(v,
+ "Argument requires unretained storage, but type is not "
+ "fully defined. This prevents determining whether "
diff --git a/devel/electron31/files/patch-base_i18n_icu__util.cc b/devel/electron31/files/patch-base_i18n_icu__util.cc
new file mode 100644
index 000000000000..5c7f6141a4d2
--- /dev/null
+++ b/devel/electron31/files/patch-base_i18n_icu__util.cc
@@ -0,0 +1,20 @@
+--- base/i18n/icu_util.cc.orig 2024-04-15 20:33:42 UTC
++++ base/i18n/icu_util.cc
+@@ -52,7 +52,7 @@
+ #include "third_party/icu/source/common/unicode/unistr.h"
+ #endif
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || \
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) || \
+ BUILDFLAG(IS_CHROMEOS) || (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS))
+ #include "third_party/icu/source/i18n/unicode/timezone.h"
+ #endif
+@@ -328,7 +328,7 @@ void InitializeIcuTimeZone() {
+ FuchsiaIntlProfileWatcher::GetPrimaryTimeZoneIdForIcuInitialization();
+ icu::TimeZone::adoptDefault(
+ icu::TimeZone::createTimeZone(icu::UnicodeString::fromUTF8(zone_id)));
+-#elif BUILDFLAG(IS_CHROMEOS) || (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS))
++#elif BUILDFLAG(IS_CHROMEOS) || (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS)) || BUILDFLAG(IS_BSD)
+ // To respond to the time zone change properly, the default time zone
+ // cache in ICU has to be populated on starting up.
+ // See TimeZoneMonitorLinux::NotifyClientsFromImpl().
diff --git a/devel/electron31/files/patch-base_linux__util.cc b/devel/electron31/files/patch-base_linux__util.cc
new file mode 100644
index 000000000000..80093eea9666
--- /dev/null
+++ b/devel/electron31/files/patch-base_linux__util.cc
@@ -0,0 +1,17 @@
+--- base/linux_util.cc.orig 2024-06-18 21:43:17 UTC
++++ base/linux_util.cc
+@@ -154,10 +154,14 @@ bool GetThreadsForProcess(pid_t pid, std::vector<pid_t
+ }
+
+ bool GetThreadsForProcess(pid_t pid, std::vector<pid_t>* tids) {
++#if BUILDFLAG(IS_BSD)
++ return false;
++#else
+ // 25 > strlen("/proc//task") + strlen(std::to_string(INT_MAX)) + 1 = 22
+ char buf[25];
+ strings::SafeSPrintf(buf, "/proc/%d/task", pid);
+ return GetThreadsFromProcessDir(buf, tids);
++#endif
+ }
+
+ bool GetThreadsForCurrentProcess(std::vector<pid_t>* tids) {
diff --git a/devel/electron31/files/patch-base_logging__unittest.cc b/devel/electron31/files/patch-base_logging__unittest.cc
new file mode 100644
index 000000000000..92c9dc61107c
--- /dev/null
+++ b/devel/electron31/files/patch-base_logging__unittest.cc
@@ -0,0 +1,31 @@
+--- base/logging_unittest.cc.orig 2024-06-18 21:43:17 UTC
++++ base/logging_unittest.cc
+@@ -41,7 +41,7 @@
+ #include "base/posix/eintr_wrapper.h"
+ #endif // BUILDFLAG(IS_POSIX)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FREEBSD)
+ #include <ucontext.h>
+ #endif
+
+@@ -579,14 +579,18 @@ void CheckCrashTestSighandler(int, siginfo_t* info, vo
+ // need the arch-specific boilerplate below, which is inspired by breakpad.
+ // At the same time, on OSX, ucontext.h is deprecated but si_addr works fine.
+ uintptr_t crash_addr = 0;
+-#if BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_FREEBSD)
+ crash_addr = reinterpret_cast<uintptr_t>(info->si_addr);
+ #else // OS_*
+ ucontext_t* context = reinterpret_cast<ucontext_t*>(context_ptr);
+ #if defined(ARCH_CPU_X86)
+ crash_addr = static_cast<uintptr_t>(context->uc_mcontext.gregs[REG_EIP]);
+ #elif defined(ARCH_CPU_X86_64)
++#if BUILDFLAG(IS_OPENBSD)
++ crash_addr = static_cast<uintptr_t>(context->sc_rip);
++#else
+ crash_addr = static_cast<uintptr_t>(context->uc_mcontext.gregs[REG_RIP]);
++#endif
+ #elif defined(ARCH_CPU_ARMEL)
+ crash_addr = static_cast<uintptr_t>(context->uc_mcontext.arm_pc);
+ #elif defined(ARCH_CPU_ARM64)
diff --git a/devel/electron31/files/patch-base_memory_discardable__memory.cc b/devel/electron31/files/patch-base_memory_discardable__memory.cc
new file mode 100644
index 000000000000..bd043476fc97
--- /dev/null
+++ b/devel/electron31/files/patch-base_memory_discardable__memory.cc
@@ -0,0 +1,38 @@
+--- base/memory/discardable_memory.cc.orig 2022-11-30 08:12:58 UTC
++++ base/memory/discardable_memory.cc
+@@ -26,7 +26,7 @@ BASE_FEATURE(kMadvFreeDiscardableMemory,
+ base::FEATURE_DISABLED_BY_DEFAULT);
+ #endif // BUILDFLAG(IS_POSIX)
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kDiscardableMemoryBackingTrial,
+ "DiscardableMemoryBackingTrial",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+@@ -52,7 +52,7 @@ const base::FeatureParam<DiscardableMemoryTrialGroup>
+
+ namespace {
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ DiscardableMemoryBacking GetBackingForFieldTrial() {
+ DiscardableMemoryTrialGroup trial_group =
+@@ -71,7 +71,7 @@ DiscardableMemoryBacking GetBackingForFieldTrial() {
+
+ } // namespace
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ // Probe capabilities of this device to determine whether we should participate
+ // in the discardable memory backing trial.
+@@ -101,7 +101,7 @@ DiscardableMemory::DiscardableMemory() = default;
+ DiscardableMemory::~DiscardableMemory() = default;
+
+ DiscardableMemoryBacking GetDiscardableMemoryBacking() {
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (DiscardableMemoryBackingFieldTrialIsEnabled()) {
+ return GetBackingForFieldTrial();
+ }
diff --git a/devel/electron31/files/patch-base_memory_discardable__memory__internal.h b/devel/electron31/files/patch-base_memory_discardable__memory__internal.h
new file mode 100644
index 000000000000..13bef7210432
--- /dev/null
+++ b/devel/electron31/files/patch-base_memory_discardable__memory__internal.h
@@ -0,0 +1,11 @@
+--- base/memory/discardable_memory_internal.h.orig 2022-02-28 16:54:41 UTC
++++ base/memory/discardable_memory_internal.h
+@@ -10,7 +10,7 @@
+ #include "base/metrics/field_trial_params.h"
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ namespace base {
+
diff --git a/devel/electron31/files/patch-base_memory_madv__free__discardable__memory__posix.cc b/devel/electron31/files/patch-base_memory_madv__free__discardable__memory__posix.cc
new file mode 100644
index 000000000000..ff593211a083
--- /dev/null
+++ b/devel/electron31/files/patch-base_memory_madv__free__discardable__memory__posix.cc
@@ -0,0 +1,21 @@
+--- base/memory/madv_free_discardable_memory_posix.cc.orig 2024-06-18 21:43:17 UTC
++++ base/memory/madv_free_discardable_memory_posix.cc
+@@ -311,6 +311,10 @@ bool MadvFreeDiscardableMemoryPosix::IsResident() cons
+
+ bool MadvFreeDiscardableMemoryPosix::IsResident() const {
+ DFAKE_SCOPED_RECURSIVE_LOCK(thread_collision_warner_);
++// XXX mincore
++#if BUILDFLAG(IS_BSD)
++ return false;
++#else
+ #if BUILDFLAG(IS_APPLE)
+ std::vector<char> vec(allocated_pages_);
+ #else
+@@ -326,6 +330,7 @@ bool MadvFreeDiscardableMemoryPosix::IsResident() cons
+ return false;
+ }
+ return true;
++#endif
+ }
+
+ bool MadvFreeDiscardableMemoryPosix::IsDiscarded() const {
diff --git a/devel/electron31/files/patch-base_memory_platform__shared__memory__region.h b/devel/electron31/files/patch-base_memory_platform__shared__memory__region.h
new file mode 100644
index 000000000000..33dba1312700
--- /dev/null
+++ b/devel/electron31/files/patch-base_memory_platform__shared__memory__region.h
@@ -0,0 +1,29 @@
+--- base/memory/platform_shared_memory_region.h.orig 2024-04-15 20:33:42 UTC
++++ base/memory/platform_shared_memory_region.h
+@@ -17,7 +17,7 @@
+ #include "base/unguessable_token.h"
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ namespace content {
+ class SandboxIPCHandler;
+ }
+@@ -84,7 +84,7 @@ class BASE_EXPORT PlatformSharedMemoryRegion {
+ kMaxValue = GET_SHMEM_TEMP_DIR_FAILURE
+ };
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Structure to limit access to executable region creation.
+ struct ExecutableRegion {
+ private:
+@@ -216,7 +216,7 @@ class BASE_EXPORT PlatformSharedMemoryRegion {
+ CheckPlatformHandlePermissionsCorrespondToMode);
+ static PlatformSharedMemoryRegion Create(Mode mode,
+ size_t size
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ,
+ bool executable = false
+ #endif
diff --git a/devel/electron31/files/patch-base_memory_platform__shared__memory__region__posix.cc b/devel/electron31/files/patch-base_memory_platform__shared__memory__region__posix.cc
new file mode 100644
index 000000000000..fc212fadf786
--- /dev/null
+++ b/devel/electron31/files/patch-base_memory_platform__shared__memory__region__posix.cc
@@ -0,0 +1,29 @@
+--- base/memory/platform_shared_memory_region_posix.cc.orig 2023-02-01 18:43:07 UTC
++++ base/memory/platform_shared_memory_region_posix.cc
+@@ -55,7 +55,7 @@ bool CheckFDAccessMode(int fd, int expected_mode) {
+
+ } // namespace
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // static
+ ScopedFD PlatformSharedMemoryRegion::ExecutableRegion::CreateFD(size_t size) {
+ PlatformSharedMemoryRegion region =
+@@ -168,7 +168,7 @@ bool PlatformSharedMemoryRegion::ConvertToUnsafe() {
+ // static
+ PlatformSharedMemoryRegion PlatformSharedMemoryRegion::Create(Mode mode,
+ size_t size
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ,
+ bool executable
+ #endif
+@@ -197,7 +197,7 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion:
+ // flag.
+ FilePath directory;
+ if (!GetShmemTempDir(
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ executable,
+ #else
+ false /* executable */,
diff --git a/devel/electron31/files/patch-base_message__loop_message__pump__glib.cc b/devel/electron31/files/patch-base_message__loop_message__pump__glib.cc
new file mode 100644
index 000000000000..6734d01e8bf0
--- /dev/null
+++ b/devel/electron31/files/patch-base_message__loop_message__pump__glib.cc
@@ -0,0 +1,28 @@
+--- base/message_loop/message_pump_glib.cc.orig 2022-08-31 12:19:35 UTC
++++ base/message_loop/message_pump_glib.cc
+@@ -8,6 +8,11 @@
+ #include <glib.h>
+ #include <math.h>
+
++#if BUILDFLAG(IS_BSD)
++#include <pthread.h>
++#include <pthread_np.h>
++#endif
++
+ #include "base/logging.h"
+ #include "base/memory/raw_ptr.h"
+ #include "base/notreached.h"
+@@ -51,9 +56,13 @@ int GetTimeIntervalMilliseconds(TimeTicks next_task_ti
+ }
+
+ bool RunningOnMainThread() {
++#if BUILDFLAG(IS_BSD)
++ return pthread_main_np();
++#else
+ auto pid = getpid();
+ auto tid = PlatformThread::CurrentId();
+ return pid > 0 && tid > 0 && pid == tid;
++#endif
+ }
+
+ // A brief refresher on GLib:
diff --git a/devel/electron31/files/patch-base_native__library__posix.cc b/devel/electron31/files/patch-base_native__library__posix.cc
new file mode 100644
index 000000000000..c2b8d0e5e970
--- /dev/null
+++ b/devel/electron31/files/patch-base_native__library__posix.cc
@@ -0,0 +1,11 @@
+--- base/native_library_posix.cc.orig 2022-05-19 14:06:27 UTC
++++ base/native_library_posix.cc
+@@ -33,7 +33,7 @@ NativeLibrary LoadNativeLibraryWithOptions(const FileP
+ // http://crbug.com/17943, http://crbug.com/17557, http://crbug.com/36892,
+ // and http://crbug.com/40794.
+ int flags = RTLD_LAZY;
+-#if BUILDFLAG(IS_ANDROID) || !defined(RTLD_DEEPBIND)
++#if BUILDFLAG(IS_ANDROID) || !defined(RTLD_DEEPBIND) || BUILDFLAG(IS_BSD)
+ // Certain platforms don't define RTLD_DEEPBIND. Android dlopen() requires
+ // further investigation, as it might vary across versions. Crash here to
+ // warn developers that they're trying to rely on uncertain behavior.
diff --git a/devel/electron31/files/patch-base_native__library__unittest.cc b/devel/electron31/files/patch-base_native__library__unittest.cc
new file mode 100644
index 000000000000..91c0e0b9d9bd
--- /dev/null
+++ b/devel/electron31/files/patch-base_native__library__unittest.cc
@@ -0,0 +1,11 @@
+--- base/native_library_unittest.cc.orig 2024-04-15 20:33:42 UTC
++++ base/native_library_unittest.cc
+@@ -133,7 +133,7 @@ TEST(NativeLibraryTest, LoadLibrary) {
+ // versions with respect to symbol resolution scope.
+ // TSan and MSan error out on RTLD_DEEPBIND, https://crbug.com/705255
+ #if !BUILDFLAG(IS_ANDROID) && !defined(THREAD_SANITIZER) && \
+- !defined(MEMORY_SANITIZER)
++ !defined(MEMORY_SANITIZER) && !BUILDFLAG(IS_BSD)
+
+ // Verifies that the |prefer_own_symbols| option satisfies its guarantee that
+ // a loaded library will always prefer local symbol resolution before
diff --git a/devel/electron31/files/patch-base_posix_can__lower__nice__to.cc b/devel/electron31/files/patch-base_posix_can__lower__nice__to.cc
new file mode 100644
index 000000000000..67a5d35808ae
--- /dev/null
+++ b/devel/electron31/files/patch-base_posix_can__lower__nice__to.cc
@@ -0,0 +1,16 @@
+--- base/posix/can_lower_nice_to.cc.orig 2022-02-28 16:54:41 UTC
++++ base/posix/can_lower_nice_to.cc
+@@ -11,8 +11,12 @@
+
+ #include "build/build_config.h"
+
++#if BUILDFLAG(IS_FREEBSD)
++#include <sys/param.h>
++#endif
++
+ // Not defined on AIX by default.
+-#if BUILDFLAG(IS_AIX)
++#if BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ #if defined(RLIMIT_NICE)
+ #error Assumption about OS_AIX is incorrect
+ #endif
diff --git a/devel/electron31/files/patch-base_posix_sysctl.cc b/devel/electron31/files/patch-base_posix_sysctl.cc
new file mode 100644
index 000000000000..7599323d6f5b
--- /dev/null
+++ b/devel/electron31/files/patch-base_posix_sysctl.cc
@@ -0,0 +1,10 @@
+--- base/posix/sysctl.cc.orig 2023-11-29 21:39:40 UTC
++++ base/posix/sysctl.cc
+@@ -4,6 +4,7 @@
+
+ #include "base/posix/sysctl.h"
+
++#include <sys/types.h>
+ #include <sys/sysctl.h>
+
+ #include <initializer_list>
diff --git a/devel/electron31/files/patch-base_posix_unix__domain__socket.cc b/devel/electron31/files/patch-base_posix_unix__domain__socket.cc
new file mode 100644
index 000000000000..30030a397886
--- /dev/null
+++ b/devel/electron31/files/patch-base_posix_unix__domain__socket.cc
@@ -0,0 +1,57 @@
+--- base/posix/unix_domain_socket.cc.orig 2024-06-18 21:43:17 UTC
++++ base/posix/unix_domain_socket.cc
+@@ -56,7 +56,7 @@ bool UnixDomainSocket::EnableReceiveProcessId(int fd)
+
+ // static
+ bool UnixDomainSocket::EnableReceiveProcessId(int fd) {
+-#if !BUILDFLAG(IS_APPLE)
++#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD)
+ const int enable = 1;
+ return setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &enable, sizeof(enable)) == 0;
+ #else
+@@ -82,7 +82,7 @@ bool UnixDomainSocket::SendMsg(int fd,
+
+ struct cmsghdr* cmsg;
+ msg.msg_control = control_buffer;
+-#if BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ msg.msg_controllen = checked_cast<socklen_t>(control_len);
+ #else
+ msg.msg_controllen = control_len;
+@@ -90,7 +90,7 @@ bool UnixDomainSocket::SendMsg(int fd,
+ cmsg = CMSG_FIRSTHDR(&msg);
+ cmsg->cmsg_level = SOL_SOCKET;
+ cmsg->cmsg_type = SCM_RIGHTS;
+-#if BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ cmsg->cmsg_len = checked_cast<u_int>(CMSG_LEN(sizeof(int) * fds.size()));
+ #else
+ cmsg->cmsg_len = CMSG_LEN(sizeof(int) * fds.size());
+@@ -154,7 +154,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd,
+
+ const size_t kControlBufferSize =
+ CMSG_SPACE(sizeof(int) * kMaxFileDescriptors)
+-#if !BUILDFLAG(IS_APPLE)
++#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD)
+ // macOS does not support ucred.
+ // macOS supports xucred, but this structure is insufficient.
+ + CMSG_SPACE(sizeof(struct ucred))
+@@ -182,7 +182,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd,
+ wire_fds = reinterpret_cast<int*>(CMSG_DATA(cmsg));
+ wire_fds_len = payload_len / sizeof(int);
+ }
+-#if !BUILDFLAG(IS_APPLE)
++#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD)
+ // macOS does not support SCM_CREDENTIALS.
+ if (cmsg->cmsg_level == SOL_SOCKET &&
+ cmsg->cmsg_type == SCM_CREDENTIALS) {
+@@ -216,6 +216,9 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd,
+ socklen_t pid_size = sizeof(pid);
+ if (getsockopt(fd, SOL_LOCAL, LOCAL_PEERPID, &pid, &pid_size) != 0)
+ pid = -1;
++#elif BUILDFLAG(IS_BSD)
++ NOTIMPLEMENTED();
++ pid = -1;
+ #else
+ // |pid| will legitimately be -1 if we read EOF, so only DCHECK if we
+ // actually received a message. Unfortunately, Linux allows sending zero
diff --git a/devel/electron31/files/patch-base_posix_unix__domain__socket__unittest.cc b/devel/electron31/files/patch-base_posix_unix__domain__socket__unittest.cc
new file mode 100644
index 000000000000..432387473491
--- /dev/null
+++ b/devel/electron31/files/patch-base_posix_unix__domain__socket__unittest.cc
@@ -0,0 +1,11 @@
+--- base/posix/unix_domain_socket_unittest.cc.orig 2024-06-18 21:43:17 UTC
++++ base/posix/unix_domain_socket_unittest.cc
+@@ -15,6 +15,8 @@
+ #include <sys/types.h>
+ #include <unistd.h>
+
++#include <signal.h>
++
+ #include "base/files/file_util.h"
+ #include "base/files/scoped_file.h"
+ #include "base/functional/bind.h"
diff --git a/devel/electron31/files/patch-base_process_internal__linux.h b/devel/electron31/files/patch-base_process_internal__linux.h
new file mode 100644
index 000000000000..de187aec237f
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_internal__linux.h
@@ -0,0 +1,20 @@
+--- base/process/internal_linux.h.orig 2024-06-18 21:43:17 UTC
++++ base/process/internal_linux.h
+@@ -140,6 +140,9 @@ void ForEachProcessTask(base::ProcessHandle process, L
+ // arguments to the lambda.
+ template <typename Lambda>
+ void ForEachProcessTask(base::ProcessHandle process, Lambda&& lambda) {
++#if BUILDFLAG(IS_BSD)
++ return;
++#else
+ // Iterate through the different threads tracked in /proc/<pid>/task.
+ FilePath fd_path = GetProcPidDir(process).Append("task");
+
+@@ -159,6 +162,7 @@ void ForEachProcessTask(base::ProcessHandle process, L
+ FilePath task_path = fd_path.Append(tid_str);
+ lambda(tid, task_path);
+ }
++#endif
+ }
+
+ } // namespace internal
diff --git a/devel/electron31/files/patch-base_process_kill.h b/devel/electron31/files/patch-base_process_kill.h
new file mode 100644
index 000000000000..a72acaccad31
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_kill.h
@@ -0,0 +1,11 @@
+--- base/process/kill.h.orig 2024-06-18 21:43:17 UTC
++++ base/process/kill.h
+@@ -123,7 +123,7 @@ BASE_EXPORT TerminationStatus GetKnownDeadTerminationS
+ BASE_EXPORT TerminationStatus GetKnownDeadTerminationStatus(
+ ProcessHandle handle, int* exit_code);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Spawns a thread to wait asynchronously for the child |process| to exit
+ // and then reaps it.
+ BASE_EXPORT void EnsureProcessGetsReaped(Process process);
diff --git a/devel/electron31/files/patch-base_process_kill__posix.cc b/devel/electron31/files/patch-base_process_kill__posix.cc
new file mode 100644
index 000000000000..b197dc3675c5
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_kill__posix.cc
@@ -0,0 +1,11 @@
+--- base/process/kill_posix.cc.orig 2023-03-30 00:33:38 UTC
++++ base/process/kill_posix.cc
+@@ -157,7 +157,7 @@ void EnsureProcessTerminated(Process process) {
+ 0, new BackgroundReaper(std::move(process), Seconds(2)));
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void EnsureProcessGetsReaped(Process process) {
+ DCHECK(!process.is_current());
+
diff --git a/devel/electron31/files/patch-base_process_launch.h b/devel/electron31/files/patch-base_process_launch.h
new file mode 100644
index 000000000000..7357acf2f254
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_launch.h
@@ -0,0 +1,11 @@
+--- base/process/launch.h.orig 2023-05-25 00:41:38 UTC
++++ base/process/launch.h
+@@ -200,7 +200,7 @@ struct BASE_EXPORT LaunchOptions {
+ bool clear_environment = false;
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // If non-zero, start the process using clone(), using flags as provided.
+ // Unlike in clone, clone_flags may not contain a custom termination signal
+ // that is sent to the parent when the child dies. The termination signal will
diff --git a/devel/electron31/files/patch-base_process_launch__posix.cc b/devel/electron31/files/patch-base_process_launch__posix.cc
new file mode 100644
index 000000000000..50e41bd15cfc
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_launch__posix.cc
@@ -0,0 +1,12 @@
+--- base/process/launch_posix.cc.orig 2024-06-18 21:43:17 UTC
++++ base/process/launch_posix.cc
+@@ -66,6 +66,9 @@
+ #error "macOS should use launch_mac.cc"
+ #endif
+
++#if defined(OS_FREEBSD)
++#pragma weak environ
++#endif
+ extern char** environ;
+
+ namespace base {
diff --git a/devel/electron31/files/patch-base_process_memory__linux.cc b/devel/electron31/files/patch-base_process_memory__linux.cc
new file mode 100644
index 000000000000..4a26602ac28a
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_memory__linux.cc
@@ -0,0 +1,44 @@
+--- base/process/memory_linux.cc.orig 2024-06-18 21:43:17 UTC
++++ base/process/memory_linux.cc
+@@ -28,6 +28,7 @@ namespace base {
+
+ namespace base {
+
++#if !BUILDFLAG(IS_BSD)
+ namespace {
+
+ void ReleaseReservationOrTerminate() {
+@@ -37,12 +38,14 @@ void ReleaseReservationOrTerminate() {
+ }
+
+ } // namespace
++#endif
+
+ void EnableTerminationOnHeapCorruption() {
+ // On Linux, there nothing to do AFAIK.
+ }
+
+ void EnableTerminationOnOutOfMemory() {
++#if !BUILDFLAG(IS_BSD)
+ // Set the new-out of memory handler.
+ std::set_new_handler(&ReleaseReservationOrTerminate);
+ // If we're using glibc's allocator, the above functions will override
+@@ -51,8 +54,10 @@ void EnableTerminationOnOutOfMemory() {
+ #if PA_BUILDFLAG(USE_ALLOCATOR_SHIM)
+ allocator_shim::SetCallNewHandlerOnMallocFailure(true);
+ #endif
++#endif
+ }
+
++#if !BUILDFLAG(IS_BSD)
+ // ScopedAllowBlocking() has private constructor and it can only be used in
+ // friend classes/functions. Declaring a class is easier in this situation to
+ // avoid adding more dependency to thread_restrictions.h because of the
+@@ -112,6 +117,7 @@ bool AdjustOOMScore(ProcessId process, int score) {
+ bool AdjustOOMScore(ProcessId process, int score) {
+ return AdjustOOMScoreHelper::AdjustOOMScore(process, score);
+ }
++#endif
+
+ bool UncheckedMalloc(size_t size, void** result) {
+ #if PA_BUILDFLAG(USE_ALLOCATOR_SHIM)
diff --git a/devel/electron31/files/patch-base_process_process__handle.cc b/devel/electron31/files/patch-base_process_process__handle.cc
new file mode 100644
index 000000000000..efb95e7c3b54
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_process__handle.cc
@@ -0,0 +1,11 @@
+--- base/process/process_handle.cc.orig 2022-02-28 16:54:41 UTC
++++ base/process/process_handle.cc
+@@ -30,7 +30,7 @@ UniqueProcId GetUniqueIdForProcess() {
+ : UniqueProcId(GetCurrentProcId());
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_AIX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+
+ void InitUniqueIdForProcessInPidNamespace(ProcessId pid_outside_of_namespace) {
+ DCHECK(pid_outside_of_namespace != kNullProcessId);
diff --git a/devel/electron31/files/patch-base_process_process__handle.h b/devel/electron31/files/patch-base_process_process__handle.h
new file mode 100644
index 000000000000..43885dd9eb96
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_process__handle.h
@@ -0,0 +1,11 @@
+--- base/process/process_handle.h.orig 2024-02-21 00:20:30 UTC
++++ base/process/process_handle.h
+@@ -86,7 +86,7 @@ BASE_EXPORT UniqueProcId GetUniqueIdForProcess();
+ // processes may be reused.
+ BASE_EXPORT UniqueProcId GetUniqueIdForProcess();
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // When a process is started in a different PID namespace from the browser
+ // process, this function must be called with the process's PID in the browser's
+ // PID namespace in order to initialize its unique ID. Not thread safe.
diff --git a/devel/electron31/files/patch-base_process_process__handle__freebsd.cc b/devel/electron31/files/patch-base_process_process__handle__freebsd.cc
new file mode 100644
index 000000000000..1f676e07fbdf
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_process__handle__freebsd.cc
@@ -0,0 +1,25 @@
+--- base/process/process_handle_freebsd.cc.orig 2024-04-15 20:33:42 UTC
++++ base/process/process_handle_freebsd.cc
+@@ -3,6 +3,7 @@
+ // found in the LICENSE file.
+
+ #include "base/process/process_handle.h"
++#include "base/files/file_util.h"
+
+ #include <limits.h>
+ #include <stddef.h>
+@@ -20,10 +21,13 @@ ProcessId GetParentProcessId(ProcessHandle process) {
+
+ ProcessId GetParentProcessId(ProcessHandle process) {
+ struct kinfo_proc info;
+- size_t length;
++ size_t length = sizeof(struct kinfo_proc);
+ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process };
+
+ if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0)
++ return -1;
++
++ if (length < sizeof(struct kinfo_proc))
+ return -1;
+
+ return info.ki_ppid;
diff --git a/devel/electron31/files/patch-base_process_process__handle__openbsd.cc b/devel/electron31/files/patch-base_process_process__handle__openbsd.cc
new file mode 100644
index 000000000000..c3ef5fe46561
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_process__handle__openbsd.cc
@@ -0,0 +1,133 @@
+--- base/process/process_handle_openbsd.cc.orig 2024-04-15 20:33:42 UTC
++++ base/process/process_handle_openbsd.cc
+@@ -3,48 +3,112 @@
+ // found in the LICENSE file.
+
+ #include "base/process/process_handle.h"
++#include "base/files/file_util.h"
+
+ #include <stddef.h>
++#include <stdlib.h>
++#include <sys/param.h>
++#include <sys/proc.h>
++#include <sys/stat.h>
+ #include <sys/sysctl.h>
+ #include <sys/types.h>
+ #include <unistd.h>
+
++#include <kvm.h>
++
+ namespace base {
+
+ ProcessId GetParentProcessId(ProcessHandle process) {
+- struct kinfo_proc info;
++ struct kinfo_proc *info;
+ size_t length;
++ pid_t ppid;
+ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process,
+ sizeof(struct kinfo_proc), 0 };
+
+ if (sysctl(mib, std::size(mib), NULL, &length, NULL, 0) < 0)
+ return -1;
+
+- mib[5] = (length / sizeof(struct kinfo_proc));
++ info = (struct kinfo_proc *)malloc(length);
+
+- if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0)
+- return -1;
++ mib[5] = static_cast<int>((length / sizeof(struct kinfo_proc)));
+
+- return info.p_ppid;
++ if (sysctl(mib, std::size(mib), info, &length, NULL, 0) < 0) {
++ ppid = -1;
++ goto out;
++ }
++
++ ppid = info->p_ppid;
++
++out:
++ free(info);
++ return ppid;
+ }
+
+ FilePath GetProcessExecutablePath(ProcessHandle process) {
+- struct kinfo_proc kp;
++ struct kinfo_file *files;
++ kvm_t *kd = NULL;
++ char errbuf[_POSIX2_LINE_MAX];
++ char **retvalargs, *cpath, retval[PATH_MAX];
++ int cnt;
+ size_t len;
+- int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process,
+- sizeof(struct kinfo_proc), 0 };
++ char *tokens[2];
++ struct stat sb;
++ FilePath result;
+
+- if (sysctl(mib, std::size(mib), NULL, &len, NULL, 0) == -1)
+- return FilePath();
+- mib[5] = (len / sizeof(struct kinfo_proc));
+- if (sysctl(mib, std::size(mib), &kp, &len, NULL, 0) < 0)
+- return FilePath();
+- if ((kp.p_flag & P_SYSTEM) != 0)
+- return FilePath();
+- if (strcmp(kp.p_comm, "chrome") == 0)
+- return FilePath(kp.p_comm);
++ int mib[] = { CTL_KERN, KERN_PROC_ARGS, process, KERN_PROC_ARGV };
+
+- return FilePath();
++ if ((cpath = getenv("CHROME_EXE_PATH")) != NULL)
++ result = FilePath(cpath);
++ else
++ result = FilePath("/usr/local/chrome/chrome");
++
++ if (sysctl(mib, std::size(mib), NULL, &len, NULL, 0) != -1) {
++ retvalargs = static_cast<char**>(malloc(len));
++ if (!retvalargs)
++ return result;
++
++ if (sysctl(mib, std::size(mib), retvalargs, &len, NULL, 0) < 0) {
++ free(retvalargs);
++ return result;
++ }
++
++ if ((*tokens = strtok(retvalargs[0], ":")) == NULL) {
++ free(retvalargs);
++ return result;
++ }
++
++ free(retvalargs);
++
++ if (tokens[0] == NULL)
++ return result;
++
++ if (realpath(tokens[0], retval) == NULL)
++ return result;
++
++ if (stat(retval, &sb) < 0)
++ return result;
++
++ if ((kd = kvm_openfiles(NULL, NULL, NULL, (int)KVM_NO_FILES,
++ errbuf)) == NULL)
++ return result;
++
++ if ((files = kvm_getfiles(kd, KERN_FILE_BYPID, process,
++ sizeof(struct kinfo_file), &cnt)) == NULL) {
++ kvm_close(kd);
++ return result;
++ }
++
++ for (int i = 0; i < cnt; i++) {
++ if (files[i].fd_fd == KERN_FILE_TEXT &&
++ files[i].va_fsid == static_cast<uint32_t>(sb.st_dev) &&
++ files[i].va_fileid == sb.st_ino) {
++ kvm_close(kd);
++ result = FilePath(retval);
++ }
++ }
++ }
++
++ return result;
+ }
+
+ } // namespace base
diff --git a/devel/electron31/files/patch-base_process_process__iterator__freebsd.cc b/devel/electron31/files/patch-base_process_process__iterator__freebsd.cc
new file mode 100644
index 000000000000..0b752cea1428
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_process__iterator__freebsd.cc
@@ -0,0 +1,51 @@
+--- base/process/process_iterator_freebsd.cc.orig 2023-03-30 00:33:38 UTC
++++ base/process/process_iterator_freebsd.cc
+@@ -18,7 +18,7 @@ namespace base {
+
+ ProcessIterator::ProcessIterator(const ProcessFilter* filter)
+ : filter_(filter) {
+- int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, getuid() };
++ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, (int) getuid() };
+
+ bool done = false;
+ int try_num = 1;
+@@ -37,7 +37,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter*
+ num_of_kinfo_proc += 16;
+ kinfo_procs_.resize(num_of_kinfo_proc);
+ len = num_of_kinfo_proc * sizeof(struct kinfo_proc);
+- if (sysctl(mib, std::size(mib), &kinfo_procs_[0], &len, NULL, 0) < 0) {
++ if (sysctl(mib, std::size(mib), kinfo_procs_.data(), &len, NULL, 0) < 0) {
+ // If we get a mem error, it just means we need a bigger buffer, so
+ // loop around again. Anything else is a real error and give up.
+ if (errno != ENOMEM) {
+@@ -47,7 +47,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter*
+ }
+ } else {
+ // Got the list, just make sure we're sized exactly right
+- size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
++ num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
+ kinfo_procs_.resize(num_of_kinfo_proc);
+ done = true;
+ }
+@@ -68,18 +68,13 @@ bool ProcessIterator::CheckForNextProcess() {
+ for (; index_of_kinfo_proc_ < kinfo_procs_.size(); ++index_of_kinfo_proc_) {
+ size_t length;
+ struct kinfo_proc kinfo = kinfo_procs_[index_of_kinfo_proc_];
+- int mib[] = { CTL_KERN, KERN_PROC_ARGS, kinfo.ki_pid };
++ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_ARGS, kinfo.ki_pid };
+
+ if ((kinfo.ki_pid > 0) && (kinfo.ki_stat == SZOMB))
+ continue;
+
+- length = 0;
+- if (sysctl(mib, std::size(mib), NULL, &length, NULL, 0) < 0) {
+- LOG(ERROR) << "failed to figure out the buffer size for a command line";
+- continue;
+- }
+-
+- data.resize(length);
++ data.resize(ARG_MAX);
++ length = ARG_MAX;
+
+ if (sysctl(mib, std::size(mib), &data[0], &length, NULL, 0) < 0) {
+ LOG(ERROR) << "failed to fetch a commandline";
diff --git a/devel/electron31/files/patch-base_process_process__iterator__openbsd.cc b/devel/electron31/files/patch-base_process_process__iterator__openbsd.cc
new file mode 100644
index 000000000000..ca96780b7ba2
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_process__iterator__openbsd.cc
@@ -0,0 +1,45 @@
+--- base/process/process_iterator_openbsd.cc.orig 2023-03-30 00:33:38 UTC
++++ base/process/process_iterator_openbsd.cc
+@@ -6,6 +6,9 @@
+
+ #include <errno.h>
+ #include <stddef.h>
++#include <unistd.h>
++#include <sys/param.h>
++#include <sys/proc.h>
+ #include <sys/sysctl.h>
+
+ #include "base/logging.h"
+@@ -16,12 +19,13 @@ namespace base {
+
+ ProcessIterator::ProcessIterator(const ProcessFilter* filter)
+ : filter_(filter) {
+- int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, getuid(),
++ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, static_cast<int>(getuid()),
+ sizeof(struct kinfo_proc), 0 };
+
+ bool done = false;
+ int try_num = 1;
+ const int max_tries = 10;
++ size_t num_of_kinfo_proc;
+
+ do {
+ size_t len = 0;
+@@ -30,7 +34,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter*
+ kinfo_procs_.resize(0);
+ done = true;
+ } else {
+- size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
++ num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
+ // Leave some spare room for process table growth (more could show up
+ // between when we check and now)
+ num_of_kinfo_proc += 16;
+@@ -46,7 +50,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter*
+ }
+ } else {
+ // Got the list, just make sure we're sized exactly right
+- size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
++ num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
+ kinfo_procs_.resize(num_of_kinfo_proc);
+ done = true;
+ }
diff --git a/devel/electron31/files/patch-base_process_process__metrics.cc b/devel/electron31/files/patch-base_process_process__metrics.cc
new file mode 100644
index 000000000000..792effaa0e48
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_process__metrics.cc
@@ -0,0 +1,49 @@
+--- base/process/process_metrics.cc.orig 2024-06-18 21:43:17 UTC
++++ base/process/process_metrics.cc
+@@ -17,7 +17,7 @@ namespace {
+ namespace {
+
+ #if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ int CalculateEventsPerSecond(uint64_t event_count,
+ uint64_t* last_event_count,
+ base::TimeTicks* last_calculated) {
+@@ -54,7 +54,7 @@ SystemMetrics SystemMetrics::Sample() {
+ SystemMetrics system_metrics;
+
+ system_metrics.committed_memory_ = GetSystemCommitCharge();
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ GetSystemMemoryInfo(&system_metrics.memory_info_);
+ GetVmStatInfo(&system_metrics.vmstat_info_);
+ GetSystemDiskInfo(&system_metrics.disk_info_);
+@@ -73,7 +73,7 @@ Value::Dict SystemMetrics::ToDict() const {
+ Value::Dict res;
+
+ res.Set("committed_memory", static_cast<int>(committed_memory_));
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ Value::Dict meminfo = memory_info_.ToDict();
+ meminfo.Merge(vmstat_info_.ToDict());
+ res.Set("meminfo", std::move(meminfo));
+@@ -100,7 +100,6 @@ std::unique_ptr<ProcessMetrics> ProcessMetrics::Create
+ #endif // !BUILDFLAG(IS_MAC)
+ }
+
+-#if !BUILDFLAG(IS_FREEBSD) || !BUILDFLAG(IS_POSIX)
+ double ProcessMetrics::GetPlatformIndependentCPUUsage(
+ TimeDelta cumulative_cpu) {
+ TimeTicks time = TimeTicks::Now();
+@@ -129,10 +128,9 @@ ProcessMetrics::GetPlatformIndependentCPUUsage() {
+ return GetPlatformIndependentCPUUsage(cpu_usage);
+ });
+ }
+-#endif
+
+ #if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ int ProcessMetrics::CalculateIdleWakeupsPerSecond(
+ uint64_t absolute_idle_wakeups) {
+ return CalculateEventsPerSecond(absolute_idle_wakeups,
diff --git a/devel/electron31/files/patch-base_process_process__metrics.h b/devel/electron31/files/patch-base_process_process__metrics.h
new file mode 100644
index 000000000000..022a73d2bc48
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_process__metrics.h
@@ -0,0 +1,115 @@
+--- base/process/process_metrics.h.orig 2024-06-18 21:43:17 UTC
++++ base/process/process_metrics.h
+@@ -38,7 +38,7 @@
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ #include <string>
+ #include <utility>
+ #include <vector>
+@@ -48,7 +48,7 @@ namespace base {
+
+ namespace base {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // Minor and major page fault counts since the process creation.
+ // Both counts are process-wide, and exclude child processes.
+ //
+@@ -116,7 +116,7 @@ class BASE_EXPORT ProcessMetrics {
+ // convenience wrapper for CreateProcessMetrics().
+ static std::unique_ptr<ProcessMetrics> CreateCurrentProcessMetrics();
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // Resident Set Size is a Linux/Android specific memory concept. Do not
+ // attempt to extend this to other platforms.
+ BASE_EXPORT size_t GetResidentSetSize() const;
+@@ -150,7 +150,7 @@ class BASE_EXPORT ProcessMetrics {
+ base::expected<TimeDelta, ProcessCPUUsageError> GetCumulativeCPUUsage();
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ // Emits the cumulative CPU usage for all currently active threads since they
+ // were started into the output parameter (replacing its current contents).
+ // Threads that have already terminated will not be reported. Thus, the sum of
+@@ -195,7 +195,7 @@ class BASE_EXPORT ProcessMetrics {
+ int GetOpenFdSoftLimit() const;
+ #endif // BUILDFLAG(IS_POSIX)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // Bytes of swap as reported by /proc/[pid]/status.
+ uint64_t GetVmSwapBytes() const;
+
+@@ -216,7 +216,7 @@ class BASE_EXPORT ProcessMetrics {
+ #endif // !BUILDFLAG(IS_MAC)
+
+ #if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ int CalculateIdleWakeupsPerSecond(uint64_t absolute_idle_wakeups);
+ #endif
+ #if BUILDFLAG(IS_APPLE)
+@@ -238,12 +238,10 @@ class BASE_EXPORT ProcessMetrics {
+ // Used to store the previous times and CPU usage counts so we can
+ // compute the CPU usage between calls.
+ TimeTicks last_cpu_time_;
+-#if !BUILDFLAG(IS_FREEBSD) || !BUILDFLAG(IS_POSIX)
+ TimeDelta last_cumulative_cpu_;
+-#endif
+
+ #if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ // Same thing for idle wakeups.
+ TimeTicks last_idle_wakeups_time_;
+ uint64_t last_absolute_idle_wakeups_;
+@@ -284,7 +282,7 @@ BASE_EXPORT void IncreaseFdLimitTo(unsigned int max_de
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_AIX) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // Data about system-wide memory consumption. Values are in KB. Available on
+ // Windows, Mac, Linux, Android and Chrome OS.
+ //
+@@ -319,7 +317,7 @@ struct BASE_EXPORT SystemMemoryInfoKB {
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ // This provides an estimate of available memory as described here:
+ // https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773
+ // NOTE: this is ONLY valid in kernels 3.14 and up. Its value will always
+@@ -334,7 +332,7 @@ struct BASE_EXPORT SystemMemoryInfoKB {
+ #endif
+
+ #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ int buffers = 0;
+ int cached = 0;
+ int active_anon = 0;
+@@ -371,7 +369,7 @@ BASE_EXPORT bool GetSystemMemoryInfo(SystemMemoryInfoK
+ // BUILDFLAG(IS_FUCHSIA)
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ // Parse the data found in /proc/<pid>/stat and return the sum of the
+ // CPU-related ticks. Returns -1 on parse error.
+ // Exposed for testing.
+@@ -566,7 +564,7 @@ class BASE_EXPORT SystemMetrics {
+ FRIEND_TEST_ALL_PREFIXES(SystemMetricsTest, SystemMetrics);
+
+ size_t committed_memory_;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ SystemMemoryInfoKB memory_info_;
+ VmStatInfo vmstat_info_;
+ SystemDiskInfo disk_info_;
diff --git a/devel/electron31/files/patch-base_process_process__metrics__freebsd.cc b/devel/electron31/files/patch-base_process_process__metrics__freebsd.cc
new file mode 100644
index 000000000000..5e90df03d138
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_process__metrics__freebsd.cc
@@ -0,0 +1,307 @@
+--- base/process/process_metrics_freebsd.cc.orig 2024-06-18 21:43:17 UTC
++++ base/process/process_metrics_freebsd.cc
+@@ -3,44 +3,58 @@
+ // found in the LICENSE file.
+
+ #include "base/process/process_metrics.h"
++#include "base/notreached.h"
+
+ #include <stddef.h>
++#include <sys/types.h>
+ #include <sys/sysctl.h>
+ #include <sys/user.h>
+ #include <unistd.h>
+
++#include <fcntl.h> /* O_RDONLY */
++#include <kvm.h>
++#include <libutil.h>
++
+ #include "base/memory/ptr_util.h"
++#include "base/values.h"
+
+ namespace base {
++namespace {
++int GetPageShift() {
++ int pagesize = getpagesize();
++ int pageshift = 0;
+
+-ProcessMetrics::ProcessMetrics(ProcessHandle process)
+- : process_(process),
+- last_cpu_(0) {}
++ while (pagesize > 1) {
++ pageshift++;
++ pagesize >>= 1;
++ }
+
++ return pageshift;
++}
++}
++
++ProcessMetrics::ProcessMetrics(ProcessHandle process) : process_(process) {}
++
+ // static
+ std::unique_ptr<ProcessMetrics> ProcessMetrics::CreateProcessMetrics(
+ ProcessHandle process) {
+ return WrapUnique(new ProcessMetrics(process));
+ }
+
+-base::expected<double, ProcessCPUUsageError>
+-ProcessMetrics::GetPlatformIndependentCPUUsage() {
++base::expected<TimeDelta, ProcessCPUUsageError>
++ProcessMetrics::GetCumulativeCPUUsage() {
+ struct kinfo_proc info;
+- int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, process_};
+- size_t length = sizeof(info);
++ size_t length = sizeof(struct kinfo_proc);
++ struct timeval tv;
+
++ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process_ };
++
+ if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0)
+- return base::unexpected(ProcessCPUUsageError::kSystemError);
++ return base::ok(TimeDelta());
+
+- return base::ok(double{info.ki_pctcpu} / FSCALE * 100.0);
++ return base::ok(Microseconds(info.ki_runtime));
+ }
+
+-base::expected<TimeDelta, ProcessCPUUsageError>
+-ProcessMetrics::GetCumulativeCPUUsage() {
+- NOTREACHED_IN_MIGRATION();
+- return base::unexpected(ProcessCPUUsageError::kNotImplemented);
+-}
+-
+ size_t GetSystemCommitCharge() {
+ int mib[2], pagesize;
+ unsigned long mem_total, mem_free, mem_inactive;
+@@ -62,6 +76,230 @@ size_t GetSystemCommitCharge() {
+ pagesize = getpagesize();
+
+ return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize);
++}
++
++int64_t GetNumberOfThreads(ProcessHandle process) {
++ // Taken from FreeBSD top (usr.bin/top/machine.c)
++
++ kvm_t* kd = kvm_open(NULL, "/dev/null", NULL, O_RDONLY, "kvm_open");
++ if (kd == NULL)
++ return 0;
++
++ struct kinfo_proc* pbase;
++ int nproc;
++ pbase = kvm_getprocs(kd, KERN_PROC_PID, process, &nproc);
++ if (pbase == NULL)
++ return 0;
++
++ if (kvm_close(kd) == -1)
++ return 0;
++
++ return nproc;
++}
++
++bool GetSystemMemoryInfo(SystemMemoryInfoKB *meminfo) {
++ unsigned int mem_total, mem_free, swap_total, swap_used;
++ size_t length;
++ int pagesizeKB;
++
++ pagesizeKB = getpagesize() / 1024;
++
++ length = sizeof(mem_total);
++ if (sysctlbyname("vm.stats.vm.v_page_count", &mem_total,
++ &length, NULL, 0) != 0 || length != sizeof(mem_total))
++ return false;
++
++ length = sizeof(mem_free);
++ if (sysctlbyname("vm.stats.vm.v_free_count", &mem_free, &length, NULL, 0)
++ != 0 || length != sizeof(mem_free))
++ return false;
++
++ length = sizeof(swap_total);
++ if (sysctlbyname("vm.swap_size", &swap_total, &length, NULL, 0)
++ != 0 || length != sizeof(swap_total))
++ return false;
++
++ length = sizeof(swap_used);
++ if (sysctlbyname("vm.swap_anon_use", &swap_used, &length, NULL, 0)
++ != 0 || length != sizeof(swap_used))
++ return false;
++
++ meminfo->total = mem_total * pagesizeKB;
++ meminfo->free = mem_free * pagesizeKB;
++ meminfo->swap_total = swap_total * pagesizeKB;
++ meminfo->swap_free = (swap_total - swap_used) * pagesizeKB;
++
++ return true;
++}
++
++int ProcessMetrics::GetOpenFdCount() const {
++ struct kinfo_file * kif;
++ int cnt;
++
++ if ((kif = kinfo_getfile(process_, &cnt)) == NULL)
++ return -1;
++
++ free(kif);
++
++ return cnt;
++}
++
++int ProcessMetrics::GetOpenFdSoftLimit() const {
++ size_t length;
++ int total_count = 0;
++ int mib[] = { CTL_KERN, KERN_MAXFILESPERPROC };
++
++ length = sizeof(total_count);
++
++ if (sysctl(mib, std::size(mib), &total_count, &length, NULL, 0) < 0) {
++ total_count = -1;
++ }
++
++ return total_count;
++}
++
++size_t ProcessMetrics::GetResidentSetSize() const {
++ kvm_t *kd = kvm_open(nullptr, "/dev/null", nullptr, O_RDONLY, "kvm_open");
++
++ if (kd == nullptr)
++ return 0;
++
++ struct kinfo_proc *pp;
++ int nproc;
++
++ if ((pp = kvm_getprocs(kd, KERN_PROC_PID, process_, &nproc)) == nullptr) {
++ kvm_close(kd);
++ return 0;
++ }
++
++ size_t rss;
++
++ if (nproc > 0) {
++ rss = pp->ki_rssize << GetPageShift();
++ } else {
++ rss = 0;
++ }
++
++ kvm_close(kd);
++ return rss;
++}
++
++uint64_t ProcessMetrics::GetVmSwapBytes() const {
++ kvm_t *kd = kvm_open(nullptr, "/dev/null", nullptr, O_RDONLY, "kvm_open");
++
++ if (kd == nullptr)
++ return 0;
++
++ struct kinfo_proc *pp;
++ int nproc;
++
++ if ((pp = kvm_getprocs(kd, KERN_PROC_PID, process_, &nproc)) == nullptr) {
++ kvm_close(kd);
++ return 0;
++ }
++
++ size_t swrss;
++
++ if (nproc > 0) {
++ swrss = pp->ki_swrss > pp->ki_rssize
++ ? (pp->ki_swrss - pp->ki_rssize) << GetPageShift()
++ : 0;
++ } else {
++ swrss = 0;
++ }
++
++ kvm_close(kd);
++ return swrss;
++}
++
++int ProcessMetrics::GetIdleWakeupsPerSecond() {
++ NOTIMPLEMENTED();
++ return 0;
++}
++
++bool GetSystemDiskInfo(SystemDiskInfo* diskinfo) {
++ NOTIMPLEMENTED();
++ return false;
++}
++
++bool GetVmStatInfo(VmStatInfo* vmstat) {
++ NOTIMPLEMENTED();
++ return false;
++}
++
++SystemDiskInfo::SystemDiskInfo() {
++ reads = 0;
++ reads_merged = 0;
++ sectors_read = 0;
++ read_time = 0;
++ writes = 0;
++ writes_merged = 0;
++ sectors_written = 0;
++ write_time = 0;
++ io = 0;
++ io_time = 0;
++ weighted_io_time = 0;
++}
++
++SystemDiskInfo::SystemDiskInfo(const SystemDiskInfo& other) = default;
++
++SystemDiskInfo& SystemDiskInfo::operator=(const SystemDiskInfo&) = default;
++
++Value::Dict SystemDiskInfo::ToDict() const {
++ Value::Dict res;
++
++ // Write out uint64_t variables as doubles.
++ // Note: this may discard some precision, but for JS there's no other option.
++ res.Set("reads", static_cast<double>(reads));
++ res.Set("reads_merged", static_cast<double>(reads_merged));
++ res.Set("sectors_read", static_cast<double>(sectors_read));
++ res.Set("read_time", static_cast<double>(read_time));
++ res.Set("writes", static_cast<double>(writes));
++ res.Set("writes_merged", static_cast<double>(writes_merged));
++ res.Set("sectors_written", static_cast<double>(sectors_written));
++ res.Set("write_time", static_cast<double>(write_time));
++ res.Set("io", static_cast<double>(io));
++ res.Set("io_time", static_cast<double>(io_time));
++ res.Set("weighted_io_time", static_cast<double>(weighted_io_time));
++
++ NOTIMPLEMENTED();
++
++ return res;
++}
++
++Value::Dict SystemMemoryInfoKB::ToDict() const {
++ Value::Dict res;
++ res.Set("total", total);
++ res.Set("free", free);
++ res.Set("available", available);
++ res.Set("buffers", buffers);
++ res.Set("cached", cached);
++ res.Set("active_anon", active_anon);
++ res.Set("inactive_anon", inactive_anon);
++ res.Set("active_file", active_file);
++ res.Set("inactive_file", inactive_file);
++ res.Set("swap_total", swap_total);
++ res.Set("swap_free", swap_free);
++ res.Set("swap_used", swap_total - swap_free);
++ res.Set("dirty", dirty);
++ res.Set("reclaimable", reclaimable);
++
++ NOTIMPLEMENTED();
++
++ return res;
++}
++
++Value::Dict VmStatInfo::ToDict() const {
++ Value::Dict res;
++ // TODO(crbug.com/1334256): Make base::Value able to hold uint64_t and remove
++ // casts below.
++ res.Set("pswpin", static_cast<int>(pswpin));
++ res.Set("pswpout", static_cast<int>(pswpout));
++ res.Set("pgmajfault", static_cast<int>(pgmajfault));
++
++ NOTIMPLEMENTED();
++
++ return res;
+ }
+
+ } // namespace base
diff --git a/devel/electron31/files/patch-base_process_process__metrics__openbsd.cc b/devel/electron31/files/patch-base_process_process__metrics__openbsd.cc
new file mode 100644
index 000000000000..04d26b4c012a
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_process__metrics__openbsd.cc
@@ -0,0 +1,234 @@
+--- base/process/process_metrics_openbsd.cc.orig 2024-06-18 21:43:17 UTC
++++ base/process/process_metrics_openbsd.cc
+@@ -6,75 +6,50 @@
+
+ #include <stddef.h>
+ #include <stdint.h>
++#include <fcntl.h>
+ #include <sys/param.h>
+ #include <sys/sysctl.h>
++#include <sys/vmmeter.h>
+
++#include <kvm.h>
++
+ #include "base/memory/ptr_util.h"
+ #include "base/types/expected.h"
++#include "base/values.h"
++#include "base/notreached.h"
+
+ namespace base {
+
+-namespace {
++ProcessMetrics::ProcessMetrics(ProcessHandle process) : process_(process) {}
+
+-base::expected<int, ProcessCPUUsageError> GetProcessCPU(pid_t pid) {
++base::expected<TimeDelta, ProcessCPUUsageError>
++ProcessMetrics::GetCumulativeCPUUsage() {
+ struct kinfo_proc info;
+- size_t length;
+- int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid,
+- sizeof(struct kinfo_proc), 0 };
++ size_t length = sizeof(struct kinfo_proc);
++ struct timeval tv;
+
+- if (sysctl(mib, std::size(mib), NULL, &length, NULL, 0) < 0) {
+- return base::unexpected(ProcessCPUUsageError::kSystemError);
+- }
++ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process_,
++ sizeof(struct kinfo_proc), 1 };
+
+- mib[5] = (length / sizeof(struct kinfo_proc));
+-
+ if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0) {
+ return base::unexpected(ProcessCPUUsageError::kSystemError);
+ }
+
+- return base::ok(info.p_pctcpu);
++ tv.tv_sec = info.p_rtime_sec;
++ tv.tv_usec = info.p_rtime_usec;
++
++ return base::ok(Microseconds(TimeValToMicroseconds(tv)));
+ }
+
+-} // namespace
+-
+ // static
+ std::unique_ptr<ProcessMetrics> ProcessMetrics::CreateProcessMetrics(
+ ProcessHandle process) {
+ return WrapUnique(new ProcessMetrics(process));
+ }
+
+-base::expected<double, ProcessCPUUsageError>
+-ProcessMetrics::GetPlatformIndependentCPUUsage() {
+- TimeTicks time = TimeTicks::Now();
+-
+- if (last_cpu_time_.is_zero()) {
+- // First call, just set the last values.
+- last_cpu_time_ = time;
+- return base::ok(0.0);
+- }
+-
+- const base::expected<int, ProcessCPUUsageError> cpu = GetProcessCPU(process_);
+- if (!cpu.has_value()) {
+- return base::unexpected(cpu.error());
+- }
+-
+- last_cpu_time_ = time;
+- return base::ok(double{cpu.value()} / FSCALE * 100.0);
+-}
+-
+-base::expected<TimeDelta, ProcessCPUUsageError>
+-ProcessMetrics::GetCumulativeCPUUsage() {
+- NOTREACHED_IN_MIGRATION();
+- return base::unexpected(ProcessCPUUsageError::kNotImplemented);
+-}
+-
+-ProcessMetrics::ProcessMetrics(ProcessHandle process)
+- : process_(process),
+- last_cpu_(0) {}
+-
+ size_t GetSystemCommitCharge() {
+ int mib[] = { CTL_VM, VM_METER };
+- int pagesize;
++ size_t pagesize;
+ struct vmtotal vmtotal;
+ unsigned long mem_total, mem_free, mem_inactive;
+ size_t len = sizeof(vmtotal);
+@@ -86,9 +61,136 @@ size_t GetSystemCommitCharge() {
+ mem_free = vmtotal.t_free;
+ mem_inactive = vmtotal.t_vm - vmtotal.t_avm;
+
+- pagesize = getpagesize();
++ pagesize = checked_cast<size_t>(getpagesize());
+
+ return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize);
++}
++
++int ProcessMetrics::GetOpenFdCount() const {
++#if 0
++ struct kinfo_file *files;
++ kvm_t *kd = NULL;
++ int total_count = 0;
++ char errbuf[_POSIX2_LINE_MAX];
++
++ if ((kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf)) == NULL)
++ goto out;
++
++ if ((files = kvm_getfiles(kd, KERN_FILE_BYPID, process_,
++ sizeof(struct kinfo_file), &total_count)) == NULL) {
++ total_count = 0;
++ goto out;
++ }
++
++ kvm_close(kd);
++
++out:
++ return total_count;
++#endif
++ return getdtablecount();
++}
++
++int ProcessMetrics::GetOpenFdSoftLimit() const {
++ return getdtablesize();
++// return GetMaxFds();
++}
++
++uint64_t ProcessMetrics::GetVmSwapBytes() const {
++ NOTIMPLEMENTED();
++ return 0;
++}
++
++bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) {
++ NOTIMPLEMENTED_LOG_ONCE();
++ return false;
++}
++
++bool GetSystemDiskInfo(SystemDiskInfo* diskinfo) {
++ NOTIMPLEMENTED();
++ return false;
++}
++
++bool GetVmStatInfo(VmStatInfo* vmstat) {
++ NOTIMPLEMENTED();
++ return false;
++}
++
++int ProcessMetrics::GetIdleWakeupsPerSecond() {
++ NOTIMPLEMENTED();
++ return 0;
++}
++
++Value::Dict SystemMemoryInfoKB::ToDict() const {
++ Value::Dict res;
++ res.Set("total", total);
++ res.Set("free", free);
++ res.Set("available", available);
++ res.Set("buffers", buffers);
++ res.Set("cached", cached);
++ res.Set("active_anon", active_anon);
++ res.Set("inactive_anon", inactive_anon);
++ res.Set("active_file", active_file);
++ res.Set("inactive_file", inactive_file);
++ res.Set("swap_total", swap_total);
++ res.Set("swap_free", swap_free);
++ res.Set("swap_used", swap_total - swap_free);
++ res.Set("dirty", dirty);
++ res.Set("reclaimable", reclaimable);
++
++ NOTIMPLEMENTED();
++
++ return res;
++}
++
++Value::Dict VmStatInfo::ToDict() const {
++ Value::Dict res;
++ res.Set("pswpin", static_cast<int>(pswpin));
++ res.Set("pswpout", static_cast<int>(pswpout));
++ res.Set("pgmajfault", static_cast<int>(pgmajfault));
++
++ NOTIMPLEMENTED();
++
++ return res;
++}
++
++SystemDiskInfo::SystemDiskInfo() {
++ reads = 0;
++ reads_merged = 0;
++ sectors_read = 0;
++ read_time = 0;
++ writes = 0;
++ writes_merged = 0;
++ sectors_written = 0;
++ write_time = 0;
++ io = 0;
++ io_time = 0;
++ weighted_io_time = 0;
++}
++
++SystemDiskInfo::SystemDiskInfo(const SystemDiskInfo&) = default;
++
++SystemDiskInfo& SystemDiskInfo::operator=(const SystemDiskInfo&) = default;
++
++Value::Dict SystemDiskInfo::ToDict() const {
++ Value::Dict res;
++
++ // Write out uint64_t variables as doubles.
++ // Note: this may discard some precision, but for JS there's no other option.
++ res.Set("reads", static_cast<double>(reads));
++ res.Set("reads_merged", static_cast<double>(reads_merged));
++ res.Set("sectors_read", static_cast<double>(sectors_read));
++ res.Set("read_time", static_cast<double>(read_time));
++ res.Set("writes", static_cast<double>(writes));
++ res.Set("writes_merged", static_cast<double>(writes_merged));
++ res.Set("sectors_written", static_cast<double>(sectors_written));
++ res.Set("write_time", static_cast<double>(write_time));
++ res.Set("io", static_cast<double>(io));
++ res.Set("io_time", static_cast<double>(io_time));
++ res.Set("weighted_io_time", static_cast<double>(weighted_io_time));
++
++ NOTIMPLEMENTED();
++
++ return res;
+ }
+
+ } // namespace base
diff --git a/devel/electron31/files/patch-base_process_process__metrics__posix.cc b/devel/electron31/files/patch-base_process_process__metrics__posix.cc
new file mode 100644
index 000000000000..ba800ec06711
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_process__metrics__posix.cc
@@ -0,0 +1,20 @@
+--- base/process/process_metrics_posix.cc.orig 2023-08-10 01:48:31 UTC
++++ base/process/process_metrics_posix.cc
+@@ -21,6 +21,8 @@
+
+ #if BUILDFLAG(IS_APPLE)
+ #include <malloc/malloc.h>
++#elif BUILDFLAG(IS_OPENBSD)
++#include <stdlib.h>
+ #else
+ #include <malloc.h>
+ #endif
+@@ -134,7 +136,7 @@ size_t ProcessMetrics::GetMallocUsage() {
+ return stats.size_in_use;
+ #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
+ return GetMallocUsageMallinfo();
+-#elif BUILDFLAG(IS_FUCHSIA)
++#elif BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // TODO(fuchsia): Not currently exposed. https://crbug.com/735087.
+ return 0;
+ #endif
diff --git a/devel/electron31/files/patch-base_process_process__metrics__unittest.cc b/devel/electron31/files/patch-base_process_process__metrics__unittest.cc
new file mode 100644
index 000000000000..7329098e81ef
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_process__metrics__unittest.cc
@@ -0,0 +1,12 @@
+--- base/process/process_metrics_unittest.cc.orig 2024-06-18 21:43:17 UTC
++++ base/process/process_metrics_unittest.cc
+@@ -62,7 +62,8 @@
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_APPLE)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_APPLE) || \
++ BUILDFLAG(IS_BSD)
+ #define ENABLE_CPU_TESTS 1
+ #else
+ #define ENABLE_CPU_TESTS 0
diff --git a/devel/electron31/files/patch-base_process_process__posix.cc b/devel/electron31/files/patch-base_process_process__posix.cc
new file mode 100644
index 000000000000..6082e8dc4fa4
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_process__posix.cc
@@ -0,0 +1,94 @@
+--- base/process/process_posix.cc.orig 2024-06-18 21:43:17 UTC
++++ base/process/process_posix.cc
+@@ -23,10 +23,15 @@
+ #include "base/trace_event/base_tracing.h"
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include <sys/event.h>
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#endif
++
+ #if BUILDFLAG(CLANG_PROFILING)
+ #include "base/test/clang_profiling.h"
+ #endif
+@@ -99,7 +104,7 @@ bool WaitpidWithTimeout(base::ProcessHandle handle,
+ }
+ #endif
+
+-#if BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // Using kqueue on Mac so that we can wait on non-child processes.
+ // We can't use kqueues on child processes because we need to reap
+ // our own children using wait.
+@@ -376,7 +381,7 @@ bool Process::WaitForExitWithTimeoutImpl(base::Process
+ const bool exited = (parent_pid < 0);
+
+ if (!exited && parent_pid != our_pid) {
+-#if BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // On Mac we can wait on non child processes.
+ return WaitForSingleNonChildProcess(handle, timeout);
+ #else
+@@ -413,7 +418,56 @@ int Process::GetOSPriority() const {
+
+ int Process::GetOSPriority() const {
+ DCHECK(IsValid());
++// avoid pledge(2) violation
++#if BUILDFLAG(IS_BSD)
++ return 0;
++#else
+ return getpriority(PRIO_PROCESS, static_cast<id_t>(process_));
++#endif
+ }
++
++Time Process::CreationTime() const {
++// avoid ps pledge in the network process
++#if !BUILDFLAG(IS_BSD)
++ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid(),
++ sizeof(struct kinfo_proc), 0 };
++ struct kinfo_proc *info = nullptr;
++ size_t info_size;
++#endif
++ Time ct = Time();
++
++#if !BUILDFLAG(IS_BSD)
++ if (sysctl(mib, std::size(mib), NULL, &info_size, NULL, 0) < 0)
++ goto out;
++
++ mib[5] = (info_size / sizeof(struct kinfo_proc));
++ if ((info = reinterpret_cast<kinfo_proc*>(malloc(info_size))) == NULL)
++ goto out;
++
++ if (sysctl(mib, std::size(mib), info, &info_size, NULL, 0) < 0)
++ goto out;
++
++ ct = Time::FromTimeT(info->p_ustart_sec);
++
++out:
++ if (info)
++ free(info);
++#endif
++ return ct;
++}
++
++#if BUILDFLAG(IS_BSD)
++Process::Priority Process::GetPriority() const {
++ return Priority::kUserBlocking;
++}
++
++bool Process::SetPriority(Priority priority) {
++ return false;
++}
++
++bool Process::CanSetPriority() {
++ return false;
++}
++#endif
+
+ } // namespace base
diff --git a/devel/electron31/files/patch-base_process_process__unittest.cc b/devel/electron31/files/patch-base_process_process__unittest.cc
new file mode 100644
index 000000000000..f9d390879c35
--- /dev/null
+++ b/devel/electron31/files/patch-base_process_process__unittest.cc
@@ -0,0 +1,11 @@
+--- base/process/process_unittest.cc.orig 2024-04-15 20:33:42 UTC
++++ base/process/process_unittest.cc
+@@ -199,7 +199,7 @@ TEST_F(ProcessTest, CreationTimeOtherProcess) {
+ // was spawned and a time recorded after it was spawned. However, since the
+ // base::Time and process creation clocks don't match, tolerate some error.
+ constexpr base::TimeDelta kTolerance =
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On Linux, process creation time is relative to boot time which has a
+ // 1-second resolution. Tolerate 1 second for the imprecise boot time and
+ // 100 ms for the imprecise clock.
diff --git a/devel/electron31/files/patch-base_profiler_module__cache.cc b/devel/electron31/files/patch-base_profiler_module__cache.cc
new file mode 100644
index 000000000000..8008afc7ff0f
--- /dev/null
+++ b/devel/electron31/files/patch-base_profiler_module__cache.cc
@@ -0,0 +1,11 @@
+--- base/profiler/module_cache.cc.orig 2024-04-15 20:33:42 UTC
++++ base/profiler/module_cache.cc
+@@ -38,7 +38,7 @@ std::string TransformModuleIDToSymbolServerFormat(std:
+ // Android and Linux Chrome builds use the "breakpad" format to index their
+ // build id, so we transform the build id for these platforms. All other
+ // platforms keep their symbols indexed by the original build ID.
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Linux ELF module IDs are 160bit integers, which we need to mangle
+ // down to 128bit integers to match the id that Breakpad outputs.
+ // Example on version '66.0.3359.170' x64:
diff --git a/devel/electron31/files/patch-base_profiler_sampling__profiler__thread__token.cc b/devel/electron31/files/patch-base_profiler_sampling__profiler__thread__token.cc
new file mode 100644
index 000000000000..b7ead036a4ad
--- /dev/null
+++ b/devel/electron31/files/patch-base_profiler_sampling__profiler__thread__token.cc
@@ -0,0 +1,20 @@
+--- base/profiler/sampling_profiler_thread_token.cc.orig 2024-04-15 20:33:42 UTC
++++ base/profiler/sampling_profiler_thread_token.cc
+@@ -6,7 +6,7 @@
+
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <pthread.h>
+
+ #include "base/profiler/stack_base_address_posix.h"
+@@ -18,7 +18,7 @@ SamplingProfilerThreadToken GetSamplingProfilerCurrent
+ PlatformThreadId id = PlatformThread::CurrentId();
+ #if BUILDFLAG(IS_ANDROID)
+ return {id, pthread_self()};
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::optional<uintptr_t> maybe_stack_base =
+ GetThreadStackBaseAddress(id, pthread_self());
+ return {id, maybe_stack_base};
diff --git a/devel/electron31/files/patch-base_profiler_sampling__profiler__thread__token.h b/devel/electron31/files/patch-base_profiler_sampling__profiler__thread__token.h
new file mode 100644
index 000000000000..40fee797f377
--- /dev/null
+++ b/devel/electron31/files/patch-base_profiler_sampling__profiler__thread__token.h
@@ -0,0 +1,20 @@
+--- base/profiler/sampling_profiler_thread_token.h.orig 2024-04-15 20:33:42 UTC
++++ base/profiler/sampling_profiler_thread_token.h
+@@ -13,7 +13,7 @@
+
+ #if BUILDFLAG(IS_ANDROID)
+ #include <pthread.h>
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <stdint.h>
+ #endif
+
+@@ -27,7 +27,7 @@ struct SamplingProfilerThreadToken {
+ PlatformThreadId id;
+ #if BUILDFLAG(IS_ANDROID)
+ pthread_t pthread_id;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Due to the sandbox, we can only retrieve the stack base address for the
+ // current thread. We must grab it during
+ // GetSamplingProfilerCurrentThreadToken() and not try to get it later.
diff --git a/devel/electron31/files/patch-base_profiler_stack__base__address__posix.cc b/devel/electron31/files/patch-base_profiler_stack__base__address__posix.cc
new file mode 100644
index 000000000000..2da2b3e7aa72
--- /dev/null
+++ b/devel/electron31/files/patch-base_profiler_stack__base__address__posix.cc
@@ -0,0 +1,59 @@
+--- base/profiler/stack_base_address_posix.cc.orig 2024-04-15 20:33:42 UTC
++++ base/profiler/stack_base_address_posix.cc
+@@ -17,6 +17,10 @@
+ #include "base/files/scoped_file.h"
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include <pthread_np.h>
++#endif
++
+ #if BUILDFLAG(IS_CHROMEOS)
+ extern "C" void* __libc_stack_end;
+ #endif
+@@ -45,7 +49,21 @@ uintptr_t GetThreadStackBaseAddressImpl(pthread_t pthr
+
+ #if !BUILDFLAG(IS_LINUX)
+ uintptr_t GetThreadStackBaseAddressImpl(pthread_t pthread_id) {
++#if BUILDFLAG(IS_OPENBSD)
++ stack_t ss;
++ void *address;
++ size_t size;
++ if (pthread_stackseg_np(pthread_id, &ss) != 0)
++ return 0;
++ size = ss.ss_size;
++ address = (void*)((size_t) ss.ss_sp - ss.ss_size);
++#else
+ pthread_attr_t attr;
++#if BUILDFLAG(IS_FREEBSD)
++ int result;
++ pthread_attr_init(&attr);
++ pthread_attr_get_np(pthread_id, &attr);
++#else
+ // pthread_getattr_np will crash on ChromeOS & Linux if we are in the sandbox
+ // and pthread_id refers to a different thread, due to the use of
+ // sched_getaffinity().
+@@ -58,12 +76,14 @@ uintptr_t GetThreadStackBaseAddressImpl(pthread_t pthr
+ << logging::SystemErrorCodeToString(result);
+ // See crbug.com/617730 for limitations of this approach on Linux-like
+ // systems.
++#endif
+ void* address;
+ size_t size;
+ result = pthread_attr_getstack(&attr, &address, &size);
+ CHECK_EQ(result, 0) << "pthread_attr_getstack returned "
+ << logging::SystemErrorCodeToString(result);
+ pthread_attr_destroy(&attr);
++#endif
+ const uintptr_t base_address = reinterpret_cast<uintptr_t>(address) + size;
+ return base_address;
+ }
+@@ -80,7 +100,7 @@ std::optional<uintptr_t> GetThreadStackBaseAddress(Pla
+ // trying to work around the problem.
+ return std::nullopt;
+ #else
+- const bool is_main_thread = id == GetCurrentProcId();
++ const bool is_main_thread = id == checked_cast<PlatformThreadId>(GetCurrentProcId());
+ if (is_main_thread) {
+ #if BUILDFLAG(IS_ANDROID)
+ // The implementation of pthread_getattr_np() in Bionic reads proc/self/maps
diff --git a/devel/electron31/files/patch-base_profiler_stack__sampling__profiler__test__util.cc b/devel/electron31/files/patch-base_profiler_stack__sampling__profiler__test__util.cc
new file mode 100644
index 000000000000..9213b57305bf
--- /dev/null
+++ b/devel/electron31/files/patch-base_profiler_stack__sampling__profiler__test__util.cc
@@ -0,0 +1,11 @@
+--- base/profiler/stack_sampling_profiler_test_util.cc.orig 2024-06-18 21:43:17 UTC
++++ base/profiler/stack_sampling_profiler_test_util.cc
+@@ -42,7 +42,7 @@
+ // Fortunately, it provides _alloca, which functions identically.
+ #include <malloc.h>
+ #define alloca _alloca
+-#else
++#elif !BUILDFLAG(IS_BSD)
+ #include <alloca.h>
+ #endif
+
diff --git a/devel/electron31/files/patch-base_profiler_stack__sampling__profiler__unittest.cc b/devel/electron31/files/patch-base_profiler_stack__sampling__profiler__unittest.cc
new file mode 100644
index 000000000000..744f58cf64b5
--- /dev/null
+++ b/devel/electron31/files/patch-base_profiler_stack__sampling__profiler__unittest.cc
@@ -0,0 +1,11 @@
+--- base/profiler/stack_sampling_profiler_unittest.cc.orig 2024-06-18 21:43:17 UTC
++++ base/profiler/stack_sampling_profiler_unittest.cc
+@@ -43,7 +43,7 @@
+
+ #include <intrin.h>
+ #include <malloc.h>
+-#else
++#elif !BUILDFLAG(IS_BSD)
+ #include <alloca.h>
+ #endif
+
diff --git a/devel/electron31/files/patch-base_profiler_thread__delegate__posix.cc b/devel/electron31/files/patch-base_profiler_thread__delegate__posix.cc
new file mode 100644
index 000000000000..e4b87e39115a
--- /dev/null
+++ b/devel/electron31/files/patch-base_profiler_thread__delegate__posix.cc
@@ -0,0 +1,20 @@
+--- base/profiler/thread_delegate_posix.cc.orig 2024-06-18 21:43:17 UTC
++++ base/profiler/thread_delegate_posix.cc
+@@ -19,7 +19,7 @@
+ #include "base/process/process_handle.h"
+ #include "build/build_config.h"
+
+-#if !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
++#if !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
+ #include "base/profiler/stack_base_address_posix.h"
+ #endif
+
+@@ -28,7 +28,7 @@ std::unique_ptr<ThreadDelegatePosix> ThreadDelegatePos
+ std::unique_ptr<ThreadDelegatePosix> ThreadDelegatePosix::Create(
+ SamplingProfilerThreadToken thread_token) {
+ std::optional<uintptr_t> base_address;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base_address = thread_token.stack_base_address;
+ #else
+ base_address =
diff --git a/devel/electron31/files/patch-base_rand__util.h b/devel/electron31/files/patch-base_rand__util.h
new file mode 100644
index 000000000000..4c4211dd22ce
--- /dev/null
+++ b/devel/electron31/files/patch-base_rand__util.h
@@ -0,0 +1,11 @@
+--- base/rand_util.h.orig 2024-06-18 21:43:17 UTC
++++ base/rand_util.h
+@@ -147,7 +147,7 @@ void RandomShuffle(Itr first, Itr last) {
+ std::shuffle(first, last, RandomBitGenerator());
+ }
+
+-#if BUILDFLAG(IS_POSIX)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_BSD)
+ BASE_EXPORT int GetUrandomFD();
+ #endif
+
diff --git a/devel/electron31/files/patch-base_rand__util__posix.cc b/devel/electron31/files/patch-base_rand__util__posix.cc
new file mode 100644
index 000000000000..b23880501f3f
--- /dev/null
+++ b/devel/electron31/files/patch-base_rand__util__posix.cc
@@ -0,0 +1,62 @@
+--- base/rand_util_posix.cc.orig 2024-06-18 21:43:17 UTC
++++ base/rand_util_posix.cc
+@@ -28,7 +28,7 @@
+ #include "base/time/time.h"
+ #include "build/build_config.h"
+
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_NACL)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_BSD)
+ #include "third_party/lss/linux_syscall_support.h"
+ #elif BUILDFLAG(IS_MAC)
+ // TODO(crbug.com/40641285): Waiting for this header to appear in the iOS SDK.
+@@ -45,6 +45,7 @@ namespace {
+
+ namespace {
+
++#if !BUILDFLAG(IS_BSD)
+ #if BUILDFLAG(IS_AIX)
+ // AIX has no 64-bit support for O_CLOEXEC.
+ static constexpr int kOpenFlags = O_RDONLY;
+@@ -69,10 +70,11 @@ class URandomFd {
+ private:
+ const int fd_;
+ };
++#endif
+
+ #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+ BUILDFLAG(IS_ANDROID)) && \
+- !BUILDFLAG(IS_NACL)
++ !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_BSD)
+ // TODO(pasko): Unify reading kernel version numbers in:
+ // mojo/core/channel_linux.cc
+ // chrome/browser/android/seccomp_support_detector.cc
+@@ -182,6 +184,7 @@ void RandBytesInternal(span<uint8_t> output, bool avoi
+ namespace {
+
+ void RandBytesInternal(span<uint8_t> output, bool avoid_allocation) {
++#if !BUILDFLAG(IS_BSD)
+ #if !BUILDFLAG(IS_NACL)
+ // The BoringSSL experiment takes priority over everything else.
+ if (!avoid_allocation && internal::UseBoringSSLForRandBytes()) {
+@@ -220,6 +223,9 @@ void RandBytesInternal(span<uint8_t> output, bool avoi
+ const int urandom_fd = GetUrandomFD();
+ const bool success = ReadFromFD(urandom_fd, as_writable_chars(output));
+ CHECK(success);
++#else
++ arc4random_buf(output.data(), output.size());
++#endif
+ }
+
+ } // namespace
+@@ -239,9 +245,11 @@ void RandBytes(span<uint8_t> output) {
+ RandBytesInternal(output, /*avoid_allocation=*/false);
+ }
+
++#if !BUILDFLAG(IS_BSD)
+ int GetUrandomFD() {
+ static NoDestructor<URandomFd> urandom_fd;
+ return urandom_fd->fd();
+ }
++#endif
+
+ } // namespace base
diff --git a/devel/electron31/files/patch-base_strings_safe__sprintf__unittest.cc b/devel/electron31/files/patch-base_strings_safe__sprintf__unittest.cc
new file mode 100644
index 000000000000..b3ca97eb25aa
--- /dev/null
+++ b/devel/electron31/files/patch-base_strings_safe__sprintf__unittest.cc
@@ -0,0 +1,18 @@
+--- base/strings/safe_sprintf_unittest.cc.orig 2024-06-18 21:43:17 UTC
++++ base/strings/safe_sprintf_unittest.cc
+@@ -740,6 +740,7 @@ TEST(SafeSPrintfTest, EmbeddedNul) {
+ #endif
+ }
+
++#if !BUILDFLAG(IS_BSD)
+ TEST(SafeSPrintfTest, EmitNULL) {
+ char buf[40];
+ #if defined(__GNUC__)
+@@ -756,6 +757,7 @@ TEST(SafeSPrintfTest, EmitNULL) {
+ #pragma GCC diagnostic pop
+ #endif
+ }
++#endif
+
+ TEST(SafeSPrintfTest, PointerSize) {
+ // The internal data representation is a 64bit value, independent of the
diff --git a/devel/electron31/files/patch-base_synchronization_lock__impl.h b/devel/electron31/files/patch-base_synchronization_lock__impl.h
new file mode 100644
index 000000000000..16e08cc61c95
--- /dev/null
+++ b/devel/electron31/files/patch-base_synchronization_lock__impl.h
@@ -0,0 +1,23 @@
+--- base/synchronization/lock_impl.h.orig 2024-06-18 21:43:18 UTC
++++ base/synchronization/lock_impl.h
+@@ -106,6 +106,10 @@ void LockImpl::Unlock() {
+ }
+
+ #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_FREEBSD)
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wthread-safety-analysis"
++#endif
+
+ #if DCHECK_IS_ON()
+ BASE_EXPORT void dcheck_trylock_result(int rv);
+@@ -126,6 +130,9 @@ void LockImpl::Unlock() {
+ dcheck_unlock_result(rv);
+ #endif
+ }
++#if BUILDFLAG(IS_FREEBSD)
++#pragma GCC diagnostic pop
++#endif
+ #endif
+
+ // This is an implementation used for AutoLock templated on the lock type.
diff --git a/devel/electron31/files/patch-base_syslog__logging.cc b/devel/electron31/files/patch-base_syslog__logging.cc
new file mode 100644
index 000000000000..0ef1ec652967
--- /dev/null
+++ b/devel/electron31/files/patch-base_syslog__logging.cc
@@ -0,0 +1,20 @@
+--- base/syslog_logging.cc.orig 2024-04-15 20:33:42 UTC
++++ base/syslog_logging.cc
+@@ -17,7 +17,7 @@
+ #include "base/strings/string_util.h"
+ #include "base/win/scoped_handle.h"
+ #include "base/win/win_util.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // <syslog.h> defines LOG_INFO, LOG_WARNING macros that could conflict with
+ // base::LOG_INFO, base::LOG_WARNING.
+ #include <syslog.h>
+@@ -149,7 +149,7 @@ EventLogMessage::~EventLogMessage() {
+
+ if (user_sid != nullptr)
+ ::LocalFree(user_sid);
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kEventSource[] = "chrome";
+ openlog(kEventSource, LOG_NOWAIT | LOG_PID, LOG_USER);
+ // We can't use the defined names for the logging severity from syslog.h
diff --git a/devel/electron31/files/patch-base_system_sys__info.cc b/devel/electron31/files/patch-base_system_sys__info.cc
new file mode 100644
index 000000000000..2759f3169b2b
--- /dev/null
+++ b/devel/electron31/files/patch-base_system_sys__info.cc
@@ -0,0 +1,11 @@
+--- base/system/sys_info.cc.orig 2023-11-29 21:39:40 UTC
++++ base/system/sys_info.cc
+@@ -225,7 +225,7 @@ void SysInfo::GetHardwareInfo(base::OnceCallback<void(
+ #endif
+
+ void SysInfo::GetHardwareInfo(base::OnceCallback<void(HardwareInfo)> callback) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ constexpr base::TaskTraits kTraits = {base::MayBlock()};
+ #else
+ constexpr base::TaskTraits kTraits = {};
diff --git a/devel/electron31/files/patch-base_system_sys__info.h b/devel/electron31/files/patch-base_system_sys__info.h
new file mode 100644
index 000000000000..ff9fe72b5059
--- /dev/null
+++ b/devel/electron31/files/patch-base_system_sys__info.h
@@ -0,0 +1,20 @@
+--- base/system/sys_info.h.orig 2024-06-18 21:43:18 UTC
++++ base/system/sys_info.h
+@@ -325,6 +325,8 @@ class BASE_EXPORT SysInfo {
+ static void ResetCpuSecurityMitigationsEnabledForTesting();
+ #endif
+
++ static uint64_t MaxSharedMemorySize();
++
+ private:
+ friend class test::ScopedAmountOfPhysicalMemoryOverride;
+ FRIEND_TEST_ALL_PREFIXES(SysInfoTest, AmountOfAvailablePhysicalMemory);
+@@ -337,7 +339,7 @@ class BASE_EXPORT SysInfo {
+ static HardwareInfo GetHardwareInfoSync();
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ static uint64_t AmountOfAvailablePhysicalMemory(
+ const SystemMemoryInfoKB& meminfo);
+ #endif
diff --git a/devel/electron31/files/patch-base_system_sys__info__freebsd.cc b/devel/electron31/files/patch-base_system_sys__info__freebsd.cc
new file mode 100644
index 000000000000..e2318543d173
--- /dev/null
+++ b/devel/electron31/files/patch-base_system_sys__info__freebsd.cc
@@ -0,0 +1,115 @@
+--- base/system/sys_info_freebsd.cc.orig 2024-06-18 21:43:18 UTC
++++ base/system/sys_info_freebsd.cc
+@@ -9,30 +9,106 @@
+ #include <sys/sysctl.h>
+
+ #include "base/notreached.h"
++#include "base/process/process_metrics.h"
++#include "base/strings/string_util.h"
+
+ namespace base {
+
+-int64_t SysInfo::AmountOfPhysicalMemoryImpl() {
+- int pages, page_size;
++int SysInfo::NumberOfProcessors() {
++ int mib[] = {CTL_HW, HW_NCPU};
++ int ncpu;
++ size_t size = sizeof(ncpu);
++ if (sysctl(mib, std::size(mib), &ncpu, &size, NULL, 0) < 0) {
++ NOTREACHED();
++ return 1;
++ }
++ return ncpu;
++}
++
++uint64_t SysInfo::AmountOfPhysicalMemoryImpl() {
++ int pages, page_size, r = 0;
+ size_t size = sizeof(pages);
+- sysctlbyname("vm.stats.vm.v_page_count", &pages, &size, NULL, 0);
+- sysctlbyname("vm.stats.vm.v_page_size", &page_size, &size, NULL, 0);
+- if (pages == -1 || page_size == -1) {
++
++ if (r == 0)
++ r = sysctlbyname("vm.stats.vm.v_page_count", &pages, &size, NULL, 0);
++ if (r == 0)
++ r = sysctlbyname("vm.stats.vm.v_page_size", &page_size, &size, NULL, 0);
++
++ if (r == -1) {
+ NOTREACHED_IN_MIGRATION();
+ return 0;
+ }
+- return static_cast<int64_t>(pages) * page_size;
++
++ return static_cast<uint64_t>(pages) * page_size;
+ }
+
++uint64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() {
++ int page_size, r = 0;
++ unsigned int pgfree, pginact, pgcache;
++ size_t size = sizeof(page_size);
++ size_t szpg = sizeof(pgfree);
++
++ if (r == 0)
++ r = sysctlbyname("vm.stats.vm.v_page_size", &page_size, &size, NULL, 0);
++ if (r == 0)
++ r = sysctlbyname("vm.stats.vm.v_free_count", &pgfree, &szpg, NULL, 0);
++ if (r == 0)
++ r = sysctlbyname("vm.stats.vm.v_inactive_count", &pginact, &szpg, NULL, 0);
++ if (r == 0)
++ r = sysctlbyname("vm.stats.vm.v_cache_count", &pgcache, &szpg, NULL, 0);
++
++ if (r == -1) {
++ NOTREACHED();
++ return 0;
++ }
++
++ return static_cast<uint64_t>((pgfree + pginact + pgcache) * page_size);
++}
++
+ // static
++uint64_t SysInfo::AmountOfAvailablePhysicalMemory(const SystemMemoryInfoKB& info) {
++ uint64_t res_kb = info.available != 0
++ ? info.available - info.active_file
++ : info.free + info.reclaimable + info.inactive_file;
++ return res_kb * 1024;
++}
++
++// static
++std::string SysInfo::CPUModelName() {
++ int mib[] = { CTL_HW, HW_MODEL };
++ char name[256];
++ size_t size = std::size(name);
++
++ if (sysctl(mib, std::size(mib), &name, &size, NULL, 0) == 0) {
++ return name;
++ }
++
++ return std::string();
++}
++
++// static
+ uint64_t SysInfo::MaxSharedMemorySize() {
+ size_t limit;
+ size_t size = sizeof(limit);
++
+ if (sysctlbyname("kern.ipc.shmmax", &limit, &size, NULL, 0) < 0) {
+ NOTREACHED_IN_MIGRATION();
+ return 0;
+ }
++
+ return static_cast<uint64_t>(limit);
++}
++
++SysInfo::HardwareInfo SysInfo::GetHardwareInfoSync() {
++ HardwareInfo info;
++
++ info.manufacturer = "FreeBSD";
++ info.model = HardwareModelName();
++
++ DCHECK(IsStringUTF8(info.manufacturer));
++ DCHECK(IsStringUTF8(info.model));
++
++ return info;
+ }
+
+ } // namespace base
diff --git a/devel/electron31/files/patch-base_system_sys__info__openbsd.cc b/devel/electron31/files/patch-base_system_sys__info__openbsd.cc
new file mode 100644
index 000000000000..c137d4d08c3f
--- /dev/null
+++ b/devel/electron31/files/patch-base_system_sys__info__openbsd.cc
@@ -0,0 +1,94 @@
+--- base/system/sys_info_openbsd.cc.orig 2024-06-18 21:43:18 UTC
++++ base/system/sys_info_openbsd.cc
+@@ -3,7 +3,6 @@
+ // found in the LICENSE file.
+
+ #include "base/system/sys_info.h"
+-
+ #include <stddef.h>
+ #include <stdint.h>
+ #include <sys/param.h>
+@@ -12,6 +11,7 @@
+
+ #include "base/notreached.h"
+ #include "base/posix/sysctl.h"
++#include "base/strings/string_util.h"
+
+ namespace {
+
+@@ -27,9 +27,14 @@ namespace base {
+
+ namespace base {
+
++// pledge(2)
++uint64_t aofpmem = 0;
++uint64_t shmmax = 0;
++char cpumodel[256];
++
+ // static
+ int SysInfo::NumberOfProcessors() {
+- int mib[] = {CTL_HW, HW_NCPU};
++ int mib[] = {CTL_HW, HW_NCPUONLINE};
+ int ncpu;
+ size_t size = sizeof(ncpu);
+ if (sysctl(mib, std::size(mib), &ncpu, &size, NULL, 0) < 0) {
+@@ -41,10 +46,26 @@ uint64_t SysInfo::AmountOfPhysicalMemoryImpl() {
+
+ // static
+ uint64_t SysInfo::AmountOfPhysicalMemoryImpl() {
+- return AmountOfMemory(_SC_PHYS_PAGES);
++ // pledge(2)
++ if (!aofpmem)
++ aofpmem = AmountOfMemory(_SC_PHYS_PAGES);
++ return aofpmem;
+ }
+
+ // static
++std::string SysInfo::CPUModelName() {
++ int mib[] = {CTL_HW, HW_MODEL};
++ size_t len = std::size(cpumodel);
++
++ if (cpumodel[0] == '\0') {
++ if (sysctl(mib, std::size(mib), cpumodel, &len, NULL, 0) < 0)
++ return std::string();
++ }
++
++ return std::string(cpumodel, len - 1);
++}
++
++// static
+ uint64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() {
+ // We should add inactive file-backed memory also but there is no such
+ // information from OpenBSD unfortunately.
+@@ -56,16 +77,28 @@ uint64_t SysInfo::MaxSharedMemorySize() {
+ int mib[] = {CTL_KERN, KERN_SHMINFO, KERN_SHMINFO_SHMMAX};
+ size_t limit;
+ size_t size = sizeof(limit);
++ // pledge(2)
++ if (shmmax)
++ goto out;
+ if (sysctl(mib, std::size(mib), &limit, &size, NULL, 0) < 0) {
+ NOTREACHED_IN_MIGRATION();
+ return 0;
+ }
+- return static_cast<uint64_t>(limit);
++ shmmax = static_cast<uint64_t>(limit);
++out:
++ return shmmax;
+ }
+
+ // static
+-std::string SysInfo::CPUModelName() {
+- return StringSysctl({CTL_HW, HW_MODEL}).value();
++SysInfo::HardwareInfo SysInfo::GetHardwareInfoSync() {
++ HardwareInfo info;
++ // Set the manufacturer to "OpenBSD" and the model to
++ // an empty string.
++ info.manufacturer = "OpenBSD";
++ info.model = HardwareModelName();
++ DCHECK(IsStringUTF8(info.manufacturer));
++ DCHECK(IsStringUTF8(info.model));
++ return info;
+ }
+
+ } // namespace base
diff --git a/devel/electron31/files/patch-base_system_sys__info__posix.cc b/devel/electron31/files/patch-base_system_sys__info__posix.cc
new file mode 100644
index 000000000000..d304bed843e0
--- /dev/null
+++ b/devel/electron31/files/patch-base_system_sys__info__posix.cc
@@ -0,0 +1,29 @@
+--- base/system/sys_info_posix.cc.orig 2024-04-15 20:33:42 UTC
++++ base/system/sys_info_posix.cc
+@@ -118,7 +118,7 @@ namespace base {
+
+ namespace base {
+
+-#if !BUILDFLAG(IS_OPENBSD)
++#if !BUILDFLAG(IS_BSD)
+ // static
+ int SysInfo::NumberOfProcessors() {
+ #if BUILDFLAG(IS_MAC)
+@@ -175,7 +175,7 @@ int SysInfo::NumberOfProcessors() {
+
+ return cached_num_cpus;
+ }
+-#endif // !BUILDFLAG(IS_OPENBSD)
++#endif // !BUILDFLAG(IS_BSD)
+
+ // static
+ uint64_t SysInfo::AmountOfVirtualMemory() {
+@@ -265,6 +265,8 @@ std::string SysInfo::OperatingSystemArchitecture() {
+ arch = "x86";
+ } else if (arch == "amd64") {
+ arch = "x86_64";
++ } else if (arch == "arm64") {
++ arch = "aarch64";
+ } else if (std::string(info.sysname) == "AIX") {
+ arch = "ppc64";
+ }
diff --git a/devel/electron31/files/patch-base_system_sys__info__unittest.cc b/devel/electron31/files/patch-base_system_sys__info__unittest.cc
new file mode 100644
index 000000000000..b25a772420b5
--- /dev/null
+++ b/devel/electron31/files/patch-base_system_sys__info__unittest.cc
@@ -0,0 +1,20 @@
+--- base/system/sys_info_unittest.cc.orig 2024-04-15 20:33:42 UTC
++++ base/system/sys_info_unittest.cc
+@@ -264,12 +264,16 @@ TEST_F(SysInfoTest, GetHardwareInfo) {
+ EXPECT_TRUE(IsStringUTF8(hardware_info->model));
+ bool empty_result_expected =
+ #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || \
++ BUILDFLAG(IS_BSD)
+ false;
+ #else
+ true;
+ #endif
+ EXPECT_EQ(hardware_info->manufacturer.empty(), empty_result_expected);
++#if BUILDFLAG(IS_BSD)
++ empty_result_expected = true;
++#endif
+ EXPECT_EQ(hardware_info->model.empty(), empty_result_expected);
+ }
+
diff --git a/devel/electron31/files/patch-base_task_thread__pool_environment__config__unittest.cc b/devel/electron31/files/patch-base_task_thread__pool_environment__config__unittest.cc
new file mode 100644
index 000000000000..abb639bc986d
--- /dev/null
+++ b/devel/electron31/files/patch-base_task_thread__pool_environment__config__unittest.cc
@@ -0,0 +1,11 @@
+--- base/task/thread_pool/environment_config_unittest.cc.orig 2022-08-31 12:19:35 UTC
++++ base/task/thread_pool/environment_config_unittest.cc
+@@ -15,7 +15,7 @@ TEST(ThreadPoolEnvironmentConfig, CanUseBackgroundPrio
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE)
+ EXPECT_TRUE(CanUseBackgroundThreadTypeForWorkerThread());
+ #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_NACL)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_NACL) || BUILDFLAG(IS_BSD)
+ EXPECT_FALSE(CanUseBackgroundThreadTypeForWorkerThread());
+ #else
+ #error Platform doesn't match any block
diff --git a/devel/electron31/files/patch-base_test_launcher_test__launcher.cc b/devel/electron31/files/patch-base_test_launcher_test__launcher.cc
new file mode 100644
index 000000000000..62ef8c11cf34
--- /dev/null
+++ b/devel/electron31/files/patch-base_test_launcher_test__launcher.cc
@@ -0,0 +1,10 @@
+--- base/test/launcher/test_launcher.cc.orig 2024-06-18 21:43:18 UTC
++++ base/test/launcher/test_launcher.cc
+@@ -74,6 +74,7 @@
+ #include "testing/gtest/include/gtest/gtest.h"
+
+ #if BUILDFLAG(IS_POSIX)
++#include <signal.h>
+ #include <fcntl.h>
+
+ #include "base/files/file_descriptor_watcher_posix.h"
diff --git a/devel/electron31/files/patch-base_test_test__file__util__linux.cc b/devel/electron31/files/patch-base_test_test__file__util__linux.cc
new file mode 100644
index 000000000000..a64bf500d0dd
--- /dev/null
+++ b/devel/electron31/files/patch-base_test_test__file__util__linux.cc
@@ -0,0 +1,13 @@
+--- base/test/test_file_util_linux.cc.orig 2023-10-19 19:57:58 UTC
++++ base/test/test_file_util_linux.cc
+@@ -54,8 +54,10 @@ bool EvictFileFromSystemCache(const FilePath& file) {
+ return false;
+ if (fdatasync(fd.get()) != 0)
+ return false;
++#if !BUILDFLAG(IS_BSD)
+ if (posix_fadvise(fd.get(), 0, 0, POSIX_FADV_DONTNEED) != 0)
+ return false;
++#endif
+ return true;
+ }
+
diff --git a/devel/electron31/files/patch-base_test_test__file__util__posix.cc b/devel/electron31/files/patch-base_test_test__file__util__posix.cc
new file mode 100644
index 000000000000..c276024ce5f5
--- /dev/null
+++ b/devel/electron31/files/patch-base_test_test__file__util__posix.cc
@@ -0,0 +1,11 @@
+--- base/test/test_file_util_posix.cc.orig 2024-06-18 21:43:18 UTC
++++ base/test/test_file_util_posix.cc
+@@ -91,7 +91,7 @@ void SyncPageCacheToDisk() {
+ }
+
+ #if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_APPLE) && \
+- !BUILDFLAG(IS_ANDROID)
++ !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_BSD)
+ bool EvictFileFromSystemCache(const FilePath& file) {
+ // There doesn't seem to be a POSIX way to cool the disk cache.
+ NOTIMPLEMENTED();
diff --git a/devel/electron31/files/patch-base_threading_hang__watcher.cc b/devel/electron31/files/patch-base_threading_hang__watcher.cc
new file mode 100644
index 000000000000..f728309dcbd4
--- /dev/null
+++ b/devel/electron31/files/patch-base_threading_hang__watcher.cc
@@ -0,0 +1,11 @@
+--- base/threading/hang_watcher.cc.orig 2024-04-15 20:33:42 UTC
++++ base/threading/hang_watcher.cc
+@@ -332,7 +332,7 @@ void HangWatcher::InitializeOnMainThread(ProcessType p
+
+ bool enable_hang_watcher = base::FeatureList::IsEnabled(kEnableHangWatcher);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_BSD)
+ if (is_zygote_child) {
+ enable_hang_watcher =
+ enable_hang_watcher &&
diff --git a/devel/electron31/files/patch-base_threading_platform__thread.h b/devel/electron31/files/patch-base_threading_platform__thread.h
new file mode 100644
index 000000000000..5daa2f047b7d
--- /dev/null
+++ b/devel/electron31/files/patch-base_threading_platform__thread.h
@@ -0,0 +1,11 @@
+--- base/threading/platform_thread.h.orig 2024-06-18 21:43:18 UTC
++++ base/threading/platform_thread.h
+@@ -49,6 +49,8 @@ typedef mach_port_t PlatformThreadId;
+ typedef zx_koid_t PlatformThreadId;
+ #elif BUILDFLAG(IS_APPLE)
+ typedef mach_port_t PlatformThreadId;
++#elif BUILDFLAG(IS_BSD)
++typedef uint64_t PlatformThreadId;
+ #elif BUILDFLAG(IS_POSIX)
+ typedef pid_t PlatformThreadId;
+ #endif
diff --git a/devel/electron31/files/patch-base_threading_platform__thread__bsd.cc b/devel/electron31/files/patch-base_threading_platform__thread__bsd.cc
new file mode 100644
index 000000000000..16e5ab7d5f21
--- /dev/null
+++ b/devel/electron31/files/patch-base_threading_platform__thread__bsd.cc
@@ -0,0 +1,34 @@
+--- base/threading/platform_thread_bsd.cc.orig 2024-04-28 08:50:24 UTC
++++ base/threading/platform_thread_bsd.cc
+@@ -0,0 +1,31 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++// Description: These are stubs for *BSD.
++
++#include "base/threading/platform_thread.h"
++
++namespace base {
++namespace internal {
++
++bool CanSetThreadTypeToRealtimeAudio() {
++ return false;
++}
++
++bool SetCurrentThreadTypeForPlatform(ThreadType thread_type,
++ MessagePumpType pump_type_hint) {
++ return false;
++}
++
++std::optional<ThreadPriorityForTest>
++GetCurrentThreadPriorityForPlatformForTest() {
++ return std::nullopt;
++}
++} // namespace internal
++
++// static
++void PlatformThreadBase::SetName(const std::string& name) {
++ SetNameCommon(name);
++}
++
++} // namespace base
diff --git a/devel/electron31/files/patch-base_threading_platform__thread__internal__posix.cc b/devel/electron31/files/patch-base_threading_platform__thread__internal__posix.cc
new file mode 100644
index 000000000000..26ab14cdc512
--- /dev/null
+++ b/devel/electron31/files/patch-base_threading_platform__thread__internal__posix.cc
@@ -0,0 +1,11 @@
+--- base/threading/platform_thread_internal_posix.cc.orig 2024-04-15 20:33:42 UTC
++++ base/threading/platform_thread_internal_posix.cc
+@@ -42,7 +42,7 @@ int GetCurrentThreadNiceValue() {
+ }
+
+ int GetCurrentThreadNiceValue() {
+-#if BUILDFLAG(IS_NACL)
++#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_BSD)
+ NOTIMPLEMENTED();
+ return 0;
+ #else
diff --git a/devel/electron31/files/patch-base_threading_platform__thread__posix.cc b/devel/electron31/files/patch-base_threading_platform__thread__posix.cc
new file mode 100644
index 000000000000..3e646ccc65c2
--- /dev/null
+++ b/devel/electron31/files/patch-base_threading_platform__thread__posix.cc
@@ -0,0 +1,53 @@
+--- base/threading/platform_thread_posix.cc.orig 2024-06-18 21:43:18 UTC
++++ base/threading/platform_thread_posix.cc
+@@ -77,11 +77,11 @@ void* ThreadFunc(void* params) {
+ if (!thread_params->joinable)
+ base::DisallowSingleton();
+
+-#if PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
++#if PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && !BUILDFLAG(IS_BSD)
+ partition_alloc::internal::StackTopRegistry::Get().NotifyThreadCreated();
+ #endif
+
+-#if !BUILDFLAG(IS_NACL)
++#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_BSD)
+ #if BUILDFLAG(IS_APPLE)
+ PlatformThread::SetCurrentThreadRealtimePeriodValue(
+ delegate->GetRealtimePeriod());
+@@ -265,6 +265,8 @@ PlatformThreadId PlatformThreadBase::CurrentId() {
+ return reinterpret_cast<int32_t>(pthread_self());
+ #elif BUILDFLAG(IS_POSIX) && BUILDFLAG(IS_AIX)
+ return pthread_self();
++#elif BUILDFLAG(IS_BSD)
++ return reinterpret_cast<uint64_t>(pthread_self());
+ #elif BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_AIX)
+ return reinterpret_cast<int64_t>(pthread_self());
+ #endif
+@@ -355,7 +357,7 @@ bool PlatformThreadBase::CanChangeThreadType(ThreadTyp
+
+ // static
+ bool PlatformThreadBase::CanChangeThreadType(ThreadType from, ThreadType to) {
+-#if BUILDFLAG(IS_NACL)
++#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_BSD)
+ return false;
+ #else
+ if (from >= to) {
+@@ -376,6 +378,9 @@ void SetCurrentThreadTypeImpl(ThreadType thread_type,
+ MessagePumpType pump_type_hint) {
+ #if BUILDFLAG(IS_NACL)
+ NOTIMPLEMENTED();
++// avoid pledge(2) violation
++#elif BUILDFLAG(IS_BSD)
++ NOTIMPLEMENTED();
+ #else
+ if (internal::SetCurrentThreadTypeForPlatform(thread_type, pump_type_hint))
+ return;
+@@ -398,7 +403,7 @@ ThreadPriorityForTest PlatformThreadBase::GetCurrentTh
+
+ // static
+ ThreadPriorityForTest PlatformThreadBase::GetCurrentThreadPriorityForTest() {
+-#if BUILDFLAG(IS_NACL)
++#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_BSD)
+ NOTIMPLEMENTED();
+ return ThreadPriorityForTest::kNormal;
+ #else
diff --git a/devel/electron31/files/patch-base_threading_platform__thread__unittest.cc b/devel/electron31/files/patch-base_threading_platform__thread__unittest.cc
new file mode 100644
index 000000000000..5aa6b8f63ad3
--- /dev/null
+++ b/devel/electron31/files/patch-base_threading_platform__thread__unittest.cc
@@ -0,0 +1,38 @@
+--- base/threading/platform_thread_unittest.cc.orig 2024-06-18 21:43:18 UTC
++++ base/threading/platform_thread_unittest.cc
+@@ -38,7 +38,7 @@
+ #include "base/time/time.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <pthread.h>
+ #include <sys/syscall.h>
+ #include <sys/types.h>
+@@ -429,7 +429,7 @@ TEST(PlatformThreadTest, CanChangeThreadType) {
+ // and hardcodes what we know. Please inform scheduler-dev@chromium.org if this
+ // proprerty changes for a given platform.
+ TEST(PlatformThreadTest, CanChangeThreadType) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On Ubuntu, RLIMIT_NICE and RLIMIT_RTPRIO are 0 by default, so we won't be
+ // able to increase priority to any level unless we are root (euid == 0).
+ bool kCanIncreasePriority = false;
+@@ -713,12 +713,16 @@ INSTANTIATE_TEST_SUITE_P(
+
+ #endif // BUILDFLAG(IS_APPLE)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ namespace {
+
+ bool IsTidCacheCorrect() {
++#if BUILDFLAG(IS_BSD)
++ return PlatformThread::CurrentId() == reinterpret_cast<int64_t>(pthread_self());
++#else
+ return PlatformThread::CurrentId() == syscall(__NR_gettid);
++#endif
+ }
+
+ void* CheckTidCacheCorrectWrapper(void*) {
diff --git a/devel/electron31/files/patch-base_trace__event_malloc__dump__provider.cc b/devel/electron31/files/patch-base_trace__event_malloc__dump__provider.cc
new file mode 100644
index 000000000000..989e1e5f1fd4
--- /dev/null
+++ b/devel/electron31/files/patch-base_trace__event_malloc__dump__provider.cc
@@ -0,0 +1,30 @@
+--- base/trace_event/malloc_dump_provider.cc.orig 2024-06-18 21:43:18 UTC
++++ base/trace_event/malloc_dump_provider.cc
+@@ -29,6 +29,8 @@
+
+ #if BUILDFLAG(IS_APPLE)
+ #include <malloc/malloc.h>
++#elif BUILDFLAG(IS_BSD)
++#include <stdlib.h>
+ #else
+ #include <malloc.h>
+ #endif
+@@ -187,7 +189,7 @@ void ReportAppleAllocStats(size_t* total_virtual_size,
+
+ #if (PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && BUILDFLAG(IS_ANDROID)) || \
+ (!PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && !BUILDFLAG(IS_WIN) && \
+- !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_FUCHSIA))
++ !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_BSD))
+ void ReportMallinfoStats(ProcessMemoryDump* pmd,
+ size_t* total_virtual_size,
+ size_t* resident_size,
+@@ -391,6 +393,9 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDump
+ &allocated_objects_count);
+ #elif BUILDFLAG(IS_FUCHSIA)
+ // TODO(fuchsia): Port, see https://crbug.com/706592.
++#elif BUILDFLAG(IS_BSD)
++ total_virtual_size = 0;
++ allocated_objects_size = 0;
+ #else
+ ReportMallinfoStats(/*pmd=*/nullptr, &total_virtual_size, &resident_size,
+ &allocated_objects_size, &allocated_objects_count);
diff --git a/devel/electron31/files/patch-base_trace__event_memory__dump__manager.cc b/devel/electron31/files/patch-base_trace__event_memory__dump__manager.cc
new file mode 100644
index 000000000000..1ef513a1b8d2
--- /dev/null
+++ b/devel/electron31/files/patch-base_trace__event_memory__dump__manager.cc
@@ -0,0 +1,11 @@
+--- base/trace_event/memory_dump_manager.cc.orig 2024-06-18 21:43:18 UTC
++++ base/trace_event/memory_dump_manager.cc
+@@ -87,7 +87,7 @@ const char* const MemoryDumpManager::kSystemAllocatorP
+ #if defined(MALLOC_MEMORY_TRACING_SUPPORTED)
+ MallocDumpProvider::kAllocatedObjects;
+ #else
+- nullptr;
++ "";
+ #endif
+
+ // static
diff --git a/devel/electron31/files/patch-base_trace__event_process__memory__dump.cc b/devel/electron31/files/patch-base_trace__event_process__memory__dump.cc
new file mode 100644
index 000000000000..5a261dc448da
--- /dev/null
+++ b/devel/electron31/files/patch-base_trace__event_process__memory__dump.cc
@@ -0,0 +1,20 @@
+--- base/trace_event/process_memory_dump.cc.orig 2024-06-18 21:43:18 UTC
++++ base/trace_event/process_memory_dump.cc
+@@ -118,7 +118,7 @@ std::optional<size_t> ProcessMemoryDump::CountResident
+ #if BUILDFLAG(IS_WIN)
+ std::unique_ptr<PSAPI_WORKING_SET_EX_INFORMATION[]> vec(
+ new PSAPI_WORKING_SET_EX_INFORMATION[max_vec_size]);
+-#elif BUILDFLAG(IS_APPLE)
++#elif BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<char[]> vec(new char[max_vec_size]);
+ #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
+ std::unique_ptr<unsigned char[]> vec(new unsigned char[max_vec_size]);
+@@ -140,7 +140,7 @@ std::optional<size_t> ProcessMemoryDump::CountResident
+
+ for (size_t i = 0; i < page_count; i++)
+ resident_page_count += vec[i].VirtualAttributes.Valid;
+-#elif BUILDFLAG(IS_FUCHSIA)
++#elif BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/42050620): Implement counting resident bytes.
+ // For now, log and avoid unused variable warnings.
+ NOTIMPLEMENTED_LOG_ONCE();
diff --git a/devel/electron31/files/patch-base_tracing_trace__time.cc b/devel/electron31/files/patch-base_tracing_trace__time.cc
new file mode 100644
index 000000000000..36c6113518f4
--- /dev/null
+++ b/devel/electron31/files/patch-base_tracing_trace__time.cc
@@ -0,0 +1,28 @@
+--- base/tracing/trace_time.cc.orig 2022-02-28 16:54:41 UTC
++++ base/tracing/trace_time.cc
+@@ -8,13 +8,17 @@
+ #include "build/build_config.h"
+ #include "third_party/perfetto/include/perfetto/base/time.h"
+
++#if BUILDFLAG(IS_FREEBSD)
++#define CLOCK_BOOTTIME CLOCK_UPTIME
++#endif
++
+ namespace base {
+ namespace tracing {
+
+ int64_t TraceBootTicksNow() {
+ // On Windows and Mac, TRACE_TIME_TICKS_NOW() behaves like boottime already.
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ struct timespec ts;
+ int res = clock_gettime(CLOCK_BOOTTIME, &ts);
+ if (res != -1)
+@@ -24,4 +28,4 @@ int64_t TraceBootTicksNow() {
+ }
+
+ } // namespace tracing
+-} // namespace base
+\ No newline at end of file
++} // namespace base
diff --git a/devel/electron31/files/patch-base_tracing_trace__time.h b/devel/electron31/files/patch-base_tracing_trace__time.h
new file mode 100644
index 000000000000..0394e382ee6e
--- /dev/null
+++ b/devel/electron31/files/patch-base_tracing_trace__time.h
@@ -0,0 +1,11 @@
+--- base/tracing/trace_time.h.orig 2022-02-28 16:54:41 UTC
++++ base/tracing/trace_time.h
+@@ -12,7 +12,7 @@ namespace base {
+ namespace tracing {
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // Linux, Android, and Fuchsia all use CLOCK_MONOTONIC. See crbug.com/166153
+ // about efforts to unify base::TimeTicks across all platforms.
+ constexpr perfetto::protos::pbzero::BuiltinClock kTraceClockId =
diff --git a/devel/electron31/files/patch-build_config_BUILD.gn b/devel/electron31/files/patch-build_config_BUILD.gn
new file mode 100644
index 000000000000..e49d3088166c
--- /dev/null
+++ b/devel/electron31/files/patch-build_config_BUILD.gn
@@ -0,0 +1,13 @@
+--- build/config/BUILD.gn.orig 2023-08-10 01:48:31 UTC
++++ build/config/BUILD.gn
+@@ -214,6 +214,10 @@ config("default_libs") {
+ # Targets should choose to explicitly link frameworks they require. Since
+ # linking can have run-time side effects, nothing should be listed here.
+ libs = []
++ } else if (is_bsd) {
++ libs = [
++ "pthread",
++ ]
+ } else if (is_linux || is_chromeos) {
+ libs = [
+ "dl",
diff --git a/devel/electron31/files/patch-build_config_BUILDCONFIG.gn b/devel/electron31/files/patch-build_config_BUILDCONFIG.gn
new file mode 100644
index 000000000000..481b4af072b3
--- /dev/null
+++ b/devel/electron31/files/patch-build_config_BUILDCONFIG.gn
@@ -0,0 +1,45 @@
+--- build/config/BUILDCONFIG.gn.orig 2024-06-30 11:48:26 UTC
++++ build/config/BUILDCONFIG.gn
+@@ -139,7 +139,8 @@ declare_args() {
+ is_official_build = false
+
+ # Set to true when compiling with the Clang compiler.
+- is_clang = current_os != "linux" ||
++ is_clang = current_os != "linux" || current_os == "openbsd" ||
++ current_os == "freebsd" ||
+ (current_cpu != "s390x" && current_cpu != "s390" &&
+ current_cpu != "ppc64" && current_cpu != "ppc" &&
+ current_cpu != "mips" && current_cpu != "mips64" &&
+@@ -234,6 +235,10 @@ if (host_toolchain == "") {
+ host_toolchain = "//build/toolchain/aix:$host_cpu"
+ } else if (host_os == "zos") {
+ host_toolchain = "//build/toolchain/zos:$host_cpu"
++ } else if (host_os == "openbsd") {
++ host_toolchain = "//build/toolchain/openbsd:clang_$host_cpu"
++ } else if (host_os == "freebsd") {
++ host_toolchain = "//build/toolchain/freebsd:clang_$host_cpu"
+ } else {
+ assert(false, "Unsupported host_os: $host_os")
+ }
+@@ -277,6 +282,8 @@ if (target_os == "android") {
+ _default_toolchain = "//build/toolchain/aix:$target_cpu"
+ } else if (target_os == "zos") {
+ _default_toolchain = "//build/toolchain/zos:$target_cpu"
++} else if (target_os == "openbsd" || target_os == "freebsd") {
++ _default_toolchain = host_toolchain
+ } else {
+ assert(false, "Unsupported target_os: $target_os")
+ }
+@@ -311,7 +318,11 @@ is_ios = current_os == "ios"
+ is_chromeos = current_os == "chromeos"
+ is_fuchsia = current_os == "fuchsia"
+ is_ios = current_os == "ios"
+-is_linux = current_os == "linux"
++is_linux = current_os == "linux" || current_os == "openbsd" ||
++ current_os == "freebsd"
++is_openbsd = current_os == "openbsd"
++is_freebsd = current_os == "freebsd"
++is_bsd = current_os == "openbsd" || current_os == "freebsd"
+ is_mac = current_os == "mac"
+ is_nacl = current_os == "nacl"
+ is_win = current_os == "win" || current_os == "winuwp"
diff --git a/devel/electron31/files/patch-build_config_clang_BUILD.gn b/devel/electron31/files/patch-build_config_clang_BUILD.gn
new file mode 100644
index 000000000000..6d9c2443e1ef
--- /dev/null
+++ b/devel/electron31/files/patch-build_config_clang_BUILD.gn
@@ -0,0 +1,11 @@
+--- build/config/clang/BUILD.gn.orig 2024-06-18 21:43:18 UTC
++++ build/config/clang/BUILD.gn
+@@ -214,7 +214,7 @@ clang_lib("compiler_builtins") {
+
+ # Adds a dependency on the Clang runtime library clang_rt.builtins.
+ clang_lib("compiler_builtins") {
+- if (!toolchain_has_rust) {
++ if (!toolchain_has_rust || is_bsd) {
+ # Since there's no Rust in the toolchain, there's no concern that we'll use
+ # the Rust stdlib's intrinsics here.
+ #
diff --git a/devel/electron31/files/patch-build_config_compiler_BUILD.gn b/devel/electron31/files/patch-build_config_compiler_BUILD.gn
new file mode 100644
index 000000000000..38e7a4cb9dd7
--- /dev/null
+++ b/devel/electron31/files/patch-build_config_compiler_BUILD.gn
@@ -0,0 +1,132 @@
+--- build/config/compiler/BUILD.gn.orig 2024-06-18 21:43:18 UTC
++++ build/config/compiler/BUILD.gn
+@@ -199,7 +199,7 @@ declare_args() {
+ # This greatly reduces the size of debug builds, at the cost of
+ # debugging information which is required by some specialized
+ # debugging tools.
+- simple_template_names = is_clang && !is_nacl && !is_win && !is_apple
++ simple_template_names = is_clang && !is_nacl && !is_win && !is_apple && !is_bsd
+ }
+
+ declare_args() {
+@@ -251,13 +251,16 @@ config("no_unresolved_symbols") {
+ # Compiler instrumentation can introduce dependencies in DSOs to symbols in
+ # the executable they are loaded into, so they are unresolved at link-time.
+ config("no_unresolved_symbols") {
+- if (!using_sanitizer &&
++ if (!using_sanitizer && !is_bsd &&
+ (is_linux || is_chromeos || is_android || is_fuchsia)) {
+ ldflags = [
+ "-Wl,-z,defs",
+ "-Wl,--as-needed",
+ ]
+ }
++ if (current_cpu == "x86" && is_openbsd) {
++ ldflags = [ "-Wl,-z,notext", "-Wl,--strip-all" ]
++ }
+ }
+
+ # compiler ---------------------------------------------------------------------
+@@ -499,6 +502,10 @@ config("compiler") {
+ }
+ }
+
++ if (is_openbsd) {
++ ldflags += [ "-Wl,-z,wxneeded" ]
++ }
++
+ # Linux-specific compiler flags setup.
+ # ------------------------------------
+ if (use_icf && (!is_apple || use_lld)) {
+@@ -545,7 +552,7 @@ config("compiler") {
+ ldflags += [ "-Wl,-z,keep-text-section-prefix" ]
+ }
+
+- if (is_clang && !is_nacl && current_os != "zos") {
++ if (is_clang && !is_nacl && current_os != "zos" && !is_bsd) {
+ cflags += [ "-fcrash-diagnostics-dir=" + clang_diagnostic_dir ]
+ if (save_reproducers_on_lld_crash && use_lld) {
+ ldflags += [
+@@ -1173,7 +1180,7 @@ config("compiler_cpu_abi") {
+ ]
+ }
+ } else if (current_cpu == "arm") {
+- if (is_clang && !is_android && !is_nacl &&
++ if (is_clang && !is_android && !is_nacl && !is_bsd &&
+ !(is_chromeos_lacros && is_chromeos_device)) {
+ cflags += [ "--target=arm-linux-gnueabihf" ]
+ ldflags += [ "--target=arm-linux-gnueabihf" ]
+@@ -1188,7 +1195,7 @@ config("compiler_cpu_abi") {
+ cflags += [ "-mtune=$arm_tune" ]
+ }
+ } else if (current_cpu == "arm64") {
+- if (is_clang && !is_android && !is_nacl && !is_fuchsia &&
++ if (is_clang && !is_android && !is_nacl && !is_fuchsia && !is_bsd &&
+ !(is_chromeos_lacros && is_chromeos_device)) {
+ cflags += [ "--target=aarch64-linux-gnu" ]
+ ldflags += [ "--target=aarch64-linux-gnu" ]
+@@ -1523,7 +1530,7 @@ config("compiler_deterministic") {
+ # different build directory like "out/feature_a" and "out/feature_b" if
+ # we build same files with same compile flag.
+ # Other paths are already given in relative, no need to normalize them.
+- if (is_nacl) {
++ if (is_nacl || is_bsd) {
+ # TODO(https://crbug.com/1231236): Use -ffile-compilation-dir= here.
+ cflags += [
+ "-Xclang",
+@@ -1575,7 +1582,7 @@ config("clang_revision") {
+ }
+
+ config("clang_revision") {
+- if (is_clang && clang_base_path == default_clang_base_path) {
++ if (is_clang && !is_bsd && clang_base_path == default_clang_base_path) {
+ update_args = [
+ "--print-revision",
+ "--verify-version=$clang_version",
+@@ -1889,9 +1896,6 @@ config("default_warnings") {
+
+ # TODO(crbug.com/40286317): Evaluate and possibly enable.
+ "-Wno-vla-extension",
+-
+- # TODO(crbug.com/40284799): Fix and re-enable.
+- "-Wno-thread-safety-reference-return",
+ ]
+
+ cflags_cc += [
+@@ -1899,7 +1903,7 @@ config("default_warnings") {
+ "-Wenum-compare-conditional",
+ ]
+
+- if (!is_nacl) {
++ if (!is_nacl && !is_openbsd) {
+ cflags_cc += [
+ # TODO(crbug.com/41486292): Fix and re-enable.
+ "-Wno-c++11-narrowing-const-reference",
+@@ -2616,7 +2620,7 @@ config("afdo") {
+ # There are some targeted places that AFDO regresses, so we provide a separate
+ # config to allow AFDO to be disabled per-target.
+ config("afdo") {
+- if (is_clang) {
++ if (is_clang && !is_bsd) {
+ cflags = []
+ if (clang_emit_debug_info_for_profiling) {
+ # Add the following flags to generate debug info for profiling.
+@@ -2643,7 +2647,7 @@ config("afdo") {
+ cflags += [ "-Wno-backend-plugin" ]
+ inputs = [ _clang_sample_profile ]
+ }
+- } else if (auto_profile_path != "" && is_a_target_toolchain) {
++ } else if (auto_profile_path != "" && is_a_target_toolchain && !is_bsd) {
+ cflags = [ "-fauto-profile=${auto_profile_path}" ]
+ inputs = [ auto_profile_path ]
+ }
+@@ -2808,7 +2812,8 @@ config("symbols") {
+ configs += [ "//build/config:compress_debug_sections" ]
+ }
+
+- if (is_clang && (!is_nacl || is_nacl_saigo) && current_os != "zos") {
++ if (is_clang && (!is_nacl || is_nacl_saigo) && current_os != "zos" &&
++ !is_bsd) {
+ if (is_apple) {
+ # TODO(crbug.com/40117949): Investigate missing debug info on mac.
+ # Make sure we don't use constructor homing on mac.
diff --git a/devel/electron31/files/patch-build_config_linux_BUILD.gn b/devel/electron31/files/patch-build_config_linux_BUILD.gn
new file mode 100644
index 000000000000..2e93980f3e50
--- /dev/null
+++ b/devel/electron31/files/patch-build_config_linux_BUILD.gn
@@ -0,0 +1,11 @@
+--- build/config/linux/BUILD.gn.orig 2022-05-19 14:06:27 UTC
++++ build/config/linux/BUILD.gn
+@@ -41,7 +41,7 @@ config("runtime_library") {
+ }
+
+ if ((!is_chromeos || default_toolchain != "//build/toolchain/cros:target") &&
+- (!use_custom_libcxx || current_cpu == "mipsel")) {
++ (!use_custom_libcxx || current_cpu == "mipsel") && !is_bsd) {
+ libs = [ "atomic" ]
+ }
+ }
diff --git a/devel/electron31/files/patch-build_config_linux_pkg-config.py b/devel/electron31/files/patch-build_config_linux_pkg-config.py
new file mode 100644
index 000000000000..3b8ffa5a822d
--- /dev/null
+++ b/devel/electron31/files/patch-build_config_linux_pkg-config.py
@@ -0,0 +1,11 @@
+--- build/config/linux/pkg-config.py.orig 2023-03-30 00:33:39 UTC
++++ build/config/linux/pkg-config.py
+@@ -108,7 +108,7 @@ def main():
+ # If this is run on non-Linux platforms, just return nothing and indicate
+ # success. This allows us to "kind of emulate" a Linux build from other
+ # platforms.
+- if "linux" not in sys.platform:
++ if not sys.platform.startswith(tuple(['linux', 'openbsd', 'freebsd'])):
+ print("[[],[],[],[],[]]")
+ return 0
+
diff --git a/devel/electron31/files/patch-build_config_ozone.gni b/devel/electron31/files/patch-build_config_ozone.gni
new file mode 100644
index 000000000000..917f5aa3c178
--- /dev/null
+++ b/devel/electron31/files/patch-build_config_ozone.gni
@@ -0,0 +1,19 @@
+--- build/config/ozone.gni.orig 2023-10-19 19:57:59 UTC
++++ build/config/ozone.gni
+@@ -84,7 +84,15 @@ declare_args() {
+ } else if (is_chromeos_lacros) {
+ ozone_platform = "wayland"
+ ozone_platform_wayland = true
+- } else if (is_linux) {
++ } else if (is_linux && !is_bsd) {
++ ozone_platform = "x11"
++ ozone_platform_wayland = true
++ ozone_platform_x11 = true
++ } else if (is_openbsd) {
++ ozone_platform = "x11"
++ ozone_platform_wayland = false
++ ozone_platform_x11 = true
++ } else if (is_freebsd) {
+ ozone_platform = "x11"
+ ozone_platform_wayland = true
+ ozone_platform_x11 = true
diff --git a/devel/electron31/files/patch-build_config_rust.gni b/devel/electron31/files/patch-build_config_rust.gni
new file mode 100644
index 000000000000..1990137bfc98
--- /dev/null
+++ b/devel/electron31/files/patch-build_config_rust.gni
@@ -0,0 +1,13 @@
+--- build/config/rust.gni.orig 2024-06-18 21:43:18 UTC
++++ build/config/rust.gni
+@@ -272,6 +272,10 @@ if (is_linux || is_chromeos) {
+ }
+ }
+
++if (is_bsd) {
++ rust_abi_target = string_replace(rust_abi_target, "linux-gnu", current_os)
++}
++
+ assert(!toolchain_has_rust || rust_abi_target != "")
+
+ # This variable is passed to the Rust libstd build.
diff --git a/devel/electron31/files/patch-build_config_v8__target__cpu.gni b/devel/electron31/files/patch-build_config_v8__target__cpu.gni
new file mode 100644
index 000000000000..40fa8f6348e3
--- /dev/null
+++ b/devel/electron31/files/patch-build_config_v8__target__cpu.gni
@@ -0,0 +1,13 @@
+--- build/config/v8_target_cpu.gni.orig 2022-02-07 13:39:41 UTC
++++ build/config/v8_target_cpu.gni
+@@ -36,6 +36,10 @@ declare_args() {
+ if (v8_target_cpu == "") {
+ if (current_toolchain == "//build/toolchain/linux:clang_x64_v8_arm64") {
+ v8_target_cpu = "arm64"
++ } else if (current_toolchain == "//build/toolchain/openbsd:clang_arm64") {
++ v8_target_cpu = "arm64"
++ } else if (current_toolchain == "//build/toolchain/freebsd:clang_arm64") {
++ v8_target_cpu = "arm64"
+ } else if (current_toolchain == "//build/toolchain/linux:clang_x86_v8_arm") {
+ v8_target_cpu = "arm"
+ } else if (current_toolchain ==
diff --git a/devel/electron31/files/patch-build_detect__host__arch.py b/devel/electron31/files/patch-build_detect__host__arch.py
new file mode 100644
index 000000000000..673554933a91
--- /dev/null
+++ b/devel/electron31/files/patch-build_detect__host__arch.py
@@ -0,0 +1,11 @@
+--- build/detect_host_arch.py.orig 2023-03-30 00:33:39 UTC
++++ build/detect_host_arch.py
+@@ -20,6 +20,8 @@ def HostArch():
+ host_arch = 'ia32'
+ elif host_arch in ['x86_64', 'amd64']:
+ host_arch = 'x64'
++ elif host_arch.startswith('arm64'):
++ host_arch = 'arm64'
+ elif host_arch.startswith('arm'):
+ host_arch = 'arm'
+ elif host_arch.startswith('aarch64'):
diff --git a/devel/electron31/files/patch-build_gn__run__binary.py b/devel/electron31/files/patch-build_gn__run__binary.py
new file mode 100644
index 000000000000..08fb97b6a1e9
--- /dev/null
+++ b/devel/electron31/files/patch-build_gn__run__binary.py
@@ -0,0 +1,11 @@
+--- build/gn_run_binary.py.orig 2023-03-30 00:33:39 UTC
++++ build/gn_run_binary.py
+@@ -23,7 +23,7 @@ if not os.path.isabs(path):
+ # The rest of the arguments are passed directly to the executable.
+ args = [path] + sys.argv[2:]
+
+-ret = subprocess.call(args)
++ret = subprocess.call(args, env={"CHROME_EXE_PATH":"${WRKSRC}/out/Release/chrome","LD_LIBRARY_PATH":"${WRKSRC}/out/Release"})
+ if ret != 0:
+ if ret <= -100:
+ # Windows error codes such as 0xC0000005 and 0xC0000409 are much easier to
diff --git a/devel/electron31/files/patch-build_linux_chrome.map b/devel/electron31/files/patch-build_linux_chrome.map
new file mode 100644
index 000000000000..992585036b7b
--- /dev/null
+++ b/devel/electron31/files/patch-build_linux_chrome.map
@@ -0,0 +1,13 @@
+--- build/linux/chrome.map.orig 2022-02-28 16:54:41 UTC
++++ build/linux/chrome.map
+@@ -20,6 +20,10 @@ global:
+ # Program entry point.
+ _start;
+
++ # FreeBSD specific variables.
++ __progname;
++ environ;
++
+ # Memory allocation symbols. We want chrome and any libraries to
+ # share the same heap, so it is correct to export these symbols.
+ aligned_alloc;
diff --git a/devel/electron31/files/patch-build_linux_strip__binary.py b/devel/electron31/files/patch-build_linux_strip__binary.py
new file mode 100644
index 000000000000..9dd3c051630b
--- /dev/null
+++ b/devel/electron31/files/patch-build_linux_strip__binary.py
@@ -0,0 +1,10 @@
+--- build/linux/strip_binary.py.orig 2022-02-07 13:39:41 UTC
++++ build/linux/strip_binary.py
+@@ -10,6 +10,7 @@ import sys
+
+
+ def main():
++ return 0
+ argparser = argparse.ArgumentParser(description='eu-strip binary.')
+
+ argparser.add_argument('--eu-strip-binary-path', help='eu-strip path.')
diff --git a/devel/electron31/files/patch-build_linux_unbundle_icu.gn b/devel/electron31/files/patch-build_linux_unbundle_icu.gn
new file mode 100644
index 000000000000..bd3567f59977
--- /dev/null
+++ b/devel/electron31/files/patch-build_linux_unbundle_icu.gn
@@ -0,0 +1,18 @@
+--- build/linux/unbundle/icu.gn.orig 2023-04-04 21:42:43 UTC
++++ build/linux/unbundle/icu.gn
+@@ -17,6 +17,15 @@ config("icu_config") {
+ "USING_SYSTEM_ICU=1",
+ "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC",
+
++ # As of icu 73 C++ nullptr, char16_t, override, final and noexcept are used
++ # instead of defines. These definitions can be removed when the bundled icu
++ # gets updated to 73. For more details, see:
++ # https://unicode-org.atlassian.net/browse/ICU-21833 and
++ # https://github.com/unicode-org/icu/commit/28643799377ecf654564f6f31854b02788cebe33
++ "U_FINAL=final",
++ "U_NOEXCEPT=noexcept",
++ "U_OVERRIDE=override",
++
+ # U_EXPORT (defined in unicode/platform.h) is used to set public visibility
+ # on classes through the U_COMMON_API and U_I18N_API macros (among others).
+ # When linking against the system ICU library, we want its symbols to have
diff --git a/devel/electron31/files/patch-build_linux_unbundle_libevent.gn b/devel/electron31/files/patch-build_linux_unbundle_libevent.gn
new file mode 100644
index 000000000000..d5f276de574d
--- /dev/null
+++ b/devel/electron31/files/patch-build_linux_unbundle_libevent.gn
@@ -0,0 +1,15 @@
+--- build/linux/unbundle/libevent.gn.orig 2022-05-28 07:21:18 UTC
++++ build/linux/unbundle/libevent.gn
+@@ -9,7 +9,12 @@ shim_headers("libevent_shim") {
+ headers = [ "event.h" ]
+ }
+
++config("system_libevent") {
++ defines = [ "USE_SYSTEM_LIBEVENT=1" ]
++}
++
+ source_set("libevent") {
+ deps = [ ":libevent_shim" ]
+ libs = [ "event" ]
++ public_configs = [ ":system_libevent" ]
+ }
diff --git a/devel/electron31/files/patch-build_linux_unbundle_libusb.gn b/devel/electron31/files/patch-build_linux_unbundle_libusb.gn
new file mode 100644
index 000000000000..a99cdcd835d6
--- /dev/null
+++ b/devel/electron31/files/patch-build_linux_unbundle_libusb.gn
@@ -0,0 +1,30 @@
+--- build/linux/unbundle/libusb.gn.orig 2023-11-29 21:39:40 UTC
++++ build/linux/unbundle/libusb.gn
+@@ -1,3 +1,27 @@
++# Copyright 2016 The Chromium Authors. All rights reserved.
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++import("//build/config/linux/pkg_config.gni")
++import("//build/shim_headers.gni")
++
++pkg_config("system_libusb") {
++ packages = [ "libusb-1.0" ]
++}
++
++shim_headers("libusb_shim") {
++ root_path = "src/libusb"
++ headers = [
++ "libusb.h",
++ ]
++}
++
++source_set("libusb") {
++ deps = [
++ ":libusb_shim",
++ ]
++ public_configs = [ ":system_libusb" ]
++}
+ import("//build/config/linux/pkg_config.gni")
+ import("//build/shim_headers.gni")
+
diff --git a/devel/electron31/files/patch-build_rust_std_BUILD.gn b/devel/electron31/files/patch-build_rust_std_BUILD.gn
new file mode 100644
index 000000000000..8f8e58648256
--- /dev/null
+++ b/devel/electron31/files/patch-build_rust_std_BUILD.gn
@@ -0,0 +1,10 @@
+--- build/rust/std/BUILD.gn.orig 2024-04-15 20:33:43 UTC
++++ build/rust/std/BUILD.gn
+@@ -90,7 +90,6 @@ if (toolchain_has_rust) {
+ # don't need to pass to the C++ linker because they're used for specialized
+ # purposes.
+ skip_stdlib_files = [
+- "profiler_builtins",
+ "rustc_std_workspace_alloc",
+ "rustc_std_workspace_core",
+ "rustc_std_workspace_std",
diff --git a/devel/electron31/files/patch-build_toolchain_freebsd_BUILD.gn b/devel/electron31/files/patch-build_toolchain_freebsd_BUILD.gn
new file mode 100644
index 000000000000..7857149615a0
--- /dev/null
+++ b/devel/electron31/files/patch-build_toolchain_freebsd_BUILD.gn
@@ -0,0 +1,69 @@
+--- build/toolchain/freebsd/BUILD.gn.orig 2022-02-07 13:39:41 UTC
++++ build/toolchain/freebsd/BUILD.gn
+@@ -0,0 +1,66 @@
++# Copyright 2013 The Chromium Authors. All rights reserved.
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++import("//build/config/sysroot.gni")
++import("//build/toolchain/gcc_toolchain.gni")
++
++clang_toolchain("clang_x86") {
++ toolchain_args = {
++ current_cpu = "x86"
++ current_os = "freebsd"
++ }
++}
++
++gcc_toolchain("x86") {
++ cc = "gcc"
++ cxx = "g++"
++
++ readelf = "readelf"
++ nm = "nm"
++ ar = "ar"
++ ld = cxx
++
++ toolchain_args = {
++ current_cpu = "x86"
++ current_os = "freebsd"
++ is_clang = false
++ }
++}
++
++clang_toolchain("clang_x64") {
++ toolchain_args = {
++ current_cpu = "x64"
++ current_os = "freebsd"
++ }
++}
++
++gcc_toolchain("x64") {
++ cc = "gcc"
++ cxx = "g++"
++
++ readelf = "readelf"
++ nm = "nm"
++ ar = "ar"
++ ld = cxx
++
++ toolchain_args = {
++ current_cpu = "x64"
++ current_os = "freebsd"
++ is_clang = false
++ }
++}
++
++clang_toolchain("clang_arm") {
++ toolchain_args = {
++ current_cpu = "arm64"
++ current_os = "freebsd"
++ }
++}
++
++clang_toolchain("clang_arm64") {
++ toolchain_args = {
++ current_cpu = "arm64"
++ current_os = "freebsd"
++ }
++}
diff --git a/devel/electron31/files/patch-build_toolchain_gcc__solink__wrapper.py b/devel/electron31/files/patch-build_toolchain_gcc__solink__wrapper.py
new file mode 100644
index 000000000000..34debf134bea
--- /dev/null
+++ b/devel/electron31/files/patch-build_toolchain_gcc__solink__wrapper.py
@@ -0,0 +1,11 @@
+--- build/toolchain/gcc_solink_wrapper.py.orig 2022-02-07 13:39:41 UTC
++++ build/toolchain/gcc_solink_wrapper.py
+@@ -39,7 +39,7 @@ def CollectDynSym(args):
+ """Replaces: nm --format=posix -g -D -p $sofile | cut -f1-2 -d' '"""
+ toc = ''
+ nm = subprocess.Popen(wrapper_utils.CommandToRun(
+- [args.nm, '--format=posix', '-g', '-D', '-p', args.sofile]),
++ [args.nm, '-g', '-D', '-p', args.sofile]),
+ stdout=subprocess.PIPE,
+ bufsize=-1,
+ universal_newlines=True)
diff --git a/devel/electron31/files/patch-build_toolchain_gcc__toolchain.gni b/devel/electron31/files/patch-build_toolchain_gcc__toolchain.gni
new file mode 100644
index 000000000000..daddb1756ae9
--- /dev/null
+++ b/devel/electron31/files/patch-build_toolchain_gcc__toolchain.gni
@@ -0,0 +1,44 @@
+--- build/toolchain/gcc_toolchain.gni.orig 2024-06-18 21:43:18 UTC
++++ build/toolchain/gcc_toolchain.gni
+@@ -57,6 +57,13 @@ if (enable_resource_allowlist_generation) {
+ "enable_resource_allowlist_generation=true does not work for target_os=$target_os")
+ }
+
++declare_args() {
++ extra_cflags = ""
++ extra_cppflags = ""
++ extra_cxxflags = ""
++ extra_ldflags = ""
++}
++
+ # This template defines a toolchain for something that works like gcc
+ # (including clang).
+ #
+@@ -878,22 +885,12 @@ template("clang_toolchain") {
+ # actually just be doing a native compile.
+ template("clang_toolchain") {
+ gcc_toolchain(target_name) {
+- _path = "$clang_base_path/bin"
+- _is_path_absolute = get_path_info(_path, "abspath") == _path
+-
+- # Preserve absolute paths for tools like distcc.
+- if (_is_path_absolute && filter_include([ _path ], [ "//*" ]) == []) {
+- prefix = _path
+- } else {
+- prefix = rebase_path(_path, root_build_dir)
+- }
+-
+- cc = "${prefix}/clang"
+- cxx = "${prefix}/clang++"
++ cc = "cc"
++ cxx = "c++"
+ ld = cxx
+- readelf = "${prefix}/llvm-readelf"
+- ar = "${prefix}/llvm-ar"
+- nm = "${prefix}/llvm-nm"
++ readelf = "readelf"
++ ar = "ar"
++ nm = "nm"
+
+ forward_variables_from(invoker, "*", [ "toolchain_args" ])
+
diff --git a/devel/electron31/files/patch-build_toolchain_openbsd_BUILD.gn b/devel/electron31/files/patch-build_toolchain_openbsd_BUILD.gn
new file mode 100644
index 000000000000..04e6f6b416e2
--- /dev/null
+++ b/devel/electron31/files/patch-build_toolchain_openbsd_BUILD.gn
@@ -0,0 +1,69 @@
+--- build/toolchain/openbsd/BUILD.gn.orig 2022-02-07 13:39:41 UTC
++++ build/toolchain/openbsd/BUILD.gn
+@@ -0,0 +1,66 @@
++# Copyright 2013 The Chromium Authors. All rights reserved.
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++import("//build/config/sysroot.gni")
++import("//build/toolchain/gcc_toolchain.gni")
++
++clang_toolchain("clang_x86") {
++ toolchain_args = {
++ current_cpu = "x86"
++ current_os = "openbsd"
++ }
++}
++
++gcc_toolchain("x86") {
++ cc = "gcc"
++ cxx = "g++"
++
++ readelf = "readelf"
++ nm = "nm"
++ ar = "ar"
++ ld = cxx
++
++ toolchain_args = {
++ current_cpu = "x86"
++ current_os = "openbsd"
++ is_clang = false
++ }
++}
++
++clang_toolchain("clang_x64") {
++ toolchain_args = {
++ current_cpu = "x64"
++ current_os = "openbsd"
++ }
++}
++
++gcc_toolchain("x64") {
++ cc = "gcc"
++ cxx = "g++"
++
++ readelf = "readelf"
++ nm = "nm"
++ ar = "ar"
++ ld = cxx
++
++ toolchain_args = {
++ current_cpu = "x64"
++ current_os = "openbsd"
++ is_clang = false
++ }
++}
++
++clang_toolchain("clang_arm") {
++ toolchain_args = {
++ current_cpu = "arm64"
++ current_os = "openbsd"
++ }
++}
++
++clang_toolchain("clang_arm64") {
++ toolchain_args = {
++ current_cpu = "arm64"
++ current_os = "openbsd"
++ }
++}
diff --git a/devel/electron31/files/patch-build_toolchain_toolchain.gni b/devel/electron31/files/patch-build_toolchain_toolchain.gni
new file mode 100644
index 000000000000..d6f96b6817c2
--- /dev/null
+++ b/devel/electron31/files/patch-build_toolchain_toolchain.gni
@@ -0,0 +1,11 @@
+--- build/toolchain/toolchain.gni.orig 2024-04-15 20:33:43 UTC
++++ build/toolchain/toolchain.gni
+@@ -68,7 +68,7 @@ if (host_os == "mac") {
+ host_shlib_extension = ".dylib"
+ } else if (host_os == "win") {
+ host_shlib_extension = ".dll"
+-} else if (host_os == "linux" || host_os == "aix") {
++} else if (is_posix) {
+ host_shlib_extension = ".so"
+ } else {
+ assert(false, "Host platform not supported")
diff --git a/devel/electron31/files/patch-cc_BUILD.gn b/devel/electron31/files/patch-cc_BUILD.gn
new file mode 100644
index 000000000000..bca6efb59149
--- /dev/null
+++ b/devel/electron31/files/patch-cc_BUILD.gn
@@ -0,0 +1,19 @@
+--- cc/BUILD.gn.orig 2024-06-18 21:43:18 UTC
++++ cc/BUILD.gn
+@@ -677,7 +677,7 @@ cc_test_static_library("test_support") {
+ if (enable_vulkan) {
+ deps += [ "//gpu/vulkan/init" ]
+ }
+- if (!is_android) {
++ if (!is_android && !is_bsd) {
+ data_deps = [ "//third_party/mesa_headers" ]
+ }
+ if (skia_use_dawn) {
+@@ -936,7 +936,6 @@ cc_test("cc_unittests") {
+ data = [ "//components/test/data/viz/" ]
+ data_deps = [
+ "//testing/buildbot/filters:cc_unittests_filters",
+- "//third_party/mesa_headers",
+ ]
+
+ if (is_android && enable_chrome_android_internal) {
diff --git a/devel/electron31/files/patch-cc_base_features.cc b/devel/electron31/files/patch-cc_base_features.cc
new file mode 100644
index 000000000000..8e235a76f61d
--- /dev/null
+++ b/devel/electron31/files/patch-cc_base_features.cc
@@ -0,0 +1,11 @@
+--- cc/base/features.cc.orig 2024-02-21 00:20:30 UTC
++++ cc/base/features.cc
+@@ -88,7 +88,7 @@ BASE_FEATURE(kUseDMSAAForTiles,
+ // be using a separate flag to control the launch on GL.
+ BASE_FEATURE(kUseDMSAAForTiles,
+ "UseDMSAAForTiles",
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
diff --git a/devel/electron31/files/patch-chrome_app_chrome__command__ids.h b/devel/electron31/files/patch-chrome_app_chrome__command__ids.h
new file mode 100644
index 000000000000..abc2aa8017e7
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_app_chrome__command__ids.h
@@ -0,0 +1,17 @@
+--- chrome/app/chrome_command_ids.h.orig 2024-06-18 21:43:19 UTC
++++ chrome/app/chrome_command_ids.h
+@@ -68,12 +68,12 @@
+ #define IDC_TOGGLE_MULTITASK_MENU 34050
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #define IDC_USE_SYSTEM_TITLE_BAR 34051
+ #endif
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #define IDC_RESTORE_WINDOW 34052
+ #endif
+
diff --git a/devel/electron31/files/patch-chrome_app_chrome__main.cc b/devel/electron31/files/patch-chrome_app_chrome__main.cc
new file mode 100644
index 000000000000..20f9062504d1
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_app_chrome__main.cc
@@ -0,0 +1,43 @@
+--- chrome/app/chrome_main.cc.orig 2024-04-15 20:33:43 UTC
++++ chrome/app/chrome_main.cc
+@@ -28,11 +28,11 @@
+ #include "chrome/app/chrome_main_mac.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/base_switches.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/app/chrome_main_linux.h"
+ #endif
+
+@@ -80,7 +80,7 @@ int ChromeMain(int argc, const char** argv) {
+ #error Unknown platform.
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ PossiblyDetermineFallbackChromeChannel(argv[0]);
+ #endif
+
+@@ -141,7 +141,7 @@ int ChromeMain(int argc, const char** argv) {
+ SetUpBundleOverrides();
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ AppendExtraArgumentsToCommandLine(command_line);
+ #endif
+
+@@ -170,7 +170,7 @@ int ChromeMain(int argc, const char** argv) {
+ headless_mode_handle = headless::InitHeadlessMode();
+ } else {
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ if (headless::IsOldHeadlessMode()) {
+ #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ command_line->AppendSwitch(::headless::switches::kEnableCrashReporter);
diff --git a/devel/electron31/files/patch-chrome_app_chrome__main__delegate.cc b/devel/electron31/files/patch-chrome_app_chrome__main__delegate.cc
new file mode 100644
index 000000000000..b277d0c5e528
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_app_chrome__main__delegate.cc
@@ -0,0 +1,154 @@
+--- chrome/app/chrome_main_delegate.cc.orig 2024-06-18 21:43:19 UTC
++++ chrome/app/chrome_main_delegate.cc
+@@ -137,7 +137,7 @@
+ #include "components/about_ui/credit_utils.h"
+ #endif
+
+-#if BUILDFLAG(ENABLE_NACL) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
++#if BUILDFLAG(ENABLE_NACL) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_BSD)
+ #include "components/nacl/common/nacl_paths.h"
+ #include "components/nacl/zygote/nacl_fork_delegate_linux.h"
+ #endif
+@@ -180,21 +180,21 @@
+ #include "v8/include/v8.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/environment.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/nix/scoped_xdg_activation_token_injector.h"
+ #include "ui/linux/display_server_utils.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "base/message_loop/message_pump_libevent.h"
+ #endif
+
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/policy/policy_path_parser.h"
+ #include "components/crash/core/app/crashpad.h"
+ #endif
+@@ -241,7 +241,7 @@
+ #include "base/scoped_add_feature_flags.h"
+ #include "ui/base/ui_base_features.h"
+ #include "ui/ozone/public/ozone_platform.h"
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/chrome_browser_main_extra_parts_linux.h"
+ #endif
+ #endif // BUILDFLAG(IS_OZONE)
+@@ -341,7 +341,7 @@ bool SubprocessNeedsResourceBundle(const std::string&
+ // and resources loaded.
+ bool SubprocessNeedsResourceBundle(const std::string& process_type) {
+ return
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // The zygote process opens the resources for the renderers.
+ process_type == switches::kZygoteProcess ||
+ #endif
+@@ -426,7 +426,7 @@ bool HandleVersionSwitches(const base::CommandLine& co
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Show the man page if --help or -h is on the command line.
+ void HandleHelpSwitches(const base::CommandLine& command_line) {
+ if (command_line.HasSwitch(switches::kHelp) ||
+@@ -472,7 +472,7 @@ void SetCrashpadUploadConsentPostLogin() {
+ }
+ #endif // BUILDFLAG(IS_CHROMEOS_LACROS)
+
+-#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_ANDROID)
++#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_BSD)
+ void SIGTERMProfilingShutdown(int signal) {
+ content::Profiling::Stop();
+ struct sigaction sigact;
+@@ -554,7 +554,7 @@ std::optional<int> AcquireProcessSingleton(
+ // process can be exited.
+ ChromeProcessSingleton::CreateInstance(user_data_dir);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Read the xdg-activation token and set it in the command line for the
+ // duration of the notification in order to ensure this is propagated to an
+ // already running browser process if it exists.
+@@ -638,7 +638,7 @@ void InitializeUserDataDir(base::CommandLine* command_
+ std::string process_type =
+ command_line->GetSwitchValueASCII(switches::kProcessType);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On Linux, Chrome does not support running multiple copies under different
+ // DISPLAYs, so the profile directory can be specified in the environment to
+ // support the virtual desktop use-case.
+@@ -765,7 +765,7 @@ void RecordMainStartupMetrics(base::TimeTicks applicat
+ #endif
+
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Record the startup process creation time on supported platforms. On Android
+ // this is recorded in ChromeMainDelegateAndroid.
+ startup_metric_utils::GetCommon().RecordStartupProcessCreationTime(
+@@ -957,7 +957,7 @@ std::optional<int> ChromeMainDelegate::PostEarlyInitia
+ #if BUILDFLAG(IS_OZONE)
+ // Initialize Ozone platform and add required feature flags as per platform's
+ // properties.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ui::SetOzonePlatformForLinuxIfNeeded(*base::CommandLine::ForCurrentProcess());
+ #endif
+ ui::OzonePlatform::PreEarlyInitialization();
+@@ -1150,7 +1150,7 @@ void ChromeMainDelegate::CommonEarlyInitialization(Inv
+ const bool is_canary_dev = IsCanaryDev();
+ const bool emit_crashes =
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ is_canary_dev;
+ #else
+ false;
+@@ -1305,7 +1305,7 @@ std::optional<int> ChromeMainDelegate::BasicStartupCom
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag
+ // switch of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // This will directly exit if the user asked for help.
+ HandleHelpSwitches(command_line);
+ #endif
+@@ -1335,7 +1335,7 @@ std::optional<int> ChromeMainDelegate::BasicStartupCom
+ #if BUILDFLAG(IS_CHROMEOS)
+ chromeos::dbus_paths::RegisterPathProvider();
+ #endif
+-#if BUILDFLAG(ENABLE_NACL) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
++#if BUILDFLAG(ENABLE_NACL) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
+ nacl::RegisterPathProvider();
+ #endif
+
+@@ -1722,7 +1722,7 @@ void ChromeMainDelegate::PreSandboxStartup() {
+ CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale;
+ }
+
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD)
+ // Zygote needs to call InitCrashReporter() in RunZygote().
+ if (process_type != switches::kZygoteProcess) {
+ if (command_line.HasSwitch(switches::kPreCrashpadCrashTest)) {
+@@ -1821,7 +1821,7 @@ absl::variant<int, content::MainFunctionParams> Chrome
+
+ // This entry is not needed on Linux, where the NaCl loader
+ // process is launched via nacl_helper instead.
+-#if BUILDFLAG(ENABLE_NACL) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(ENABLE_NACL) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+ {switches::kNaClLoaderProcess, NaClMain},
+ #else
+ {"<invalid>", nullptr}, // To avoid constant array of size 0
diff --git a/devel/electron31/files/patch-chrome_browser_BUILD.gn b/devel/electron31/files/patch-chrome_browser_BUILD.gn
new file mode 100644
index 000000000000..ebc398899ff5
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_BUILD.gn
@@ -0,0 +1,16 @@
+--- chrome/browser/BUILD.gn.orig 2024-06-30 11:48:29 UTC
++++ chrome/browser/BUILD.gn
+@@ -6708,6 +6708,13 @@ static_library("browser") {
+ }
+ }
+
++ if (is_bsd) {
++ sources -= [
++ "metrics/bluetooth_metrics_provider.cc",
++ "metrics/bluetooth_metrics_provider.h",
++ ]
++ }
++
+ if (is_linux && use_dbus) {
+ sources += [
+ "dbus_memory_pressure_evaluator_linux.cc",
diff --git a/devel/electron31/files/patch-chrome_browser_about__flags.cc b/devel/electron31/files/patch-chrome_browser_about__flags.cc
new file mode 100644
index 000000000000..e5424d03b3bd
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_about__flags.cc
@@ -0,0 +1,218 @@
+--- chrome/browser/about_flags.cc.orig 2024-06-18 21:43:21 UTC
++++ chrome/browser/about_flags.cc
+@@ -238,7 +238,7 @@
+ #include "ui/ui_features.h"
+ #include "url/url_features.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/allocator/buildflags.h"
+ #endif
+
+@@ -328,7 +328,7 @@
+ #include "device/vr/public/cpp/features.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "ui/ozone/public/ozone_switches.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
+
+@@ -337,7 +337,7 @@
+ #include "chrome/browser/win/titlebar_config.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/profile_management/profile_management_features.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
+
+@@ -482,7 +482,7 @@ const FeatureEntry::FeatureVariation kDXGIWaitableSwap
+ {"Max 3 Frames", &kDXGIWaitableSwapChain3Frames, 1, nullptr}};
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const FeatureEntry::Choice kOzonePlatformHintRuntimeChoices[] = {
+ {flag_descriptions::kOzonePlatformHintChoiceDefault, "", ""},
+ {flag_descriptions::kOzonePlatformHintChoiceAuto,
+@@ -1265,7 +1265,7 @@ const FeatureEntry::FeatureVariation kPageContentAnnot
+ };
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ const FeatureEntry::FeatureParam kHistoryEmbeddingsAtKeywordAcceleration[]{
+ {"AtKeywordAcceleration", "true"},
+ };
+@@ -1328,7 +1328,7 @@ const FeatureEntry::FeatureVariation
+ };
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ const FeatureEntry::FeatureParam kShortcutBoostSingleUrl[] = {
+ {"ShortcutBoostSearchScore", "0"},
+ {"ShortcutBoostNonTopHitThreshold", "0"},
+@@ -3679,7 +3679,7 @@ const flags_ui::FeatureEntry::FeatureVariation
+ std::size(kParcelTrackingTestDataOutForDelivery), nullptr},
+ };
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ const flags_ui::FeatureEntry::FeatureParam
+ kDesktopPWAsLinkCapturingDefaultOn[] = {{"on_by_default", "true"}};
+ const flags_ui::FeatureEntry::FeatureParam
+@@ -4511,7 +4511,7 @@ const FeatureEntry kFeatureEntries[] = {
+ },
+ #endif // BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {
+ "fluent-overlay-scrollbars",
+ flag_descriptions::kFluentOverlayScrollbarsName,
+@@ -4947,7 +4947,7 @@ const FeatureEntry kFeatureEntries[] = {
+ flag_descriptions::kWebAppUniversalInstallDescription, kOsDesktop,
+ FEATURE_VALUE_TYPE(features::kWebAppUniversalInstall)},
+ #endif // !BUILDFLAG(IS_ANDROID)
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {"shortcuts-not-apps", flag_descriptions::kShortcutsNotAppsName,
+ flag_descriptions::kShortcutsNotAppsDescription,
+ kOsMac | kOsWin | kOsLinux,
+@@ -5074,7 +5074,7 @@ const FeatureEntry kFeatureEntries[] = {
+ FEATURE_VALUE_TYPE(features::kWebShare)},
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) || BUILDFLAG(IS_BSD)
+ {"pulseaudio-loopback-for-cast",
+ flag_descriptions::kPulseaudioLoopbackForCastName,
+ flag_descriptions::kPulseaudioLoopbackForCastDescription, kOsLinux,
+@@ -5090,7 +5090,7 @@ const FeatureEntry kFeatureEntries[] = {
+ MULTI_VALUE_TYPE(kOzonePlatformHintRuntimeChoices)},
+ #endif // BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ {"skip-undecryptable-passwords",
+ flag_descriptions::kSkipUndecryptablePasswordsName,
+ flag_descriptions::kSkipUndecryptablePasswordsDescription,
+@@ -6011,7 +6011,7 @@ const FeatureEntry kFeatureEntries[] = {
+ FEATURE_VALUE_TYPE(omnibox::kZeroSuggestInMemoryCaching)},
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ {"omnibox-domain-suggestions",
+ flag_descriptions::kOmniboxDomainSuggestionsName,
+ flag_descriptions::kOmniboxDomainSuggestionsDescription, kOsDesktop,
+@@ -6331,7 +6331,7 @@ const FeatureEntry kFeatureEntries[] = {
+ "OrganicRepeatableQueries")},
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ {"history-embeddings", flag_descriptions::kHistoryEmbeddingsName,
+ flag_descriptions::kHistoryEmbeddingsDescription, kOsDesktop,
+ FEATURE_WITH_PARAMS_VALUE_TYPE(history_embeddings::kHistoryEmbeddings,
+@@ -7949,7 +7949,7 @@ const FeatureEntry kFeatureEntries[] = {
+ flag_descriptions::kCooperativeSchedulingDescription, kOsAll,
+ FEATURE_VALUE_TYPE(features::kCooperativeScheduling)},
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ {"enable-network-service-sandbox",
+ flag_descriptions::kEnableNetworkServiceSandboxName,
+ flag_descriptions::kEnableNetworkServiceSandboxDescription,
+@@ -7973,7 +7973,7 @@ const FeatureEntry kFeatureEntries[] = {
+ FEATURE_VALUE_TYPE(media::kV4L2FlatStatefulVideoDecoder)},
+ #endif
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ {"enable-family-link-extensions-permissions",
+ flag_descriptions::
+ kEnableExtensionsPermissionsForSupervisedUsersOnDesktopName,
+@@ -8810,7 +8810,7 @@ const FeatureEntry kFeatureEntries[] = {
+ FEATURE_VALUE_TYPE(ash::features::kWallpaperPerDesk)},
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {"enable-get-all-screens-media", flag_descriptions::kGetAllScreensMediaName,
+ flag_descriptions::kGetAllScreensMediaDescription,
+ kOsCrOS | kOsLacros | kOsLinux,
+@@ -8849,7 +8849,7 @@ const FeatureEntry kFeatureEntries[] = {
+
+ #if BUILDFLAG(IS_WIN) || \
+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ {
+ "ui-debug-tools",
+ flag_descriptions::kUIDebugToolsName,
+@@ -9086,7 +9086,7 @@ const FeatureEntry kFeatureEntries[] = {
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ {"policy-indication-for-managed-default-search",
+ flag_descriptions::kPolicyIndicationForManagedDefaultSearchName,
+ flag_descriptions::kPolicyIndicationForManagedDefaultSearchDescription,
+@@ -9393,7 +9393,7 @@ const FeatureEntry kFeatureEntries[] = {
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ {"media-session-enter-picture-in-picture",
+ flag_descriptions::kMediaSessionEnterPictureInPictureName,
+ flag_descriptions::kMediaSessionEnterPictureInPictureDescription,
+@@ -10303,7 +10303,7 @@ const FeatureEntry kFeatureEntries[] = {
+ kOsDesktop | kOsAndroid,
+ FEATURE_VALUE_TYPE(features::kProcessPerSiteUpToMainFrameThreshold)},
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {"camera-mic-effects", flag_descriptions::kCameraMicEffectsName,
+ flag_descriptions::kCameraMicEffectsDescription,
+ static_cast<unsigned short>(kOsMac | kOsWin | kOsLinux),
+@@ -10341,7 +10341,7 @@ const FeatureEntry kFeatureEntries[] = {
+ FEATURE_VALUE_TYPE(features::kSiteInstanceGroupsForDataUrls)},
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ {"show-featured-enterprise-site-search",
+ flag_descriptions::kShowFeaturedEnterpriseSiteSearchName,
+ flag_descriptions::kShowFeaturedEnterpriseSiteSearchDescription, kOsAll,
+@@ -10456,7 +10456,7 @@ const FeatureEntry kFeatureEntries[] = {
+ flag_descriptions::kHideIncognitoMediaMetadataDescription, kOsAll,
+ FEATURE_VALUE_TYPE(media::kHideIncognitoMediaMetadata)},
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ {"third-party-profile-management",
+ flag_descriptions::kThirdPartyProfileManagementName,
+ flag_descriptions::kThirdPartyProfileManagementDescription,
+@@ -10805,7 +10805,7 @@ const FeatureEntry kFeatureEntries[] = {
+ trusted_vault::kTrustedVaultFrequentDegradedRecoverabilityPolling)},
+ #endif
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {"restart-to-gain-access-to-keychain",
+ flag_descriptions::kRestartToGainAccessToKeychainName,
+ flag_descriptions::kRestartToGainAccessToKeychainDescription,
+@@ -11086,7 +11086,7 @@ const FeatureEntry kFeatureEntries[] = {
+
+ // Controls the view mode for (history) sync screen.
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ {"minor-mode-restrictions-for-history-sync-opt-in",
+ flag_descriptions::kMinorModeRestrictionsForHistorySyncOptInName,
+ flag_descriptions::kMinorModeRestrictionsForHistorySyncOptInDescription,
diff --git a/devel/electron31/files/patch-chrome_browser_after__startup__task__utils.cc b/devel/electron31/files/patch-chrome_browser_after__startup__task__utils.cc
new file mode 100644
index 000000000000..8cc0c1dd30bc
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_after__startup__task__utils.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/after_startup_task_utils.cc.orig 2024-04-15 20:33:45 UTC
++++ chrome/browser/after_startup_task_utils.cc
+@@ -115,7 +115,7 @@ void SetBrowserStartupIsComplete() {
+ TRACE_EVENT_SCOPE_GLOBAL, "BrowserCount", browser_count);
+ GetStartupCompleteFlag().Set();
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Process::Current().CreationTime() is not available on all platforms.
+ const base::Time process_creation_time =
+ base::Process::Current().CreationTime();
diff --git a/devel/electron31/files/patch-chrome_browser_apps_app__service_publishers_extension__apps.cc b/devel/electron31/files/patch-chrome_browser_apps_app__service_publishers_extension__apps.cc
new file mode 100644
index 000000000000..974564e532a4
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_apps_app__service_publishers_extension__apps.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/apps/app_service/publishers/extension_apps.cc.orig 2024-04-15 20:33:45 UTC
++++ chrome/browser/apps/app_service/publishers/extension_apps.cc
+@@ -23,7 +23,7 @@ bool ExtensionApps::Accepts(const extensions::Extensio
+ ExtensionApps::~ExtensionApps() = default;
+
+ bool ExtensionApps::Accepts(const extensions::Extension* extension) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (extensions::IsExtensionUnsupportedDeprecatedApp(profile(),
+ extension->id())) {
+ return false;
diff --git a/devel/electron31/files/patch-chrome_browser_apps_platform__apps_platform__app__launch.cc b/devel/electron31/files/patch-chrome_browser_apps_platform__apps_platform__app__launch.cc
new file mode 100644
index 000000000000..3d97a501fb91
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_apps_platform__apps_platform__app__launch.cc
@@ -0,0 +1,65 @@
+--- chrome/browser/apps/platform_apps/platform_app_launch.cc.orig 2024-04-15 20:33:45 UTC
++++ chrome/browser/apps/platform_apps/platform_app_launch.cc
+@@ -19,7 +19,7 @@
+ #include "extensions/common/constants.h"
+ #include "extensions/common/extension.h"
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/browser.h"
+ #include "chrome/browser/ui/browser_navigator.h"
+ #include "chrome/browser/ui/browser_window.h"
+@@ -86,7 +86,7 @@ bool OpenExtensionApplicationWindow(Profile* profile,
+ if (launch_container == LaunchContainer::kLaunchContainerTab)
+ return false;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (OpenDeprecatedApplicationPrompt(profile, app_id)) {
+ return false;
+ }
+@@ -118,7 +118,7 @@ content::WebContents* OpenExtensionApplicationTab(Prof
+ if (launch_container != apps::LaunchContainer::kLaunchContainerTab)
+ return nullptr;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (OpenDeprecatedApplicationPrompt(profile, app_id)) {
+ return nullptr;
+ }
+@@ -134,7 +134,7 @@ content::WebContents* OpenExtensionApplicationTab(Prof
+ return app_tab;
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool OpenDeprecatedApplicationPrompt(Profile* profile,
+ const std::string& app_id) {
+ if (!extensions::IsExtensionUnsupportedDeprecatedApp(profile, app_id))
+@@ -170,7 +170,7 @@ bool OpenExtensionApplicationWithReenablePrompt(
+ if (!GetPlatformApp(profile, app_id))
+ return false;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (OpenDeprecatedApplicationPrompt(profile, app_id)) {
+ return false;
+ }
+@@ -192,7 +192,7 @@ content::WebContents* OpenExtensionAppShortcutWindow(P
+ ->enabled_extensions()
+ .GetAppByURL(url);
+ if (app) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (OpenDeprecatedApplicationPrompt(profile, app->id())) {
+ return nullptr;
+ }
+@@ -215,7 +215,7 @@ void RecordExtensionAppLaunchOnTabRestored(Profile* pr
+ if (!extension)
+ return;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (OpenDeprecatedApplicationPrompt(profile, extension->id())) {
+ return;
+ }
diff --git a/devel/electron31/files/patch-chrome_browser_apps_platform__apps_platform__app__launch.h b/devel/electron31/files/patch-chrome_browser_apps_platform__apps_platform__app__launch.h
new file mode 100644
index 000000000000..dfaec412f898
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_apps_platform__apps_platform__app__launch.h
@@ -0,0 +1,11 @@
+--- chrome/browser/apps/platform_apps/platform_app_launch.h.orig 2024-06-18 21:43:21 UTC
++++ chrome/browser/apps/platform_apps/platform_app_launch.h
+@@ -38,7 +38,7 @@ content::WebContents* OpenExtensionApplicationTab(Prof
+ content::WebContents* OpenExtensionApplicationTab(Profile* profile,
+ const std::string& app_id);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Opens the deprecated Chrome Apps flow if |app_id| refers to a Chrome App and
+ // Chrome Apps are deprecated on the |profile|. Returns true if that was the
+ // case, or false otherwise.
diff --git a/devel/electron31/files/patch-chrome_browser_autocomplete_chrome__autocomplete__scheme__classifier.cc b/devel/electron31/files/patch-chrome_browser_autocomplete_chrome__autocomplete__scheme__classifier.cc
new file mode 100644
index 000000000000..aede11201088
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_autocomplete_chrome__autocomplete__scheme__classifier.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc
+@@ -88,7 +88,7 @@ ChromeAutocompleteSchemeClassifier::GetInputTypeForSch
+ return metrics::OmniboxInputType::QUERY;
+
+ case ExternalProtocolHandler::UNKNOWN: {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Linux impl of GetApplicationNameForScheme doesn't distinguish
+ // between URL schemes with handers and those without. This will
+ // make the default behaviour be search on Linux.
diff --git a/devel/electron31/files/patch-chrome_browser_background_background__mode__manager.cc b/devel/electron31/files/patch-chrome_browser_background_background__mode__manager.cc
new file mode 100644
index 000000000000..b1ed8f9f472f
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_background_background__mode__manager.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/background/background_mode_manager.cc.orig 2024-04-15 20:33:46 UTC
++++ chrome/browser/background/background_mode_manager.cc
+@@ -872,7 +872,7 @@ gfx::ImageSkia GetStatusTrayIcon() {
+ return gfx::ImageSkia();
+
+ return family->CreateExact(size).AsImageSkia();
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
+ IDR_PRODUCT_LOGO_128);
+ #elif BUILDFLAG(IS_MAC)
diff --git a/devel/electron31/files/patch-chrome_browser_background_background__mode__optimizer.cc b/devel/electron31/files/patch-chrome_browser_background_background__mode__optimizer.cc
new file mode 100644
index 000000000000..6375994f1a97
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_background_background__mode__optimizer.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/background/background_mode_optimizer.cc.orig 2024-04-15 20:33:46 UTC
++++ chrome/browser/background/background_mode_optimizer.cc
+@@ -31,7 +31,7 @@ std::unique_ptr<BackgroundModeOptimizer> BackgroundMod
+ return nullptr;
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (base::FeatureList::IsEnabled(features::kBackgroundModeAllowRestart)) {
+ // Private ctor.
+ return base::WrapUnique(new BackgroundModeOptimizer());
diff --git a/devel/electron31/files/patch-chrome_browser_browser__features.cc b/devel/electron31/files/patch-chrome_browser_browser__features.cc
new file mode 100644
index 000000000000..d0dd81de19ea
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_browser__features.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/browser_features.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/browser_features.cc
+@@ -82,7 +82,7 @@ BASE_FEATURE(kDestroyProfileOnBrowserClose,
+ BASE_FEATURE(kDestroyProfileOnBrowserClose,
+ "DestroyProfileOnBrowserClose",
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT);
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT);
+@@ -354,7 +354,7 @@ BASE_FEATURE(kSupportSearchSuggestionForPrerender2,
+ BASE_FEATURE(kSupportSearchSuggestionForPrerender2,
+ "SupportSearchSuggestionForPrerender2",
+ #if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) || \
+- BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT);
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT);
diff --git a/devel/electron31/files/patch-chrome_browser_browser__process__impl.cc b/devel/electron31/files/patch-chrome_browser_browser__process__impl.cc
new file mode 100644
index 000000000000..3ae4932dbc08
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_browser__process__impl.cc
@@ -0,0 +1,29 @@
+--- chrome/browser/browser_process_impl.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/browser_process_impl.cc
+@@ -229,7 +229,7 @@
+ #include "chrome/browser/ui/profiles/profile_picker.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/error_reporting/chrome_js_error_report_processor.h" // nogncheck
+ #endif
+
+@@ -1284,7 +1284,7 @@ void BrowserProcessImpl::PreMainMessageLoopRun() {
+
+ ApplyMetricsReportingPolicy();
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ChromeJsErrorReportProcessor::Create();
+ #endif
+
+@@ -1617,7 +1617,7 @@ void BrowserProcessImpl::Unpin() {
+ // Mac is currently not supported.
+ // TODO(crbug.com/40118868): Revisit once build flag switch of lacros-chrome is
+ // complete.
+-#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || BUILDFLAG(IS_BSD)
+
+ bool BrowserProcessImpl::IsRunningInBackground() const {
+ // Check if browser is in the background.
diff --git a/devel/electron31/files/patch-chrome_browser_browser__process__impl.h b/devel/electron31/files/patch-chrome_browser_browser__process__impl.h
new file mode 100644
index 000000000000..a0f320fbfd90
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_browser__process__impl.h
@@ -0,0 +1,11 @@
+--- chrome/browser/browser_process_impl.h.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/browser_process_impl.h
+@@ -404,7 +404,7 @@ class BrowserProcessImpl : public BrowserProcess,
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || BUILDFLAG(IS_BSD)
+ base::RepeatingTimer autoupdate_timer_;
+
+ // Gets called by autoupdate timer to see if browser needs restart and can be
diff --git a/devel/electron31/files/patch-chrome_browser_chrome__browser__interface__binders.cc b/devel/electron31/files/patch-chrome_browser_chrome__browser__interface__binders.cc
new file mode 100644
index 000000000000..60655ff1a115
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_chrome__browser__interface__binders.cc
@@ -0,0 +1,71 @@
+--- chrome/browser/chrome_browser_interface_binders.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/chrome_browser_interface_binders.cc
+@@ -132,12 +132,12 @@
+ #endif // BUILDFLAG(FULL_SAFE_BROWSING)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/connectors_internals/connectors_internals.mojom.h"
+ #include "chrome/browser/ui/webui/connectors_internals/connectors_internals_ui.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/app_settings/web_app_settings_ui.h"
+ #include "ui/webui/resources/cr_components/app_management/app_management.mojom.h"
+ #endif
+@@ -228,7 +228,7 @@
+ #endif // BUILDFLAG(IS_ANDROID)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/companion/visual_query/visual_query_suggestions_service_factory.h"
+ #include "chrome/browser/ui/web_applications/sub_apps_service_impl.h"
+ #include "chrome/browser/ui/webui/discards/discards.mojom.h"
+@@ -854,7 +854,7 @@ void BindScreen2xMainContentExtractor(
+ #endif
+
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ void BindVisualSuggestionsModelProvider(
+ content::RenderFrameHost* frame_host,
+ mojo::PendingReceiver<
+@@ -1050,7 +1050,7 @@ void PopulateChromeFrameBinders(
+ #endif // BUILDFLAG(ENABLE_SPEECH_SERVICE)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (base::FeatureList::IsEnabled(blink::features::kDesktopPWAsSubApps) &&
+ !render_frame_host->GetParentOrOuterDocument()) {
+ // The service binder will reject non-primary main frames, but we still need
+@@ -1137,7 +1137,7 @@ void PopulateChromeWebUIFrameBinders(
+ commerce::CommerceInternalsUI>(map);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ RegisterWebUIControllerInterfaceBinder<
+ connectors_internals::mojom::PageHandler,
+ enterprise_connectors::ConnectorsInternalsUI>(map);
+@@ -1148,7 +1148,7 @@ void PopulateChromeWebUIFrameBinders(
+ policy::DlpInternalsUI>(map);
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ RegisterWebUIControllerInterfaceBinder<
+ app_management::mojom::PageHandlerFactory, WebAppSettingsUI>(map);
+ #endif
+@@ -1759,7 +1759,7 @@ void PopulateChromeWebUIFrameBinders(
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ RegisterWebUIControllerInterfaceBinder<discards::mojom::DetailsProvider,
+ DiscardsUI>(map);
+
diff --git a/devel/electron31/files/patch-chrome_browser_chrome__browser__main.cc b/devel/electron31/files/patch-chrome_browser_chrome__browser__main.cc
new file mode 100644
index 000000000000..d39ec5621f87
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_chrome__browser__main.cc
@@ -0,0 +1,118 @@
+--- chrome/browser/chrome_browser_main.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/chrome_browser_main.cc
+@@ -247,15 +247,15 @@
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/first_run/upgrade_util_linux.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "components/crash/core/app/crashpad.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/nix/xdg_util.h"
+ #endif
+
+@@ -288,14 +288,14 @@
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/metrics/desktop_session_duration/desktop_session_duration_tracker.h"
+ #include "chrome/browser/metrics/desktop_session_duration/touch_mode_stats_tracker.h"
+ #include "chrome/browser/profiles/profile_activity_metrics_recorder.h"
+ #include "ui/base/pointer/touch_ui_controller.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/headless/headless_mode_metrics.h" // nogncheck
+ #include "chrome/browser/headless/headless_mode_util.h" // nogncheck
+ #include "components/headless/select_file_dialog/headless_select_file_dialog.h"
+@@ -367,14 +367,14 @@
+ #endif // BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER)
+
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "sql/database.h"
+ #endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ||
+ // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID)
+
+ namespace {
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ constexpr base::FilePath::CharType kMediaHistoryDatabaseName[] =
+ FILE_PATH_LITERAL("Media History");
+
+@@ -539,7 +539,7 @@ void ProcessSingletonNotificationCallbackImpl(
+ }
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Set the global activation token sent as a command line switch by another
+ // browser process. This also removes the switch after use to prevent any side
+ // effects of leaving it in the command line after this point.
+@@ -1100,7 +1100,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() {
+ browser_creator_->AddFirstRunTabs(master_prefs_->new_tabs);
+ }
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Create directory for user-level Native Messaging manifest files. This
+ // makes it less likely that the directory will be created by third-party
+ // software with incorrect owner or permission. See crbug.com/725513 .
+@@ -1148,7 +1148,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() {
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ metrics::DesktopSessionDurationTracker::Initialize();
+ ProfileActivityMetricsRecorder::Initialize();
+ TouchModeStatsTracker::Initialize(
+@@ -1333,7 +1333,7 @@ void ChromeBrowserMainParts::PostProfileInit(Profile*
+ #endif // BUILDFLAG(IS_WIN)
+
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // Delete the media history database if it still exists.
+ // TODO(crbug.com/40177301): Remove this.
+ base::ThreadPool::PostTask(
+@@ -1382,7 +1382,7 @@ void ChromeBrowserMainParts::PostProfileInit(Profile*
+ *UrlLanguageHistogramFactory::GetForBrowserContext(profile));
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (headless::IsHeadlessMode()) {
+ headless::ReportHeadlessActionMetrics();
+ }
+@@ -1492,7 +1492,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl(
+ // In headless mode provide alternate SelectFileDialog factory overriding
+ // any platform specific SelectFileDialog implementation that may have been
+ // set.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (headless::IsHeadlessMode()) {
+ headless::HeadlessSelectFileDialogFactory::SetUp();
+ }
+@@ -2043,7 +2043,7 @@ bool ChromeBrowserMainParts::ProcessSingletonNotificat
+
+ // Drop the request if headless mode is in effect or the request is from
+ // a headless Chrome process.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (headless::IsHeadlessMode() ||
+ command_line.HasSwitch(switches::kHeadless)) {
+ return false;
diff --git a/devel/electron31/files/patch-chrome_browser_chrome__browser__main__extra__parts__linux.cc b/devel/electron31/files/patch-chrome_browser_chrome__browser__main__extra__parts__linux.cc
new file mode 100644
index 000000000000..fb05f0a58b3e
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_chrome__browser__main__extra__parts__linux.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/chrome_browser_main_extra_parts_linux.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/chrome_browser_main_extra_parts_linux.cc
+@@ -58,7 +58,7 @@ void ChromeBrowserMainExtraPartsLinux::InitOzonePlatfo
+
+ // static
+ void ChromeBrowserMainExtraPartsLinux::InitOzonePlatformHint() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto* const command_line = base::CommandLine::ForCurrentProcess();
+ auto env = base::Environment::Create();
+ std::string desktop_startup_id;
diff --git a/devel/electron31/files/patch-chrome_browser_chrome__browser__main__extra__parts__ozone.cc b/devel/electron31/files/patch-chrome_browser_chrome__browser__main__extra__parts__ozone.cc
new file mode 100644
index 000000000000..ece2c8753fcf
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_chrome__browser__main__extra__parts__ozone.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/chrome_browser_main_extra_parts_ozone.cc.orig 2024-04-15 20:33:46 UTC
++++ chrome/browser/chrome_browser_main_extra_parts_ozone.cc
+@@ -27,7 +27,7 @@ void ChromeBrowserMainExtraPartsOzone::PostMainMessage
+ }
+
+ void ChromeBrowserMainExtraPartsOzone::PostMainMessageLoopRun() {
+-#if !BUILDFLAG(IS_CHROMEOS_LACROS) && !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_CHROMEOS_LACROS) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ // Lacros's `PostMainMessageLoopRun` must be called at the very end of
+ // `PostMainMessageLoopRun` in
+ // `ChromeBrowserMainPartsLacros::PostMainMessageLoopRun`.
diff --git a/devel/electron31/files/patch-chrome_browser_chrome__browser__main__linux.cc b/devel/electron31/files/patch-chrome_browser_chrome__browser__main__linux.cc
new file mode 100644
index 000000000000..a6b2d418e582
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_chrome__browser__main__linux.cc
@@ -0,0 +1,39 @@
+--- chrome/browser/chrome_browser_main_linux.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/chrome_browser_main_linux.cc
+@@ -25,7 +25,7 @@
+ #include "device/bluetooth/dbus/bluez_dbus_thread_manager.h"
+ #include "ui/base/l10n/l10n_util.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/ozone/public/ozone_platform.h"
+ #endif
+
+@@ -72,7 +72,9 @@ void ChromeBrowserMainPartsLinux::PostCreateMainMessag
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
+ #if !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_BSD)
+ bluez::BluezDBusManager::Initialize(nullptr /* system_bus */);
++#endif
+
+ // 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
+@@ -98,7 +100,7 @@ void ChromeBrowserMainPartsLinux::PostCreateMainMessag
+ ChromeBrowserMainPartsPosix::PostCreateMainMessageLoop();
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() {
+ ChromeBrowserMainPartsPosix::PostMainMessageLoopRun();
+ ui::OzonePlatform::GetInstance()->PostMainMessageLoopRun();
+@@ -137,7 +139,7 @@ void ChromeBrowserMainPartsLinux::PostDestroyThreads()
+ #endif // defined(USE_DBUS) && !BUILDFLAG(IS_CHROMEOS)
+
+ void ChromeBrowserMainPartsLinux::PostDestroyThreads() {
+-#if BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // No-op; per PostBrowserStart() comment, this is done elsewhere.
+ #else
+ bluez::BluezDBusManager::Shutdown();
diff --git a/devel/electron31/files/patch-chrome_browser_chrome__browser__main__linux.h b/devel/electron31/files/patch-chrome_browser_chrome__browser__main__linux.h
new file mode 100644
index 000000000000..b5c1116bb327
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_chrome__browser__main__linux.h
@@ -0,0 +1,11 @@
+--- chrome/browser/chrome_browser_main_linux.h.orig 2024-04-15 20:33:46 UTC
++++ chrome/browser/chrome_browser_main_linux.h
+@@ -30,7 +30,7 @@ class ChromeBrowserMainPartsLinux : public ChromeBrows
+
+ // ChromeBrowserMainPartsPosix overrides.
+ void PostCreateMainMessageLoop() override;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void PostMainMessageLoopRun() override;
+ #endif
+ void PreProfileInit() override;
diff --git a/devel/electron31/files/patch-chrome_browser_chrome__browser__main__posix.cc b/devel/electron31/files/patch-chrome_browser_chrome__browser__main__posix.cc
new file mode 100644
index 000000000000..e63dfa1ad42e
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_chrome__browser__main__posix.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/chrome_browser_main_posix.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/chrome_browser_main_posix.cc
+@@ -79,7 +79,7 @@ void ExitHandler::ExitWhenPossibleOnUIThread(int signa
+ } else {
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ switch (signal) {
+ case SIGINT:
+ case SIGHUP:
diff --git a/devel/electron31/files/patch-chrome_browser_chrome__content__browser__client.cc b/devel/electron31/files/patch-chrome_browser_chrome__content__browser__client.cc
new file mode 100644
index 000000000000..8b5b03816e26
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_chrome__content__browser__client.cc
@@ -0,0 +1,161 @@
+--- chrome/browser/chrome_content_browser_client.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/chrome_content_browser_client.cc
+@@ -468,7 +468,7 @@
+ #include "storage/browser/file_system/external_mount_points.h"
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/chrome_browser_main_linux.h"
+ #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h"
+ #elif BUILDFLAG(IS_ANDROID)
+@@ -578,12 +578,12 @@
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
+ #include "chrome/browser/browser_switcher/browser_switcher_navigation_throttle.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "components/crash/core/app/crash_switches.h"
+ #include "components/crash/core/app/crashpad.h"
+ #endif
+@@ -594,7 +594,7 @@
+ #include "chrome/browser/apps/link_capturing/web_app_link_capturing_delegate.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/chrome_browser_main_extra_parts_enterprise.h"
+ #include "chrome/browser/enterprise/profile_management/oidc_auth_response_capture_navigation_throttle.h"
+ #include "chrome/browser/enterprise/profile_management/profile_management_navigation_throttle.h"
+@@ -602,7 +602,7 @@
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/connectors/device_trust/navigation_throttle.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) ||
+ // BUILDFLAG(IS_CHROMEOS_ASH)
+@@ -617,7 +617,7 @@
+ #include "chrome/browser/ui/lens/lens_side_panel_navigation_helper.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/chrome_browser_main_extra_parts_linux.h"
+ #elif BUILDFLAG(IS_OZONE)
+ #include "chrome/browser/chrome_browser_main_extra_parts_ozone.h"
+@@ -1516,7 +1516,7 @@ void ChromeContentBrowserClient::RegisterLocalStatePre
+ #if BUILDFLAG(IS_CHROMEOS)
+ registry->RegisterBooleanPref(prefs::kNativeClientForceAllowed, false);
+ #endif // BUILDFLAG(IS_CHROMEOS)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ registry->RegisterBooleanPref(prefs::kOutOfProcessSystemDnsResolutionEnabled,
+ true);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID)
+@@ -1640,7 +1640,7 @@ ChromeContentBrowserClient::CreateBrowserMainParts(boo
+ #elif BUILDFLAG(IS_CHROMEOS_LACROS)
+ main_parts = std::make_unique<ChromeBrowserMainPartsLacros>(
+ is_integration_test, &startup_data_);
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ main_parts = std::make_unique<ChromeBrowserMainPartsLinux>(
+ is_integration_test, &startup_data_);
+ #elif BUILDFLAG(IS_ANDROID)
+@@ -1674,7 +1674,7 @@ ChromeContentBrowserClient::CreateBrowserMainParts(boo
+ std::make_unique<ChromeBrowserMainExtraPartsViewsLacros>());
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ main_parts->AddParts(
+ std::make_unique<ChromeBrowserMainExtraPartsViewsLinux>());
+ #else
+@@ -1695,7 +1695,7 @@ ChromeContentBrowserClient::CreateBrowserMainParts(boo
+ main_parts->AddParts(std::make_unique<ChromeBrowserMainExtraPartsLacros>());
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ main_parts->AddParts(std::make_unique<ChromeBrowserMainExtraPartsLinux>());
+ #elif BUILDFLAG(IS_OZONE)
+ main_parts->AddParts(std::make_unique<ChromeBrowserMainExtraPartsOzone>());
+@@ -1714,7 +1714,7 @@ ChromeContentBrowserClient::CreateBrowserMainParts(boo
+
+ chrome::AddMetricsExtraParts(main_parts.get());
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ main_parts->AddParts(
+ std::make_unique<
+ chrome::enterprise_util::ChromeBrowserMainExtraPartsEnterprise>());
+@@ -2551,7 +2551,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLin
+ client_info->client_id);
+ }
+ #elif BUILDFLAG(IS_POSIX)
+-#if !BUILDFLAG(IS_ANDROID)
++#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_BSD)
+ pid_t pid;
+ if (crash_reporter::GetHandlerSocket(nullptr, &pid)) {
+ command_line->AppendSwitchASCII(
+@@ -2886,7 +2886,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLin
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)) && !BUILDFLAG(IS_BSD)
+ // Opt into a hardened stack canary mitigation if it hasn't already been
+ // force-disabled.
+ if (!browser_command_line.HasSwitch(switches::kChangeStackGuardOnFork)) {
+@@ -4651,7 +4651,7 @@ void ChromeContentBrowserClient::GetAdditionalFileSyst
+ }
+ }
+
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD)
+ void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
+ const base::CommandLine& command_line,
+ int child_process_id,
+@@ -5205,7 +5205,7 @@ ChromeContentBrowserClient::CreateThrottlesForNavigati
+ &throttles);
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ MaybeAddThrottle(
+ WebAppSettingsNavigationThrottle::MaybeCreateThrottleFor(handle),
+ &throttles);
+@@ -5219,7 +5219,7 @@ ChromeContentBrowserClient::CreateThrottlesForNavigati
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ MaybeAddThrottle(enterprise_connectors::DeviceTrustNavigationThrottle::
+ MaybeCreateThrottleFor(handle),
+ &throttles);
+@@ -5258,7 +5258,7 @@ ChromeContentBrowserClient::CreateThrottlesForNavigati
+ handle));
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ MaybeAddThrottle(browser_switcher::BrowserSwitcherNavigationThrottle::
+ MaybeCreateThrottleFor(handle),
+ &throttles);
+@@ -7243,7 +7243,7 @@ bool ChromeContentBrowserClient::ShouldRunOutOfProcess
+ bool ChromeContentBrowserClient::ShouldRunOutOfProcessSystemDnsResolution() {
+ // This enterprise policy is supported on Android, but the feature will not be
+ // launched there.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // This is possibly called before `g_browser_process` is initialized.
+ PrefService* local_state;
+ if (g_browser_process) {
diff --git a/devel/electron31/files/patch-chrome_browser_chrome__content__browser__client.h b/devel/electron31/files/patch-chrome_browser_chrome__content__browser__client.h
new file mode 100644
index 000000000000..dbe05d5f269c
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_chrome__content__browser__client.h
@@ -0,0 +1,11 @@
+--- chrome/browser/chrome_content_browser_client.h.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/chrome_content_browser_client.h
+@@ -507,7 +507,7 @@ class ChromeContentBrowserClient : public content::Con
+ bool IsPluginAllowedToUseDevChannelAPIs(
+ content::BrowserContext* browser_context,
+ const GURL& url) override;
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD)
+ void GetAdditionalMappedFilesForChildProcess(
+ const base::CommandLine& command_line,
+ int child_process_id,
diff --git a/devel/electron31/files/patch-chrome_browser_component__updater_widevine__cdm__component__installer.cc b/devel/electron31/files/patch-chrome_browser_component__updater_widevine__cdm__component__installer.cc
new file mode 100644
index 000000000000..d21ea272523c
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_component__updater_widevine__cdm__component__installer.cc
@@ -0,0 +1,38 @@
+--- chrome/browser/component_updater/widevine_cdm_component_installer.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/component_updater/widevine_cdm_component_installer.cc
+@@ -41,7 +41,7 @@
+ #include "third_party/widevine/cdm/buildflags.h"
+ #include "third_party/widevine/cdm/widevine_cdm_common.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/path_service.h"
+ #include "chrome/common/chrome_paths.h"
+ #include "chrome/common/media/component_widevine_cdm_hint_file_linux.h"
+@@ -74,7 +74,7 @@ const char ImageLoaderComponentName[] = "WidevineCdm";
+ const char ImageLoaderComponentName[] = "WidevineCdm";
+ #endif
+
+-#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+ // On Linux and ChromeOS the Widevine CDM is loaded at startup before the
+ // zygote is locked down. As a result there is no need to register the CDM
+ // with Chrome as it can't be used until Chrome is restarted.
+@@ -102,7 +102,7 @@ void RegisterWidevineCdmWithChrome(const base::Version
+ }
+ #endif // !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On Linux and ChromeOS the Widevine CDM is loaded at startup before the
+ // zygote is locked down. To locate the Widevine CDM at startup, a hint file
+ // is used. Update the hint file with the new Widevine CDM path.
+@@ -398,7 +398,7 @@ void WidevineCdmComponentInstallerPolicy::UpdateCdmPat
+ return;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ VLOG(1) << "Updating hint file with Widevine CDM " << cdm_version;
+
+ // This is running on a thread that allows IO, so simply update the hint file.
diff --git a/devel/electron31/files/patch-chrome_browser_custom__handlers_chrome__protocol__handler__registry__delegate.cc b/devel/electron31/files/patch-chrome_browser_custom__handlers_chrome__protocol__handler__registry__delegate.cc
new file mode 100644
index 000000000000..3271f4e113a9
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_custom__handlers_chrome__protocol__handler__registry__delegate.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/custom_handlers/chrome_protocol_handler_registry_delegate.cc.orig 2023-03-30 00:33:42 UTC
++++ chrome/browser/custom_handlers/chrome_protocol_handler_registry_delegate.cc
+@@ -68,7 +68,7 @@ void ChromeProtocolHandlerRegistryDelegate::CheckDefau
+ // If true default protocol handlers will be removed if the OS level
+ // registration for a protocol is no longer Chrome.
+ bool ChromeProtocolHandlerRegistryDelegate::ShouldRemoveHandlersNotInOS() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // We don't do this on Linux as the OS registration there is not reliable,
+ // and Chrome OS doesn't have any notion of OS registration.
+ // TODO(benwells): When Linux support is more reliable remove this
diff --git a/devel/electron31/files/patch-chrome_browser_defaults.cc b/devel/electron31/files/patch-chrome_browser_defaults.cc
new file mode 100644
index 000000000000..e210570512b3
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_defaults.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/defaults.cc.orig 2023-10-19 19:58:04 UTC
++++ chrome/browser/defaults.cc
+@@ -44,7 +44,7 @@ const bool kShowHelpMenuItemIcon = true;
+ const bool kShowHelpMenuItemIcon = false;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const bool kScrollEventChangesTab = true;
+ #else
+ const bool kScrollEventChangesTab = false;
diff --git a/devel/electron31/files/patch-chrome_browser_device__identity_device__oauth2__token__service__factory.cc b/devel/electron31/files/patch-chrome_browser_device__identity_device__oauth2__token__service__factory.cc
new file mode 100644
index 000000000000..af3a10ca26ce
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_device__identity_device__oauth2__token__service__factory.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/device_identity/device_oauth2_token_service_factory.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/device_identity/device_oauth2_token_service_factory.cc
+@@ -28,7 +28,7 @@ std::unique_ptr<DeviceOAuth2TokenStore> CreatePlatform
+ return std::make_unique<chromeos::DeviceOAuth2TokenStoreChromeOS>(
+ local_state);
+ #elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || BUILDFLAG(IS_BSD)
+ return std::make_unique<DeviceOAuth2TokenStoreDesktop>(local_state);
+ #else
+ NOTREACHED();
diff --git a/devel/electron31/files/patch-chrome_browser_diagnostics_diagnostics__writer.h b/devel/electron31/files/patch-chrome_browser_diagnostics_diagnostics__writer.h
new file mode 100644
index 000000000000..43c1038a8248
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_diagnostics_diagnostics__writer.h
@@ -0,0 +1,11 @@
+--- chrome/browser/diagnostics/diagnostics_writer.h.orig 2022-02-07 13:39:41 UTC
++++ chrome/browser/diagnostics/diagnostics_writer.h
+@@ -14,6 +14,8 @@ namespace diagnostics {
+ // Console base class used internally.
+ class SimpleConsole;
+
++#undef MACHINE
++
+ class DiagnosticsWriter : public DiagnosticsModel::Observer {
+ public:
+ // The type of formatting done by this writer.
diff --git a/devel/electron31/files/patch-chrome_browser_download_chrome__download__manager__delegate.cc b/devel/electron31/files/patch-chrome_browser_download_chrome__download__manager__delegate.cc
new file mode 100644
index 000000000000..23b88d56f945
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_download_chrome__download__manager__delegate.cc
@@ -0,0 +1,29 @@
+--- chrome/browser/download/chrome_download_manager_delegate.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/download/chrome_download_manager_delegate.cc
+@@ -1714,7 +1714,7 @@ bool ChromeDownloadManagerDelegate::IsOpenInBrowserPre
+ bool ChromeDownloadManagerDelegate::IsOpenInBrowserPreferredForFile(
+ const base::FilePath& path) {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf"))) {
+ return !download_prefs_->ShouldOpenPdfInSystemReader();
+ }
+@@ -1860,7 +1860,7 @@ void ChromeDownloadManagerDelegate::CheckDownloadAllow
+ content::CheckDownloadAllowedCallback check_download_allowed_cb) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // Don't download pdf if it is a file URL, as that might cause an infinite
+ // download loop if Chrome is not the system pdf viewer.
+ if (url.SchemeIsFile() && download_prefs_->ShouldOpenPdfInSystemReader()) {
+@@ -1906,7 +1906,7 @@ void ChromeDownloadManagerDelegate::CheckSavePackageAl
+ DCHECK(download_item->IsSavePackageDownload());
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ std::optional<enterprise_connectors::AnalysisSettings> settings =
+ safe_browsing::DeepScanningRequest::ShouldUploadBinary(download_item);
+
diff --git a/devel/electron31/files/patch-chrome_browser_download_download__commands.cc b/devel/electron31/files/patch-chrome_browser_download_download__commands.cc
new file mode 100644
index 000000000000..bb6fee2e8152
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_download_download__commands.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/download/download_commands.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/download/download_commands.cc
+@@ -26,7 +26,7 @@
+ #include "ui/base/clipboard/scoped_clipboard_writer.h"
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/browser.h"
+ #include "chrome/browser/ui/browser_finder.h"
+ #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
+@@ -167,7 +167,7 @@ void DownloadCommands::ExecuteCommand(Command command)
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ Browser* DownloadCommands::GetBrowser() const {
+ if (!model_)
diff --git a/devel/electron31/files/patch-chrome_browser_download_download__commands.h b/devel/electron31/files/patch-chrome_browser_download_download__commands.h
new file mode 100644
index 000000000000..899c21f0d61b
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_download_download__commands.h
@@ -0,0 +1,11 @@
+--- chrome/browser/download/download_commands.h.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/download/download_commands.h
+@@ -66,7 +66,7 @@ class DownloadCommands {
+ void ExecuteCommand(Command command);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ bool IsDownloadPdf() const;
+ bool CanOpenPdfInSystemViewer() const;
+ Browser* GetBrowser() const;
diff --git a/devel/electron31/files/patch-chrome_browser_download_download__file__picker.cc b/devel/electron31/files/patch-chrome_browser_download_download__file__picker.cc
new file mode 100644
index 000000000000..4208f6771194
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_download_download__file__picker.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/download/download_file_picker.cc.orig 2024-02-21 00:20:34 UTC
++++ chrome/browser/download/download_file_picker.cc
+@@ -18,7 +18,7 @@
+ #include "content/public/browser/web_contents.h"
+ #include "ui/shell_dialogs/selected_file_info.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/browser_list.h"
+ #include "chrome/browser/ui/browser_window.h"
+ #include "ui/aura/window.h"
+@@ -83,7 +83,7 @@ DownloadFilePicker::DownloadFilePicker(download::Downl
+ // dialog in Linux (See SelectFileImpl() in select_file_dialog_linux_gtk.cc).
+ // and windows.Here we make owning_window host to browser current active
+ // window if it is null. https://crbug.com/1301898
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ if (!owning_window || !owning_window->GetHost()) {
+ owning_window = BrowserList::GetInstance()
+ ->GetLastActive()
diff --git a/devel/electron31/files/patch-chrome_browser_download_download__item__model.cc b/devel/electron31/files/patch-chrome_browser_download_download__item__model.cc
new file mode 100644
index 000000000000..553e16c6c5c2
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_download_download__item__model.cc
@@ -0,0 +1,29 @@
+--- chrome/browser/download/download_item_model.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/download/download_item_model.cc
+@@ -799,7 +799,7 @@ bool DownloadItemModel::IsCommandChecked(
+ download_crx_util::IsExtensionDownload(*download_);
+ case DownloadCommands::ALWAYS_OPEN_TYPE:
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (download_commands->CanOpenPdfInSystemViewer()) {
+ DownloadPrefs* prefs = DownloadPrefs::FromBrowserContext(profile());
+ return prefs->ShouldOpenPdfInSystemReader();
+@@ -847,7 +847,7 @@ void DownloadItemModel::ExecuteCommand(DownloadCommand
+ DownloadCommands::ALWAYS_OPEN_TYPE);
+ DownloadPrefs* prefs = DownloadPrefs::FromBrowserContext(profile());
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (download_commands->CanOpenPdfInSystemViewer()) {
+ prefs->SetShouldOpenPdfInSystemReader(!is_checked);
+ SetShouldPreferOpeningInBrowser(is_checked);
+@@ -1236,7 +1236,7 @@ void DownloadItemModel::DetermineAndSetShouldPreferOpe
+ return;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (download_->GetOriginalMimeType() == "application/x-x509-user-cert") {
+ SetShouldPreferOpeningInBrowser(true);
+ return;
diff --git a/devel/electron31/files/patch-chrome_browser_download_download__prefs.cc b/devel/electron31/files/patch-chrome_browser_download_download__prefs.cc
new file mode 100644
index 000000000000..44879e3bd321
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_download_download__prefs.cc
@@ -0,0 +1,90 @@
+--- chrome/browser/download/download_prefs.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/download/download_prefs.cc
+@@ -11,6 +11,7 @@
+ #include <vector>
+
+ #include "base/check.h"
++#include "base/command_line.h"
+ #include "base/feature_list.h"
+ #include "base/files/file_util.h"
+ #include "base/functional/bind.h"
+@@ -64,6 +65,10 @@
+ #include "chrome/browser/flags/android/chrome_feature_list.h"
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#endif
++
+ using content::BrowserContext;
+ using content::BrowserThread;
+ using content::DownloadManager;
+@@ -74,7 +79,7 @@ bool DownloadPathIsDangerous(const base::FilePath& dow
+ // Consider downloads 'dangerous' if they go to the home directory on Linux and
+ // to the desktop on any platform.
+ bool DownloadPathIsDangerous(const base::FilePath& download_path) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::FilePath home_dir = base::GetHomeDir();
+ if (download_path == home_dir) {
+ return true;
+@@ -180,7 +185,7 @@ DownloadPrefs::DownloadPrefs(Profile* profile) : profi
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ should_open_pdf_in_system_reader_ =
+ prefs->GetBoolean(prefs::kOpenPdfDownloadInSystemReader);
+ #endif
+@@ -304,7 +309,7 @@ void DownloadPrefs::RegisterProfilePrefs(
+ registry->RegisterFilePathPref(prefs::kSaveFileDefaultDirectory,
+ default_download_path);
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ registry->RegisterBooleanPref(prefs::kOpenPdfDownloadInSystemReader, false);
+ #endif
+ #if BUILDFLAG(IS_ANDROID)
+@@ -469,7 +474,7 @@ void DownloadPrefs::DisableAutoOpenByUserBasedOnExtens
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ void DownloadPrefs::SetShouldOpenPdfInSystemReader(bool should_open) {
+ if (should_open_pdf_in_system_reader_ == should_open)
+ return;
+@@ -501,7 +506,7 @@ void DownloadPrefs::ResetAutoOpenByUser() {
+
+ void DownloadPrefs::ResetAutoOpenByUser() {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ SetShouldOpenPdfInSystemReader(false);
+ #endif
+ auto_open_by_user_.clear();
+@@ -538,7 +543,7 @@ bool DownloadPrefs::CanPlatformEnableAutoOpenForPdf()
+ bool DownloadPrefs::CanPlatformEnableAutoOpenForPdf() const {
+ #if BUILDFLAG(IS_CHROMEOS)
+ return false; // There is no UI for auto-open on ChromeOS.
+-#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ return ShouldOpenPdfInSystemReader();
+ #else
+ return false;
+@@ -690,7 +695,14 @@ base::FilePath DownloadPrefs::SanitizeDownloadTargetPa
+ #else
+ // If the stored download directory is an absolute path, we presume it's
+ // correct; there's not really much more validation we can do here.
++#if BUILDFLAG(IS_OPENBSD)
++ // If unveil(2) is used, force the file dialog directory to something we
++ // know is available.
++ auto* sandbox = sandbox::policy::SandboxLinux::GetInstance();
++ if (!sandbox->unveil_initialized() && path.IsAbsolute())
++#else
+ if (path.IsAbsolute())
++#endif
+ return path;
+
+ // When the default download directory is *not* an absolute path, we use the
diff --git a/devel/electron31/files/patch-chrome_browser_download_download__prefs.h b/devel/electron31/files/patch-chrome_browser_download_download__prefs.h
new file mode 100644
index 000000000000..b636b64019e0
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_download_download__prefs.h
@@ -0,0 +1,20 @@
+--- chrome/browser/download/download_prefs.h.orig 2023-11-29 21:39:47 UTC
++++ chrome/browser/download/download_prefs.h
+@@ -115,7 +115,7 @@ class DownloadPrefs {
+ void DisableAutoOpenByUserBasedOnExtension(const base::FilePath& file_name);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // Store the user preference to disk. If |should_open| is true, also disable
+ // the built-in PDF plugin. If |should_open| is false, enable the PDF plugin.
+ void SetShouldOpenPdfInSystemReader(bool should_open);
+@@ -179,7 +179,7 @@ class DownloadPrefs {
+ std::unique_ptr<policy::URLBlocklist> auto_open_allowed_by_urls_;
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ bool should_open_pdf_in_system_reader_;
+ #endif
+
diff --git a/devel/electron31/files/patch-chrome_browser_enterprise_browser__management_browser__management__service.cc b/devel/electron31/files/patch-chrome_browser_enterprise_browser__management_browser__management__service.cc
new file mode 100644
index 000000000000..04d0c40a0acc
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_enterprise_browser__management_browser__management__service.cc
@@ -0,0 +1,29 @@
+--- chrome/browser/enterprise/browser_management/browser_management_service.cc.orig 2024-04-15 20:33:46 UTC
++++ chrome/browser/enterprise/browser_management/browser_management_service.cc
+@@ -21,7 +21,7 @@ namespace {
+
+ namespace {
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void UpdateEnterpriseLogo(
+ Profile* profile,
+ base::OnceCallback<void(const gfx::Image&,
+@@ -98,7 +98,7 @@ BrowserManagementMetadata::BrowserManagementMetadata(P
+ } // namespace
+
+ BrowserManagementMetadata::BrowserManagementMetadata(Profile* profile) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ UpdateManagementLogo(profile);
+ pref_change_registrar_.Init(profile->GetPrefs());
+ pref_change_registrar_.Add(
+@@ -114,7 +114,7 @@ const gfx::Image& BrowserManagementMetadata::GetManage
+ return management_logo_;
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void BrowserManagementMetadata::UpdateManagementLogo(Profile* profile) {
+ UpdateEnterpriseLogo(
+ profile, base::BindOnce(&BrowserManagementMetadata::SetManagementLogo,
diff --git a/devel/electron31/files/patch-chrome_browser_enterprise_browser__management_browser__management__service.h b/devel/electron31/files/patch-chrome_browser_enterprise_browser__management_browser__management__service.h
new file mode 100644
index 000000000000..ba45e31fb659
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_enterprise_browser__management_browser__management__service.h
@@ -0,0 +1,11 @@
+--- chrome/browser/enterprise/browser_management/browser_management_service.h.orig 2024-04-15 20:33:46 UTC
++++ chrome/browser/enterprise/browser_management/browser_management_service.h
+@@ -28,7 +28,7 @@ class BrowserManagementMetadata {
+
+ const gfx::Image& GetManagementLogo() const;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ private:
+ void UpdateManagementLogo(Profile* profile);
+ void SetManagementLogo(
diff --git a/devel/electron31/files/patch-chrome_browser_enterprise_connectors_analysis_analysis__service__settings.cc b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_analysis_analysis__service__settings.cc
new file mode 100644
index 000000000000..0e5384b80cdf
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_analysis_analysis__service__settings.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/enterprise/connectors/analysis/analysis_service_settings.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/enterprise/connectors/analysis/analysis_service_settings.cc
+@@ -151,7 +151,7 @@ AnalysisServiceSettings::AnalysisServiceSettings(
+ const char* verification_key = kKeyWindowsVerification;
+ #elif BUILDFLAG(IS_MAC)
+ const char* verification_key = kKeyMacVerification;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const char* verification_key = kKeyLinuxVerification;
+ #endif
+
diff --git a/devel/electron31/files/patch-chrome_browser_enterprise_connectors_connectors__service.cc b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_connectors__service.cc
new file mode 100644
index 000000000000..c65a0872938b
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_connectors__service.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/enterprise/connectors/connectors_service.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/enterprise/connectors/connectors_service.cc
+@@ -565,7 +565,7 @@ bool ConnectorsService::ConnectorsEnabled() const {
+
+ Profile* profile = Profile::FromBrowserContext(context_);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On desktop, the guest profile is actually the primary OTR profile of
+ // the "regular" guest profile. The regular guest profile is never used
+ // directly by users. Also, user are not able to create child OTR profiles
diff --git a/devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__connector__service__factory.cc b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__connector__service__factory.cc
new file mode 100644
index 000000000000..95af211b7ddd
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__connector__service__factory.cc
@@ -0,0 +1,29 @@
+--- chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service_factory.cc.orig 2023-11-29 21:39:47 UTC
++++ chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service_factory.cc
+@@ -10,7 +10,7 @@
+ #include "chrome/browser/profiles/profile.h"
+ #include "components/keyed_service/core/keyed_service.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/browser_process.h"
+ #include "chrome/browser/enterprise/connectors/device_trust/browser/signing_key_policy_observer.h"
+ #include "chrome/browser/policy/chrome_browser_policy_connector.h"
+@@ -40,7 +40,7 @@ bool DeviceTrustConnectorServiceFactory::ServiceIsCrea
+
+ bool DeviceTrustConnectorServiceFactory::ServiceIsCreatedWithBrowserContext()
+ const {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ return true;
+ #else
+ return false;
+@@ -79,7 +79,7 @@ DeviceTrustConnectorServiceFactory::BuildServiceInstan
+ std::unique_ptr<DeviceTrustConnectorService> service =
+ std::make_unique<DeviceTrustConnectorService>(profile->GetPrefs());
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ auto* key_manager = g_browser_process->browser_policy_connector()
+ ->chrome_browser_cloud_management_controller()
+ ->GetDeviceTrustKeyManager();
diff --git a/devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__service__factory.cc b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__service__factory.cc
new file mode 100644
index 000000000000..80bc2355d561
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__service__factory.cc
@@ -0,0 +1,29 @@
+--- chrome/browser/enterprise/connectors/device_trust/device_trust_service_factory.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/enterprise/connectors/device_trust/device_trust_service_factory.cc
+@@ -23,7 +23,7 @@
+ #include "components/policy/core/common/management/management_service.h"
+ #include "content/public/browser/browser_context.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/browser_process.h"
+ #include "chrome/browser/enterprise/connectors/device_trust/attestation/browser/browser_attestation_service.h"
+ #include "chrome/browser/enterprise/connectors/device_trust/attestation/browser/device_attester.h"
+@@ -54,7 +54,7 @@ bool IsProfileManaged(Profile* profile) {
+ return management_service && management_service->IsManaged();
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ policy::CloudPolicyStore* GetUserCloudPolicyStore(Profile* profile) {
+ policy::CloudPolicyManager* user_policy_manager =
+ profile->GetCloudPolicyManager();
+@@ -101,7 +101,7 @@ DeviceTrustServiceFactory::DeviceTrustServiceFactory()
+ DependsOn(DeviceTrustConnectorServiceFactory::GetInstance());
+ DependsOn(policy::ManagementServiceFactory::GetInstance());
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Depends on this service via the SignalsService having a dependency on it.
+ DependsOn(enterprise_signals::SignalsAggregatorFactory::GetInstance());
+ // Depends on this service via the ProfileAttester having a dependency on it
diff --git a/devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_key__management_browser_commands_key__rotation__command__factory.cc b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_key__management_browser_commands_key__rotation__command__factory.cc
new file mode 100644
index 000000000000..b3c365ccb66c
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_key__management_browser_commands_key__rotation__command__factory.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/key_rotation_command_factory.cc.orig 2024-02-21 00:20:34 UTC
++++ chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/key_rotation_command_factory.cc
+@@ -14,7 +14,7 @@
+
+ #if BUILDFLAG(IS_WIN)
+ #include "chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/win_key_rotation_command.h"
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/linux_key_rotation_command.h"
+ #elif BUILDFLAG(IS_MAC)
+ #include "chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/mac_key_rotation_command.h"
+@@ -47,7 +47,7 @@ std::unique_ptr<KeyRotationCommand> KeyRotationCommand
+ scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) {
+ #if BUILDFLAG(IS_WIN)
+ return std::make_unique<WinKeyRotationCommand>();
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return std::make_unique<LinuxKeyRotationCommand>(url_loader_factory);
+ #elif BUILDFLAG(IS_MAC)
+ return std::make_unique<MacKeyRotationCommand>(url_loader_factory);
diff --git a/devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_key__management_core_persistence_key__persistence__delegate__factory.cc b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_key__management_core_persistence_key__persistence__delegate__factory.cc
new file mode 100644
index 000000000000..9710b4d0893f
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_key__management_core_persistence_key__persistence__delegate__factory.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/enterprise/connectors/device_trust/key_management/core/persistence/key_persistence_delegate_factory.cc.orig 2023-08-10 01:48:35 UTC
++++ chrome/browser/enterprise/connectors/device_trust/key_management/core/persistence/key_persistence_delegate_factory.cc
+@@ -13,7 +13,7 @@
+ #include "chrome/browser/enterprise/connectors/device_trust/key_management/core/persistence/win_key_persistence_delegate.h"
+ #elif BUILDFLAG(IS_MAC)
+ #include "chrome/browser/enterprise/connectors/device_trust/key_management/core/persistence/mac_key_persistence_delegate.h"
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/connectors/device_trust/key_management/core/persistence/linux_key_persistence_delegate.h"
+ #endif
+
+@@ -45,7 +45,7 @@ KeyPersistenceDelegateFactory::CreateKeyPersistenceDel
+ return std::make_unique<WinKeyPersistenceDelegate>();
+ #elif BUILDFLAG(IS_MAC)
+ return std::make_unique<MacKeyPersistenceDelegate>();
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return std::make_unique<LinuxKeyPersistenceDelegate>();
+ #else
+ NOTREACHED();
diff --git a/devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_signals_signals__service__factory.cc b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_signals_signals__service__factory.cc
new file mode 100644
index 000000000000..f50d21511cdf
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_device__trust_signals_signals__service__factory.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/enterprise/connectors/device_trust/signals/signals_service_factory.cc.orig 2023-08-10 01:48:35 UTC
++++ chrome/browser/enterprise/connectors/device_trust/signals/signals_service_factory.cc
+@@ -21,7 +21,7 @@
+ #include "chrome/browser/profiles/profile.h"
+ #include "components/policy/core/common/management/management_service.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "base/check.h"
+ #include "chrome/browser/enterprise/connectors/device_trust/signals/decorators/browser/browser_signals_decorator.h"
+ #include "chrome/browser/enterprise/connectors/device_trust/signals/dependency_factory.h"
+@@ -58,7 +58,7 @@ std::unique_ptr<SignalsService> CreateSignalsService(P
+ enterprise_signals::ContextInfoFetcher::CreateInstance(
+ profile, ConnectorsServiceFactory::GetForBrowserContext(profile))));
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+
+ policy::CloudPolicyManager* browser_policy_manager = nullptr;
+ if (management_service->HasManagementAuthority(
diff --git a/devel/electron31/files/patch-chrome_browser_enterprise_connectors_reporting_browser__crash__event__router.cc b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_reporting_browser__crash__event__router.cc
new file mode 100644
index 000000000000..d5cc035bd254
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_reporting_browser__crash__event__router.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/enterprise/connectors/reporting/browser_crash_event_router.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/enterprise/connectors/reporting/browser_crash_event_router.cc
+@@ -11,7 +11,7 @@ BrowserCrashEventRouter::BrowserCrashEventRouter(
+
+ BrowserCrashEventRouter::BrowserCrashEventRouter(
+ content::BrowserContext* context) {
+-#if !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+ CrashReportingContext* crash_reporting_context =
+ CrashReportingContext::GetInstance();
+ Profile* profile = Profile::FromBrowserContext(context);
+@@ -21,7 +21,7 @@ BrowserCrashEventRouter::~BrowserCrashEventRouter() {
+ }
+
+ BrowserCrashEventRouter::~BrowserCrashEventRouter() {
+-#if !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+ CrashReportingContext* crash_reporting_context =
+ CrashReportingContext::GetInstance();
+ crash_reporting_context->RemoveProfile(this);
diff --git a/devel/electron31/files/patch-chrome_browser_enterprise_connectors_reporting_crash__reporting__context.cc b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_reporting_crash__reporting__context.cc
new file mode 100644
index 000000000000..842e4ba8a104
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_reporting_crash__reporting__context.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/enterprise/connectors/reporting/crash_reporting_context.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/enterprise/connectors/reporting/crash_reporting_context.cc
+@@ -18,7 +18,7 @@ namespace enterprise_connectors {
+
+ namespace enterprise_connectors {
+
+-#if !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+
+ namespace {
+
diff --git a/devel/electron31/files/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.cc b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.cc
new file mode 100644
index 000000000000..b9d1e4f26086
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.cc
@@ -0,0 +1,38 @@
+--- chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.cc.orig 2024-04-15 20:33:46 UTC
++++ chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.cc
+@@ -58,7 +58,7 @@
+ #include "base/strings/utf_string_conversions.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/signals/signals_aggregator_factory.h"
+ #include "components/device_signals/core/browser/signals_aggregator.h"
+ #include "components/device_signals/core/common/signals_constants.h"
+@@ -132,7 +132,7 @@ void UploadSecurityEventReport(base::Value::Dict event
+ std::move(upload_callback));
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void PopulateSignals(base::Value::Dict event,
+ policy::CloudPolicyClient* client,
+ std::string name,
+@@ -420,7 +420,7 @@ void RealtimeReportingClient::ReportPastEvent(const st
+ /*include_profile_user_name=*/false);
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ void AddCrowdstrikeSignalsToEvent(
+ base::Value::Dict& event,
+@@ -479,7 +479,7 @@ void RealtimeReportingClient::ReportEventWithTimestamp
+ if (include_profile_user_name) {
+ event.Set(kKeyProfileUserName, GetProfileUserName());
+ }
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ Profile* profile = Profile::FromBrowserContext(context_);
+ device_signals::SignalsAggregator* signals_aggregator =
+ enterprise_signals::SignalsAggregatorFactory::GetForProfile(profile);
diff --git a/devel/electron31/files/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.h b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.h
new file mode 100644
index 000000000000..e953940ad410
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.h
@@ -0,0 +1,20 @@
+--- chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.h.orig 2023-10-19 19:58:04 UTC
++++ chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.h
+@@ -16,7 +16,7 @@
+ #include "components/keyed_service/core/keyed_service.h"
+ #include "components/policy/core/common/cloud/cloud_policy_client.h"
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "components/device_signals/core/browser/signals_types.h"
+ #endif
+
+@@ -184,7 +184,7 @@ class RealtimeReportingClient : public KeyedService,
+ base::WeakPtrFactory<RealtimeReportingClient> weak_ptr_factory_{this};
+ };
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Populate event dict with CrowdStrike signal values. If those signals are
+ // available in `response`, this function returns a Dict with the following
+ // fields added:
diff --git a/devel/electron31/files/patch-chrome_browser_enterprise_identifiers_profile__id__delegate__impl.cc b/devel/electron31/files/patch-chrome_browser_enterprise_identifiers_profile__id__delegate__impl.cc
new file mode 100644
index 000000000000..bddb43d27102
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_enterprise_identifiers_profile__id__delegate__impl.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/enterprise/identifiers/profile_id_delegate_impl.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/enterprise/identifiers/profile_id_delegate_impl.cc
+@@ -13,7 +13,7 @@
+ #include "components/enterprise/browser/identifiers/identifiers_prefs.h"
+ #include "components/prefs/pref_service.h"
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "components/enterprise/browser/controller/browser_dm_token_storage.h"
+ #if BUILDFLAG(IS_WIN)
+ #include "base/strings/utf_string_conversions.h"
+@@ -94,7 +94,7 @@ std::string ProfileIdDelegateImpl::GetDeviceId() {
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // Gets the device ID from the BrowserDMTokenStorage.
+ std::string ProfileIdDelegateImpl::GetId() {
+ std::string device_id =
diff --git a/devel/electron31/files/patch-chrome_browser_enterprise_profile__management_profile__management__navigation__throttle.cc b/devel/electron31/files/patch-chrome_browser_enterprise_profile__management_profile__management__navigation__throttle.cc
new file mode 100644
index 000000000000..0577a9387f82
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_enterprise_profile__management_profile__management__navigation__throttle.cc
@@ -0,0 +1,13 @@
+--- chrome/browser/enterprise/profile_management/profile_management_navigation_throttle.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/enterprise/profile_management/profile_management_navigation_throttle.cc
+@@ -67,8 +67,8 @@ base::flat_map<std::string, SAMLProfileAttributes>& Ge
+ // TODO(crbug.com/40267996): Add actual domains with attribute names.
+ profile_attributes->insert(std::make_pair(
+ "supported.test",
+- SAMLProfileAttributes("placeholderName", "placeholderDomain",
+- "placeholderToken")));
++ SAMLProfileAttributes(SAMLProfileAttributes{"placeholderName", "placeholderDomain",
++ "placeholderToken"})));
+
+ // Extract domains and attributes from the command line switch.
+ const base::CommandLine& command_line =
diff --git a/devel/electron31/files/patch-chrome_browser_enterprise_remote__commands_cbcm__remote__commands__factory.cc b/devel/electron31/files/patch-chrome_browser_enterprise_remote__commands_cbcm__remote__commands__factory.cc
new file mode 100644
index 000000000000..46b9ab15d198
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_enterprise_remote__commands_cbcm__remote__commands__factory.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/enterprise/remote_commands/cbcm_remote_commands_factory.cc.orig 2023-11-29 21:39:48 UTC
++++ chrome/browser/enterprise/remote_commands/cbcm_remote_commands_factory.cc
+@@ -11,7 +11,7 @@
+ #include "chrome/browser/profiles/profile_manager.h"
+ #include "components/policy/core/common/remote_commands/remote_command_job.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/remote_commands/rotate_attestation_credential_job.h"
+ #include "chrome/browser/policy/chrome_browser_policy_connector.h"
+ #include "components/enterprise/browser/controller/chrome_browser_cloud_management_controller.h"
+@@ -30,7 +30,7 @@ CBCMRemoteCommandsFactory::BuildJobForType(
+ g_browser_process->profile_manager());
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (type == enterprise_management::
+ RemoteCommand_Type_BROWSER_ROTATE_ATTESTATION_CREDENTIAL) {
+ return std::make_unique<RotateAttestationCredentialJob>(
diff --git a/devel/electron31/files/patch-chrome_browser_enterprise_signals_device__info__fetcher.cc b/devel/electron31/files/patch-chrome_browser_enterprise_signals_device__info__fetcher.cc
new file mode 100644
index 000000000000..ca94f525274f
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_enterprise_signals_device__info__fetcher.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/enterprise/signals/device_info_fetcher.cc.orig 2023-10-19 19:58:04 UTC
++++ chrome/browser/enterprise/signals/device_info_fetcher.cc
+@@ -10,7 +10,7 @@
+ #include "chrome/browser/enterprise/signals/device_info_fetcher_mac.h"
+ #elif BUILDFLAG(IS_WIN)
+ #include "chrome/browser/enterprise/signals/device_info_fetcher_win.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/signals/device_info_fetcher_linux.h"
+ #endif
+
+@@ -67,7 +67,7 @@ std::unique_ptr<DeviceInfoFetcher> DeviceInfoFetcher::
+ return CreateInstanceInternal();
+ }
+
+-#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_WIN) && \
++#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_BSD) && \
+ !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
+ // static
+ std::unique_ptr<DeviceInfoFetcher> DeviceInfoFetcher::CreateInstanceInternal() {
diff --git a/devel/electron31/files/patch-chrome_browser_enterprise_signals_device__info__fetcher__linux.cc b/devel/electron31/files/patch-chrome_browser_enterprise_signals_device__info__fetcher__linux.cc
new file mode 100644
index 000000000000..7499a1993a65
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_enterprise_signals_device__info__fetcher__linux.cc
@@ -0,0 +1,78 @@
+--- chrome/browser/enterprise/signals/device_info_fetcher_linux.cc.orig 2023-10-19 19:58:04 UTC
++++ chrome/browser/enterprise/signals/device_info_fetcher_linux.cc
+@@ -4,12 +4,23 @@
+
+ #include "chrome/browser/enterprise/signals/device_info_fetcher_linux.h"
+
++#include "build/build_config.h"
++
+ #if defined(USE_GIO)
+ #include <gio/gio.h>
+ #endif // defined(USE_GIO)
+ #include <sys/stat.h>
++#if !BUILDFLAG(IS_BSD)
+ #include <sys/sysmacros.h>
++#endif
+
++#if BUILDFLAG(IS_BSD)
++#include <sys/types.h>
++#include <sys/socket.h>
++#include <ifaddrs.h>
++#include <net/if_dl.h>
++#endif
++
+ #include <string>
+
+ #include "base/environment.h"
+@@ -118,6 +129,7 @@ SettingValue GetScreenlockSecured() {
+ // Implements the logic from the native host installation script. First find the
+ // root device identifier, then locate its parent and get its type.
+ SettingValue GetDiskEncrypted() {
++#if !BUILDFLAG(IS_BSD)
+ struct stat info;
+ // First figure out the device identifier. Fail fast if this fails.
+ if (stat("/", &info) != 0)
+@@ -139,11 +151,35 @@ SettingValue GetDiskEncrypted() {
+ }
+ return SettingValue::UNKNOWN;
+ }
++#endif
+ return SettingValue::DISABLED;
+ }
+
+ std::vector<std::string> GetMacAddresses() {
+ std::vector<std::string> result;
++#if BUILDFLAG(IS_BSD)
++ struct ifaddrs* ifa = nullptr;
++
++ if (getifaddrs(&ifa) != 0)
++ return result;
++
++ struct ifaddrs* interface = ifa;
++ for (; interface != nullptr; interface = interface->ifa_next) {
++ if (interface->ifa_addr == nullptr ||
++ interface->ifa_addr->sa_family != AF_LINK) {
++ continue;
++ }
++ struct sockaddr_dl* sdl =
++ reinterpret_cast<struct sockaddr_dl*>(interface->ifa_addr);
++ if (!sdl || sdl->sdl_alen != 6)
++ continue;
++ char* link_address = static_cast<char*>(LLADDR(sdl));
++ result.push_back(base::StringPrintf(
++ "%02x:%02x:%02x:%02x:%02x:%02x", link_address[0] & 0xff,
++ link_address[1] & 0xff, link_address[2] & 0xff, link_address[3] & 0xff,
++ link_address[4] & 0xff, link_address[5] & 0xff));
++ }
++#else
+ base::DirReaderPosix reader("/sys/class/net");
+ if (!reader.IsValid())
+ return result;
+@@ -166,6 +202,7 @@ std::vector<std::string> GetMacAddresses() {
+ &address);
+ result.push_back(address);
+ }
++#endif
+ return result;
+ }
+
diff --git a/devel/electron31/files/patch-chrome_browser_enterprise_watermark_watermark__view.cc b/devel/electron31/files/patch-chrome_browser_enterprise_watermark_watermark__view.cc
new file mode 100644
index 000000000000..a6e6fcf1a5a8
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_enterprise_watermark_watermark__view.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/enterprise/watermark/watermark_view.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/enterprise/watermark/watermark_view.cc
+@@ -36,7 +36,7 @@ gfx::Font WatermarkFont() {
+ "Segoe UI",
+ #elif BUILDFLAG(IS_MAC)
+ "SF Pro Text",
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ "Ubuntu",
+ #elif BUILDFLAG(IS_CHROMEOS)
+ "Google Sans",
+@@ -47,7 +47,7 @@ gfx::Font::Weight WatermarkFontWeight() {
+ }
+
+ gfx::Font::Weight WatermarkFontWeight() {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return gfx::Font::Weight::SEMIBOLD;
+ #else
+ return gfx::Font::Weight::MEDIUM;
diff --git a/devel/electron31/files/patch-chrome_browser_extensions_BUILD.gn b/devel/electron31/files/patch-chrome_browser_extensions_BUILD.gn
new file mode 100644
index 000000000000..5f99d05c574f
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_extensions_BUILD.gn
@@ -0,0 +1,13 @@
+--- chrome/browser/extensions/BUILD.gn.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/extensions/BUILD.gn
+@@ -1391,6 +1391,10 @@ static_library("extensions") {
+ deps += [ "//chrome/services/printing/public/mojom" ]
+ }
+
++ if (is_bsd) {
++ sources -= [ "api/image_writer_private/removable_storage_provider_linux.cc" ]
++ }
++
+ if (enable_service_discovery) {
+ sources += [
+ "api/mdns/mdns_api.cc",
diff --git a/devel/electron31/files/patch-chrome_browser_extensions_api_api__browser__context__keyed__service__factories.cc b/devel/electron31/files/patch-chrome_browser_extensions_api_api__browser__context__keyed__service__factories.cc
new file mode 100644
index 000000000000..b59f8c7a94a1
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_extensions_api_api__browser__context__keyed__service__factories.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/extensions/api/api_browser_context_keyed_service_factories.cc.orig 2024-04-15 20:33:46 UTC
++++ chrome/browser/extensions/api/api_browser_context_keyed_service_factories.cc
+@@ -45,7 +45,7 @@
+ #include "printing/buildflags/buildflags.h"
+ #include "services/screen_ai/buildflags/buildflags.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/extensions/api/system_indicator/system_indicator_manager_factory.h"
+ #endif
+
+@@ -128,7 +128,7 @@ void EnsureApiBrowserContextKeyedServiceFactoriesBuilt
+ extensions::SettingsPrivateEventRouterFactory::GetInstance();
+ extensions::SettingsOverridesAPI::GetFactoryInstance();
+ extensions::SidePanelService::GetFactoryInstance();
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ extensions::SystemIndicatorManagerFactory::GetInstance();
+ #endif
+ extensions::TabGroupsEventRouterFactory::GetInstance();
diff --git a/devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_chrome__desktop__report__request__helper.cc b/devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_chrome__desktop__report__request__helper.cc
new file mode 100644
index 000000000000..19fdcd6750ae
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_chrome__desktop__report__request__helper.cc
@@ -0,0 +1,29 @@
+--- chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_helper.cc.orig 2024-02-21 00:20:34 UTC
++++ chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_helper.cc
+@@ -24,7 +24,7 @@
+ #include "base/win/registry.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/environment.h"
+ #include "base/nix/xdg_util.h"
+ #endif
+@@ -255,7 +255,7 @@ base::FilePath GetEndpointVerificationDir() {
+ bool got_path = false;
+ #if BUILDFLAG(IS_WIN)
+ got_path = base::PathService::Get(base::DIR_LOCAL_APP_DATA, &path);
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
+ path = base::nix::GetXDGDirectory(env.get(), base::nix::kXdgConfigHomeEnvVar,
+ base::nix::kDotConfigDir);
+@@ -266,7 +266,7 @@ base::FilePath GetEndpointVerificationDir() {
+ if (!got_path)
+ return path;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ path = path.AppendASCII("google");
+ #else
+ path = path.AppendASCII("Google");
diff --git a/devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.cc b/devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.cc
new file mode 100644
index 000000000000..82dd2b1604b2
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/extensions/api/enterprise_reporting_private/conversion_utils.cc.orig 2022-11-30 08:12:58 UTC
++++ chrome/browser/extensions/api/enterprise_reporting_private/conversion_utils.cc
+@@ -8,7 +8,7 @@
+
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ #include <memory>
+ #include <utility>
diff --git a/devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.h b/devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.h
new file mode 100644
index 000000000000..9cbee717bae0
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.h
@@ -0,0 +1,11 @@
+--- chrome/browser/extensions/api/enterprise_reporting_private/conversion_utils.h.orig 2024-02-21 00:20:34 UTC
++++ chrome/browser/extensions/api/enterprise_reporting_private/conversion_utils.h
+@@ -7,7 +7,7 @@
+
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ #include <optional>
+ #include <vector>
diff --git a/devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.cc b/devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.cc
new file mode 100644
index 000000000000..f5d17637e615
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.cc
@@ -0,0 +1,38 @@
+--- chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc
+@@ -33,7 +33,7 @@
+ #include "components/reporting/util/statusor.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include <optional>
+
+ #include "base/strings/string_util.h"
+@@ -150,7 +150,7 @@ api::enterprise_reporting_private::ContextInfo ToConte
+ return info;
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ device_signals::SignalsAggregationRequest CreateAggregationRequest(
+ device_signals::SignalName signal_name) {
+@@ -211,7 +211,7 @@ EnterpriseReportingPrivateGetDeviceIdFunction::
+
+ // getPersistentSecret
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+
+ EnterpriseReportingPrivateGetPersistentSecretFunction::
+ EnterpriseReportingPrivateGetPersistentSecretFunction() = default;
+@@ -637,7 +637,7 @@ void EnterpriseReportingPrivateEnqueueRecordFunction::
+ }
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ // getFileSystemInfo
+
diff --git a/devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.h b/devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.h
new file mode 100644
index 000000000000..65033dd688ae
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.h
@@ -0,0 +1,29 @@
+--- chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.h.orig 2023-03-30 00:33:42 UTC
++++ chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.h
+@@ -20,7 +20,7 @@
+ #include "components/reporting/proto/synced/record.pb.h"
+ #include "components/reporting/proto/synced/record_constants.pb.h"
+ #include "components/reporting/util/statusor.h"
+-#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/time/time.h"
+ #include "components/device_signals/core/browser/signals_types.h"
+ #endif // BUILDFLAG(IS_CHROMEOS)
+@@ -56,7 +56,7 @@ class EnterpriseReportingPrivateGetDeviceIdFunction :
+ ~EnterpriseReportingPrivateGetDeviceIdFunction() override;
+ };
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+
+ class EnterpriseReportingPrivateGetPersistentSecretFunction
+ : public ExtensionFunction {
+@@ -266,7 +266,7 @@ class EnterpriseReportingPrivateEnqueueRecordFunction
+
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ class EnterpriseReportingPrivateGetFileSystemInfoFunction
+ : public ExtensionFunction {
diff --git a/devel/electron31/files/patch-chrome_browser_extensions_api_image__writer__private_removable__storage__provider.cc b/devel/electron31/files/patch-chrome_browser_extensions_api_image__writer__private_removable__storage__provider.cc
new file mode 100644
index 000000000000..4ae88b1de3b7
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_extensions_api_image__writer__private_removable__storage__provider.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/extensions/api/image_writer_private/removable_storage_provider.cc.orig 2023-10-19 19:58:04 UTC
++++ chrome/browser/extensions/api/image_writer_private/removable_storage_provider.cc
+@@ -20,6 +20,7 @@ static base::LazyInstance<scoped_refptr<StorageDeviceL
+
+ void RemovableStorageProvider::GetAllDevices(DeviceListReadyCallback callback) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
++#if !BUILDFLAG(IS_BSD)
+ if (g_test_device_list.Get().get() != nullptr) {
+ base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
+ FROM_HERE,
+@@ -33,6 +34,9 @@ void RemovableStorageProvider::GetAllDevices(DeviceLis
+ base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
+ base::BindOnce(&RemovableStorageProvider::PopulateDeviceList),
+ std::move(callback));
++#else
++ NOTIMPLEMENTED();
++#endif
+ }
+
+ // static
diff --git a/devel/electron31/files/patch-chrome_browser_extensions_api_management_chrome__management__api__delegate.cc b/devel/electron31/files/patch-chrome_browser_extensions_api_management_chrome__management__api__delegate.cc
new file mode 100644
index 000000000000..57a4e1dd3c16
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_extensions_api_management_chrome__management__api__delegate.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/extensions/api/management/chrome_management_api_delegate.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/extensions/api/management/chrome_management_api_delegate.cc
+@@ -405,7 +405,7 @@ bool ChromeManagementAPIDelegate::LaunchAppFunctionDel
+ apps::LaunchContainer launch_container =
+ GetLaunchContainer(extensions::ExtensionPrefs::Get(context), extension);
+ Profile* profile = Profile::FromBrowserContext(context);
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (extensions::IsExtensionUnsupportedDeprecatedApp(profile,
+ extension->id())) {
+ return false;
diff --git a/devel/electron31/files/patch-chrome_browser_extensions_api_messaging_native__process__launcher__posix.cc b/devel/electron31/files/patch-chrome_browser_extensions_api_messaging_native__process__launcher__posix.cc
new file mode 100644
index 000000000000..ea1e14d6d658
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_extensions_api_messaging_native__process__launcher__posix.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/extensions/api/messaging/native_process_launcher_posix.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/extensions/api/messaging/native_process_launcher_posix.cc
+@@ -84,7 +84,7 @@ bool NativeProcessLauncher::LaunchNativeProcess(
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Don't use no_new_privs mode, e.g. in case the host needs to use sudo.
+ options.allow_new_privs = true;
+ #endif
diff --git a/devel/electron31/files/patch-chrome_browser_extensions_api_passwords__private_passwords__private__delegate__impl.cc b/devel/electron31/files/patch-chrome_browser_extensions_api_passwords__private_passwords__private__delegate__impl.cc
new file mode 100644
index 000000000000..26f205ad0c06
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_extensions_api_passwords__private_passwords__private__delegate__impl.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
+@@ -610,7 +610,7 @@ void PasswordsPrivateDelegateImpl::OsReauthTimeoutCall
+ }
+
+ void PasswordsPrivateDelegateImpl::OsReauthTimeoutCall() {
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ PasswordsPrivateEventRouter* router =
+ PasswordsPrivateEventRouterFactory::GetForProfile(profile_);
+ if (router) {
diff --git a/devel/electron31/files/patch-chrome_browser_extensions_api_runtime_chrome__runtime__api__delegate.cc b/devel/electron31/files/patch-chrome_browser_extensions_api_runtime_chrome__runtime__api__delegate.cc
new file mode 100644
index 000000000000..016c5c353c54
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_extensions_api_runtime_chrome__runtime__api__delegate.cc
@@ -0,0 +1,13 @@
+--- chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc
+@@ -284,7 +284,9 @@ bool ChromeRuntimeAPIDelegate::GetPlatformInfo(Platfor
+ } else if (strcmp(os, "linux") == 0) {
+ info->os = extensions::api::runtime::PlatformOs::kLinux;
+ } else if (strcmp(os, "openbsd") == 0) {
+- info->os = extensions::api::runtime::PlatformOs::kOpenbsd;
++ info->os = extensions::api::runtime::PlatformOs::kLinux;
++ } else if (strcmp(os, "freebsd") == 0) {
++ info->os = extensions::api::runtime::PlatformOs::kLinux;
+ } else {
+ NOTREACHED() << "Platform not supported: " << os;
+ return false;
diff --git a/devel/electron31/files/patch-chrome_browser_extensions_api_settings__private_prefs__util.cc b/devel/electron31/files/patch-chrome_browser_extensions_api_settings__private_prefs__util.cc
new file mode 100644
index 000000000000..f753a2cbc741
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_extensions_api_settings__private_prefs__util.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/extensions/api/settings_private/prefs_util.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/extensions/api/settings_private/prefs_util.cc
+@@ -197,7 +197,7 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetAllowlist
+ (*s_allowlist)[::prefs::kSidePanelHorizontalAlignment] =
+ settings_api::PrefType::kBoolean;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ (*s_allowlist)[::prefs::kUseCustomChromeFrame] =
+ settings_api::PrefType::kBoolean;
+ #endif
+@@ -208,7 +208,7 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetAllowlist
+ // Appearance settings.
+ (*s_allowlist)[::prefs::kCurrentThemeID] = settings_api::PrefType::kString;
+ (*s_allowlist)[::prefs::kPolicyThemeColor] = settings_api::PrefType::kNumber;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ (*s_allowlist)[::prefs::kSystemTheme] = settings_api::PrefType::kNumber;
+ #endif
+ (*s_allowlist)[::prefs::kHomePage] = settings_api::PrefType::kUrl;
diff --git a/devel/electron31/files/patch-chrome_browser_extensions_api_tabs_tabs__api.cc b/devel/electron31/files/patch-chrome_browser_extensions_api_tabs_tabs__api.cc
new file mode 100644
index 000000000000..aa4ec2be9b02
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_extensions_api_tabs_tabs__api.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/extensions/api/tabs/tabs_api.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/extensions/api/tabs/tabs_api.cc
+@@ -890,7 +890,7 @@ ExtensionFunction::ResponseAction WindowsCreateFunctio
+ // minimized.
+ // TODO(crbug.com/40254339): Remove this workaround when linux is fixed.
+ // TODO(crbug.com/40254339): Find a fix for wayland as well.
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ if (new_window->initial_show_state() == ui::SHOW_STATE_MINIMIZED) {
+ new_window->window()->Minimize();
+ }
diff --git a/devel/electron31/files/patch-chrome_browser_extensions_api_webrtc__logging__private_webrtc__logging__private__api.cc b/devel/electron31/files/patch-chrome_browser_extensions_api_webrtc__logging__private_webrtc__logging__private__api.cc
new file mode 100644
index 000000000000..536e96ac2308
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_extensions_api_webrtc__logging__private_webrtc__logging__private__api.cc
@@ -0,0 +1,29 @@
+--- chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc.orig 2024-02-21 00:20:34 UTC
++++ chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
+@@ -29,7 +29,7 @@
+ #include "extensions/browser/process_manager.h"
+ #include "extensions/common/error_utils.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "extensions/common/permissions/permissions_data.h"
+ #endif
+
+@@ -38,7 +38,7 @@ bool CanEnableAudioDebugRecordingsFromExtension(
+ bool CanEnableAudioDebugRecordingsFromExtension(
+ const extensions::Extension* extension) {
+ bool enabled_by_permissions = false;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (extension) {
+ enabled_by_permissions =
+ extension->permissions_data()->active_permissions().HasAPIPermission(
+@@ -576,7 +576,7 @@ WebrtcLoggingPrivateGetLogsDirectoryFunction::Run() {
+
+ ExtensionFunction::ResponseAction
+ WebrtcLoggingPrivateGetLogsDirectoryFunction::Run() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Unlike other WebrtcLoggingPrivate functions that take a RequestInfo object,
+ // this function shouldn't be called by a component extension on behalf of
+ // some web code. It returns a DirectoryEntry for use directly in the calling
diff --git a/devel/electron31/files/patch-chrome_browser_extensions_api_webstore__private_webstore__private__api.cc b/devel/electron31/files/patch-chrome_browser_extensions_api_webstore__private_webstore__private__api.cc
new file mode 100644
index 000000000000..b51e4dbba2d6
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_extensions_api_webstore__private_webstore__private__api.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/extensions/api/webstore_private/webstore_private_api.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
+@@ -897,7 +897,7 @@ void WebstorePrivateBeginInstallWithManifest3Function:
+ #if BUILDFLAG(IS_CHROMEOS)
+ RequestExtensionApproval(contents);
+ return;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Shows a parental permission dialog directly bypassing the extension
+ // install dialog view. The parental permission dialog contains a superset
+ // of data from the extension install dialog: requested extension
diff --git a/devel/electron31/files/patch-chrome_browser_extensions_external__provider__impl.cc b/devel/electron31/files/patch-chrome_browser_extensions_external__provider__impl.cc
new file mode 100644
index 000000000000..ef3ba7c95654
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_extensions_external__provider__impl.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/extensions/external_provider_impl.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/extensions/external_provider_impl.cc
+@@ -831,7 +831,7 @@ void ExternalProviderImpl::CreateExternalProviders(
+ if (!profile->GetPrefs()->GetBoolean(pref_names::kBlockExternalExtensions)) {
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ provider_list->push_back(std::make_unique<ExternalProviderImpl>(
+ service,
+ base::MakeRefCounted<ExternalPrefLoader>(
+@@ -859,7 +859,7 @@ void ExternalProviderImpl::CreateExternalProviders(
+ bundled_extension_creation_flags));
+
+ // Define a per-user source of external extensions.
+-#if BUILDFLAG(IS_MAC) || ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \
++#if BUILDFLAG(IS_MAC) || ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && \
+ BUILDFLAG(CHROMIUM_BRANDING))
+ provider_list->push_back(std::make_unique<ExternalProviderImpl>(
+ service,
diff --git a/devel/electron31/files/patch-chrome_browser_first__run_first__run__dialog.h b/devel/electron31/files/patch-chrome_browser_first__run_first__run__dialog.h
new file mode 100644
index 000000000000..30b9e406ae7b
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_first__run_first__run__dialog.h
@@ -0,0 +1,11 @@
+--- chrome/browser/first_run/first_run_dialog.h.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/first_run/first_run_dialog.h
+@@ -12,7 +12,7 @@
+ // Hide this function on platforms where the dialog does not exist.
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_MAC) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++#if BUILDFLAG(IS_MAC) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || BUILDFLAG(IS_BSD)
+
+ namespace first_run {
+
diff --git a/devel/electron31/files/patch-chrome_browser_first__run_first__run__internal.h b/devel/electron31/files/patch-chrome_browser_first__run_first__run__internal.h
new file mode 100644
index 000000000000..c20f89819d93
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_first__run_first__run__internal.h
@@ -0,0 +1,11 @@
+--- chrome/browser/first_run/first_run_internal.h.orig 2022-11-30 08:12:58 UTC
++++ chrome/browser/first_run/first_run_internal.h
+@@ -54,7 +54,7 @@ FirstRunState DetermineFirstRunState(bool has_sentinel
+ bool force_first_run,
+ bool no_first_run);
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // For testing, forces the first run dialog to either be shown or not. If not
+ // called, the decision to show the dialog or not will be made by Chrome based
+ // on a number of factors (such as install type, whether it's a Chrome-branded
diff --git a/devel/electron31/files/patch-chrome_browser_flag__descriptions.cc b/devel/electron31/files/patch-chrome_browser_flag__descriptions.cc
new file mode 100644
index 000000000000..84ab30efe94a
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_flag__descriptions.cc
@@ -0,0 +1,91 @@
+--- chrome/browser/flag_descriptions.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/flag_descriptions.cc
+@@ -2923,7 +2923,7 @@ const char kCbdTimeframeRequiredDescription[] =
+ "value to the list.";
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ const char kPolicyIndicationForManagedDefaultSearchName[] =
+ "Enable policy indication for managed Default Search provider";
+ const char kPolicyIndicationForManagedDefaultSearchDescription[] =
+@@ -3220,7 +3220,7 @@ const char kShowAutofillTypePredictionsDescription[] =
+ "text.";
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kShowFeaturedEnterpriseSiteSearchName[] =
+ "Show featured Enterprise site search engines in Omnibox";
+ const char kShowFeaturedEnterpriseSiteSearchDescription[] =
+@@ -3245,7 +3245,7 @@ const char kSiteInstanceGroupsForDataUrlsDescription[]
+ "but in the same SiteInstanceGroup, and thus the same process.";
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kSiteSearchSettingsPolicyName[] = "Enable SiteSearchSettings policy";
+ const char kSiteSearchSettingsPolicyDescription[] =
+ "Allow site search engines to be defined by the SiteSearchSettings policy.";
+@@ -7485,7 +7485,7 @@ const char kLacrosMergeIcuDataFileDescription[] =
+ "Enables sharing common areas of icudtl.dat between Ash and Lacros.";
+ #endif // #if BUILDFLAG(IS_CHROMEOS_LACROS)
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const char kGetAllScreensMediaName[] = "GetAllScreensMedia API";
+ const char kGetAllScreensMediaDescription[] =
+ "When enabled, the getAllScreensMedia API for capturing multiple screens "
+@@ -7753,7 +7753,7 @@ const char kV4L2FlatStatefulVideoDecoderDescription[]
+
+ // Linux -----------------------------------------------------------------------
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const char kOzonePlatformHintChoiceDefault[] = "Default";
+ const char kOzonePlatformHintChoiceAuto[] = "Auto";
+ const char kOzonePlatformHintChoiceX11[] = "X11";
+@@ -7801,14 +7801,14 @@ const char kZeroCopyVideoCaptureDescription[] =
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kFollowingFeedSidepanelName[] = "Following feed in the sidepanel";
+ const char kFollowingFeedSidepanelDescription[] =
+ "Enables the following feed in the sidepanel.";
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kEnableNetworkServiceSandboxName[] =
+ "Enable the network service sandbox.";
+ const char kEnableNetworkServiceSandboxDescription[] =
+@@ -7840,7 +7840,7 @@ const char kWebBluetoothConfirmPairingSupportDescripti
+ "Bluetooth";
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ const char kSkipUndecryptablePasswordsName[] =
+ "Skip undecryptable passwords to use the available decryptable "
+ "passwords.";
+@@ -7980,7 +7980,7 @@ const char kElementCaptureDescription[] =
+
+ #if BUILDFLAG(IS_WIN) || \
+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ const char kUIDebugToolsName[] = "Debugging tools for UI";
+ const char kUIDebugToolsDescription[] =
+ "Enables additional keyboard shortcuts to help debugging.";
+@@ -8041,7 +8041,7 @@ const char kComposeNudgeAtCursorDescription[] =
+ "Shows the Compose proactive nudge at the cursor location";
+ #endif // BUILDFLAG(ENABLE_COMPOSE)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ const char kThirdPartyProfileManagementName[] =
+ "Third party profile management";
+ const char kThirdPartyProfileManagementDescription[] =
diff --git a/devel/electron31/files/patch-chrome_browser_flag__descriptions.h b/devel/electron31/files/patch-chrome_browser_flag__descriptions.h
new file mode 100644
index 000000000000..e3555debc704
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_flag__descriptions.h
@@ -0,0 +1,90 @@
+--- chrome/browser/flag_descriptions.h.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/flag_descriptions.h
+@@ -1702,7 +1702,7 @@ extern const char kCbdTimeframeRequiredDescription[];
+ extern const char kCbdTimeframeRequiredDescription[];
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ extern const char kPolicyIndicationForManagedDefaultSearchName[];
+ extern const char kPolicyIndicationForManagedDefaultSearchDescription[];
+ #endif
+@@ -1873,7 +1873,7 @@ extern const char kShowAutofillTypePredictionsDescript
+ extern const char kShowAutofillTypePredictionsDescription[];
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ extern const char kShowFeaturedEnterpriseSiteSearchName[];
+ extern const char kShowFeaturedEnterpriseSiteSearchDescription[];
+ #endif
+@@ -1888,7 +1888,7 @@ extern const char kSiteInstanceGroupsForDataUrlsDescri
+ extern const char kSiteInstanceGroupsForDataUrlsDescription[];
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ extern const char kSiteSearchSettingsPolicyName[];
+ extern const char kSiteSearchSettingsPolicyDescription[];
+ #endif
+@@ -4347,7 +4347,7 @@ extern const char kLacrosMergeIcuDataFileDescription[]
+ extern const char kLacrosMergeIcuDataFileDescription[];
+ #endif // #if BUILDFLAG(IS_CHROMEOS_LACROS)
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ extern const char kGetAllScreensMediaName[];
+ extern const char kGetAllScreensMediaDescription[];
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+@@ -4502,7 +4502,7 @@ extern const char kV4L2FlatStatefulVideoDecoderDescrip
+
+ // Linux ---------------------------------------------------------------------
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ extern const char kOzonePlatformHintChoiceDefault[];
+ extern const char kOzonePlatformHintChoiceAuto[];
+ extern const char kOzonePlatformHintChoiceX11[];
+@@ -4544,7 +4544,7 @@ extern const char kWebBluetoothConfirmPairingSupportDe
+ extern const char kWebBluetoothConfirmPairingSupportDescription[];
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ extern const char kSkipUndecryptablePasswordsName[];
+ extern const char kSkipUndecryptablePasswordsDescription[];
+
+@@ -4556,13 +4556,13 @@ extern const char kRestartToGainAccessToKeychainDescri
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ extern const char kFollowingFeedSidepanelName[];
+ extern const char kFollowingFeedSidepanelDescription[];
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ extern const char kEnableNetworkServiceSandboxName[];
+ extern const char kEnableNetworkServiceSandboxDescription[];
+
+@@ -4658,7 +4658,7 @@ extern const char kElementCaptureDescription[];
+
+ #if BUILDFLAG(IS_WIN) || \
+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ extern const char kUIDebugToolsName[];
+ extern const char kUIDebugToolsDescription[];
+
+@@ -4701,7 +4701,7 @@ extern const char kComposeNudgeAtCursorDescription[];
+ extern const char kComposeNudgeAtCursorDescription[];
+ #endif // BUILDFLAG(ENABLE_COMPOSE)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ extern const char kThirdPartyProfileManagementName[];
+ extern const char kThirdPartyProfileManagementDescription[];
+
diff --git a/devel/electron31/files/patch-chrome_browser_gcm_gcm__profile__service__factory.cc b/devel/electron31/files/patch-chrome_browser_gcm_gcm__profile__service__factory.cc
new file mode 100644
index 000000000000..d01366f4733c
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_gcm_gcm__profile__service__factory.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/gcm/gcm_profile_service_factory.cc.orig 2023-10-19 19:58:04 UTC
++++ chrome/browser/gcm/gcm_profile_service_factory.cc
+@@ -89,7 +89,7 @@ GCMProfileServiceFactory::ScopedTestingFactoryInstalle
+ // static
+ GCMProfileService* GCMProfileServiceFactory::GetForProfile(
+ content::BrowserContext* profile) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On desktop, incognito profiles are checked with IsIncognitoProfile().
+ // It's possible for non-incognito profiles to also be off-the-record.
+ bool is_profile_supported =
+@@ -129,7 +129,7 @@ GCMProfileServiceFactory::~GCMProfileServiceFactory()
+ KeyedService* GCMProfileServiceFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ Profile* profile = Profile::FromBrowserContext(context);
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ DCHECK(!profile->IsIncognitoProfile());
+ #else
+ DCHECK(!profile->IsOffTheRecord());
diff --git a/devel/electron31/files/patch-chrome_browser_gcm_instance__id_instance__id__profile__service__factory.cc b/devel/electron31/files/patch-chrome_browser_gcm_instance__id_instance__id__profile__service__factory.cc
new file mode 100644
index 000000000000..a7ba9652284f
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_gcm_instance__id_instance__id__profile__service__factory.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/gcm/instance_id/instance_id_profile_service_factory.cc.orig 2023-10-19 19:58:04 UTC
++++ chrome/browser/gcm/instance_id/instance_id_profile_service_factory.cc
+@@ -16,7 +16,7 @@ namespace instance_id {
+ // static
+ InstanceIDProfileService* InstanceIDProfileServiceFactory::GetForProfile(
+ content::BrowserContext* profile) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On desktop, the guest profile is actually the primary OTR profile of
+ // the "regular" guest profile. The regular guest profile is never used
+ // directly by users. Also, user are not able to create child OTR profiles
+@@ -61,7 +61,7 @@ InstanceIDProfileServiceFactory::~InstanceIDProfileSer
+ KeyedService* InstanceIDProfileServiceFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ Profile* profile = Profile::FromBrowserContext(context);
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On desktop, incognito profiles are checked with IsIncognitoProfile().
+ // It's possible for non-incognito profiles to also be off-the-record.
+ bool is_incognito = profile->IsIncognitoProfile();
diff --git a/devel/electron31/files/patch-chrome_browser_headless_headless__mode__util.cc b/devel/electron31/files/patch-chrome_browser_headless_headless__mode__util.cc
new file mode 100644
index 000000000000..db957d068aef
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_headless_headless__mode__util.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/headless/headless_mode_util.cc.orig 2024-04-15 20:33:47 UTC
++++ chrome/browser/headless/headless_mode_util.cc
+@@ -19,7 +19,7 @@
+ #include "chrome/common/chrome_switches.h"
+ #include "content/public/common/content_switches.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/gl/gl_switches.h" // nogncheck
+ #include "ui/ozone/public/ozone_switches.h" // nogncheck
+ #endif // BUILDFLAG(IS_LINUX)
+@@ -87,7 +87,7 @@ class HeadlessModeHandleImpl : public HeadlessModeHand
+ command_line->AppendSwitchPath(switches::kUserDataDir, GetUserDataDir());
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Headless mode on Linux relies on ozone/headless platform.
+ command_line->AppendSwitchASCII(::switches::kOzonePlatform,
+ switches::kHeadless);
diff --git a/devel/electron31/files/patch-chrome_browser_intranet__redirect__detector.h b/devel/electron31/files/patch-chrome_browser_intranet__redirect__detector.h
new file mode 100644
index 000000000000..2c1df7cf5092
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_intranet__redirect__detector.h
@@ -0,0 +1,11 @@
+--- chrome/browser/intranet_redirect_detector.h.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/intranet_redirect_detector.h
+@@ -25,7 +25,7 @@ class PrefRegistrySimple;
+ class PrefRegistrySimple;
+
+ #if !(BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS))
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
+ #error "IntranetRedirectDetector should only be built on Desktop platforms."
+ #endif
+
diff --git a/devel/electron31/files/patch-chrome_browser_media__galleries_fileapi_mtp__device__map__service.cc b/devel/electron31/files/patch-chrome_browser_media__galleries_fileapi_mtp__device__map__service.cc
new file mode 100644
index 000000000000..a50541a8f114
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_media__galleries_fileapi_mtp__device__map__service.cc
@@ -0,0 +1,15 @@
+--- chrome/browser/media_galleries/fileapi/mtp_device_map_service.cc.orig 2023-10-19 19:58:04 UTC
++++ chrome/browser/media_galleries/fileapi/mtp_device_map_service.cc
+@@ -39,10 +39,12 @@ void MTPDeviceMapService::RegisterMTPFileSystem(
+ // Note that this initializes the delegate asynchronously, but since
+ // the delegate will only be used from the IO thread, it is guaranteed
+ // to be created before use of it expects it to be there.
++#if !BUILDFLAG(IS_BSD)
+ CreateMTPDeviceAsyncDelegate(
+ device_location, read_only,
+ base::BindOnce(&MTPDeviceMapService::AddAsyncDelegate,
+ base::Unretained(this), device_location, read_only));
++#endif
+ mtp_device_usage_map_[key] = 0;
+ }
+
diff --git a/devel/electron31/files/patch-chrome_browser_media__galleries_media__file__system__registry.cc b/devel/electron31/files/patch-chrome_browser_media__galleries_media__file__system__registry.cc
new file mode 100644
index 000000000000..8a7f128ae8e8
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_media__galleries_media__file__system__registry.cc
@@ -0,0 +1,16 @@
+--- chrome/browser/media_galleries/media_file_system_registry.cc.orig 2024-02-21 00:20:34 UTC
++++ chrome/browser/media_galleries/media_file_system_registry.cc
+@@ -584,7 +584,12 @@ MediaFileSystemRegistry::MediaFileSystemRegistry()
+ // Constructor in 'private' section because depends on private class definition.
+ MediaFileSystemRegistry::MediaFileSystemRegistry()
+ : file_system_context_(new MediaFileSystemContextImpl) {
+- StorageMonitor::GetInstance()->AddObserver(this);
++ /*
++ * This conditional is needed for shutdown. Destructors
++ * try to get the media file system registry.
++ */
++ if (StorageMonitor::GetInstance())
++ StorageMonitor::GetInstance()->AddObserver(this);
+ }
+
+ MediaFileSystemRegistry::~MediaFileSystemRegistry() {
diff --git a/devel/electron31/files/patch-chrome_browser_media_audio__service__util.cc b/devel/electron31/files/patch-chrome_browser_media_audio__service__util.cc
new file mode 100644
index 000000000000..e81c01ea4728
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_media_audio__service__util.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/media/audio_service_util.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/media/audio_service_util.cc
+@@ -21,7 +21,7 @@ namespace {
+
+ namespace {
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS))
+ const base::Value* GetPolicy(const char* policy_name) {
+ const policy::PolicyMap& policies =
+@@ -43,7 +43,7 @@ bool IsAudioServiceSandboxEnabled() {
+ bool IsAudioServiceSandboxEnabled() {
+ // TODO(crbug.com/40118868): Remove !IS_CHROMEOS_LACROS once lacros starts being
+ // built with OS_CHROMEOS instead of OS_LINUX.
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS))
+ return GetPolicyOrFeature(policy::key::kAudioSandboxEnabled,
+ features::kAudioServiceSandbox);
diff --git a/devel/electron31/files/patch-chrome_browser_media_router_discovery_BUILD.gn b/devel/electron31/files/patch-chrome_browser_media_router_discovery_BUILD.gn
new file mode 100644
index 000000000000..8f655cac840e
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_media_router_discovery_BUILD.gn
@@ -0,0 +1,11 @@
+--- chrome/browser/media/router/discovery/BUILD.gn.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/media/router/discovery/BUILD.gn
+@@ -82,7 +82,7 @@ static_library("discovery") {
+ ]
+ configs += [ "//build/config/compiler:wexit_time_destructors" ]
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ sources += [ "discovery_network_list_wifi_linux.cc" ]
+ }
+
diff --git a/devel/electron31/files/patch-chrome_browser_media_router_discovery_discovery__network__list__posix.cc b/devel/electron31/files/patch-chrome_browser_media_router_discovery_discovery__network__list__posix.cc
new file mode 100644
index 000000000000..71650219d44a
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_media_router_discovery_discovery__network__list__posix.cc
@@ -0,0 +1,48 @@
+--- chrome/browser/media/router/discovery/discovery_network_list_posix.cc.orig 2022-02-28 16:54:41 UTC
++++ chrome/browser/media/router/discovery/discovery_network_list_posix.cc
+@@ -5,11 +5,12 @@
+ #include "chrome/browser/media/router/discovery/discovery_network_list.h"
+
+ #include <ifaddrs.h>
++#include <sys/socket.h>
++#include <sys/types.h>
++#include <sys/time.h>
+ #include <net/if.h>
+ #include <net/if_arp.h>
+ #include <netinet/in.h>
+-#include <sys/socket.h>
+-#include <sys/types.h>
+
+ #include <algorithm>
+
+@@ -18,7 +19,7 @@
+ #include "chrome/browser/media/router/discovery/discovery_network_list_wifi.h"
+ #include "net/base/net_errors.h"
+
+-#if !BUILDFLAG(IS_MAC)
++#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD)
+ #include <netpacket/packet.h>
+ #else
+ #include <net/if_dl.h>
+@@ -27,7 +28,7 @@
+ namespace media_router {
+ namespace {
+
+-#if !BUILDFLAG(IS_MAC)
++#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD)
+ using sll = struct sockaddr_ll;
+ #define SOCKET_ARP_TYPE(s) ((s)->sll_hatype)
+ #define SOCKET_ADDRESS_LEN(s) ((s)->sll_halen)
+@@ -38,6 +39,12 @@ using sll = struct sockaddr_dl;
+ #define SOCKET_ARP_TYPE(s) ((s)->sdl_type)
+ #define SOCKET_ADDRESS_LEN(s) ((s)->sdl_alen)
+ #define SOCKET_ADDRESS(s) (LLADDR(s))
++#endif
++
++#if BUILDFLAG(IS_BSD)
++bool MaybeGetWifiSSID(const std::string& if_name, std::string* ssid_out) {
++ return false;
++}
+ #endif
+
+ void GetDiscoveryNetworkInfoListImpl(
diff --git a/devel/electron31/files/patch-chrome_browser_media_router_discovery_discovery__network__list__wifi__linux.cc b/devel/electron31/files/patch-chrome_browser_media_router_discovery_discovery__network__list__wifi__linux.cc
new file mode 100644
index 000000000000..9a2666e365ac
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_media_router_discovery_discovery__network__list__wifi__linux.cc
@@ -0,0 +1,30 @@
+--- chrome/browser/media/router/discovery/discovery_network_list_wifi_linux.cc.orig 2023-10-19 19:58:04 UTC
++++ chrome/browser/media/router/discovery/discovery_network_list_wifi_linux.cc
+@@ -9,7 +9,11 @@
+ #include <sys/socket.h>
+ #include <sys/types.h>
+
++#include "build/build_config.h"
++
++#if !BUILDFLAG(IS_BSD)
+ #include <linux/wireless.h>
++#endif
+
+ #include "base/check.h"
+ #include "base/files/scoped_file.h"
+@@ -20,6 +24,7 @@ namespace media_router {
+ bool MaybeGetWifiSSID(const std::string& if_name, std::string* ssid_out) {
+ DCHECK(ssid_out);
+
++#if !BUILDFLAG(IS_BSD)
+ base::ScopedFD ioctl_socket(socket(AF_INET, SOCK_DGRAM, 0));
+ if (!ioctl_socket.is_valid()) {
+ // AF_INET is for IPv4, so it may fail for IPv6-only hosts even when there
+@@ -41,6 +46,7 @@ bool MaybeGetWifiSSID(const std::string& if_name, std:
+ ssid_out->assign(ssid);
+ return true;
+ }
++#endif
+ return false;
+ }
+
diff --git a/devel/electron31/files/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.cc b/devel/electron31/files/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.cc
new file mode 100644
index 000000000000..61e884997f32
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.cc
@@ -0,0 +1,47 @@
+--- chrome/browser/media/webrtc/chrome_screen_enumerator.cc.orig 2024-02-21 00:20:34 UTC
++++ chrome/browser/media/webrtc/chrome_screen_enumerator.cc
+@@ -21,7 +21,7 @@
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ #include "ash/shell.h"
+ #include "ui/aura/window.h"
+-#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/functional/callback.h"
+ #include "content/public/browser/desktop_capture.h"
+ #endif
+@@ -32,7 +32,7 @@ base::LazyInstance<std::vector<raw_ptr<aura::Window, V
+ DestructorAtExit root_windows_for_testing_ = LAZY_INSTANCE_INITIALIZER;
+ } // namespace
+
+-#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ namespace {
+ base::LazyInstance<std::unique_ptr<webrtc::DesktopCapturer>>::DestructorAtExit
+ g_desktop_capturer_for_testing = LAZY_INSTANCE_INITIALIZER;
+@@ -79,7 +79,7 @@ blink::mojom::StreamDevicesSetPtr EnumerateScreens(
+ return stream_devices_set;
+ }
+
+-#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ blink::mojom::StreamDevicesSetPtr EnumerateScreens(
+ blink::mojom::MediaStreamType stream_type) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+@@ -130,7 +130,7 @@ void ChromeScreenEnumerator::SetRootWindowsForTesting(
+ root_windows_for_testing_.Get() = std::move(root_windows);
+ }
+
+-#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void ChromeScreenEnumerator::SetDesktopCapturerForTesting(
+ std::unique_ptr<webrtc::DesktopCapturer> capturer) {
+ g_desktop_capturer_for_testing.Get() = std::move(capturer);
+@@ -143,7 +143,7 @@ void ChromeScreenEnumerator::EnumerateScreens(
+ ScreensCallback screens_callback) const {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ content::GetUIThreadTaskRunner({})->PostTaskAndReplyWithResult(
+ FROM_HERE, base::BindOnce(::EnumerateScreens, stream_type),
+ base::BindOnce(
diff --git a/devel/electron31/files/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.h b/devel/electron31/files/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.h
new file mode 100644
index 000000000000..72819d4e1f05
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.h
@@ -0,0 +1,20 @@
+--- chrome/browser/media/webrtc/chrome_screen_enumerator.h.orig 2024-02-21 00:20:34 UTC
++++ chrome/browser/media/webrtc/chrome_screen_enumerator.h
+@@ -20,7 +20,7 @@ class Window;
+ class Window;
+ }
+
+-#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ namespace webrtc {
+ class DesktopCapturer;
+ }
+@@ -42,7 +42,7 @@ class ChromeScreenEnumerator : public media::ScreenEnu
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ static void SetRootWindowsForTesting(
+ std::vector<raw_ptr<aura::Window, VectorExperimental>> root_windows);
+-#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ static void SetDesktopCapturerForTesting(
+ std::unique_ptr<webrtc::DesktopCapturer> capturer);
+ #endif
diff --git a/devel/electron31/files/patch-chrome_browser_media_webrtc_desktop__media__picker__controller.cc b/devel/electron31/files/patch-chrome_browser_media_webrtc_desktop__media__picker__controller.cc
new file mode 100644
index 000000000000..16a5ebbf1d80
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_media_webrtc_desktop__media__picker__controller.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/media/webrtc/desktop_media_picker_controller.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/media/webrtc/desktop_media_picker_controller.cc
+@@ -89,7 +89,7 @@ bool DesktopMediaPickerController::IsSystemAudioCaptur
+ #if BUILDFLAG(IS_MAC)
+ return request_source == Params::RequestSource::kCast ||
+ base::FeatureList::IsEnabled(media::kMacLoopbackAudioForScreenShare);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (request_source == Params::RequestSource::kCast) {
+ return base::FeatureList::IsEnabled(media::kPulseaudioLoopbackForCast);
+ } else {
diff --git a/devel/electron31/files/patch-chrome_browser_media_webrtc_webrtc__log__uploader.cc b/devel/electron31/files/patch-chrome_browser_media_webrtc_webrtc__log__uploader.cc
new file mode 100644
index 000000000000..8ccb6fdd9ca1
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_media_webrtc_webrtc__log__uploader.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/media/webrtc/webrtc_log_uploader.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/media/webrtc/webrtc_log_uploader.cc
+@@ -101,7 +101,7 @@ std::string GetLogUploadProduct() {
+ const char product[] = "Chrome_Mac";
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #if !defined(ADDRESS_SANITIZER)
+ const char product[] = "Chrome_Linux";
+ #else
diff --git a/devel/electron31/files/patch-chrome_browser_media_webrtc_webrtc__logging__controller.cc b/devel/electron31/files/patch-chrome_browser_media_webrtc_webrtc__logging__controller.cc
new file mode 100644
index 000000000000..4fd87eb517f8
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_media_webrtc_webrtc__logging__controller.cc
@@ -0,0 +1,33 @@
+--- chrome/browser/media/webrtc/webrtc_logging_controller.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/media/webrtc/webrtc_logging_controller.cc
+@@ -25,10 +25,10 @@
+ #include "components/webrtc_logging/browser/text_log_list.h"
+ #include "content/public/browser/render_process_host.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/public/browser/child_process_security_policy.h"
+ #include "storage/browser/file_system/isolated_context.h"
+-#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ using webrtc_event_logging::WebRtcEventLogManager;
+
+@@ -288,7 +288,7 @@ void WebRtcLoggingController::StartEventLogging(
+ web_app_id, callback);
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void WebRtcLoggingController::GetLogsDirectory(
+ LogsDirectoryCallback callback,
+ LogsDirectoryErrorCallback error_callback) {
+@@ -334,7 +334,7 @@ void WebRtcLoggingController::GrantLogsDirectoryAccess
+ FROM_HERE,
+ base::BindOnce(std::move(callback), file_system.id(), registered_name));
+ }
+-#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ void WebRtcLoggingController::OnRtpPacket(
+ base::HeapArray<uint8_t> packet_header,
diff --git a/devel/electron31/files/patch-chrome_browser_media_webrtc_webrtc__logging__controller.h b/devel/electron31/files/patch-chrome_browser_media_webrtc_webrtc__logging__controller.h
new file mode 100644
index 000000000000..3eecb483d55d
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_media_webrtc_webrtc__logging__controller.h
@@ -0,0 +1,20 @@
+--- chrome/browser/media/webrtc/webrtc_logging_controller.h.orig 2024-02-21 00:20:34 UTC
++++ chrome/browser/media/webrtc/webrtc_logging_controller.h
+@@ -133,7 +133,7 @@ class WebRtcLoggingController
+ size_t web_app_id,
+ const StartEventLoggingCallback& callback);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Ensures that the WebRTC Logs directory exists and then grants render
+ // process access to the 'WebRTC Logs' directory, and invokes |callback| with
+ // the ids necessary to create a DirectoryEntry object.
+@@ -197,7 +197,7 @@ class WebRtcLoggingController
+
+ content::BrowserContext* GetBrowserContext() const;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Grants the render process access to the 'WebRTC Logs' directory, and
+ // invokes |callback| with the ids necessary to create a DirectoryEntry
+ // object. If the |logs_path| couldn't be created or found, |error_callback|
diff --git a/devel/electron31/files/patch-chrome_browser_memory__details.cc b/devel/electron31/files/patch-chrome_browser_memory__details.cc
new file mode 100644
index 000000000000..f0b5dd9437d7
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_memory__details.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/memory_details.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/memory_details.cc
+@@ -38,7 +38,7 @@
+ #include "services/resource_coordinator/public/cpp/memory_instrumentation/memory_instrumentation.h"
+ #include "ui/base/l10n/l10n_util.h"
+
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_BSD)
+ #include "content/public/browser/zygote_host/zygote_host_linux.h"
+ #endif
+
+@@ -334,7 +334,7 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
+ });
+ }
+
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_BSD)
+ if (content::ZygoteHost::GetInstance()->IsZygotePid(process.pid)) {
+ process.process_type = content::PROCESS_TYPE_ZYGOTE;
+ }
diff --git a/devel/electron31/files/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.cc b/devel/electron31/files/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.cc
new file mode 100644
index 000000000000..fa689b3b8f79
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.cc
@@ -0,0 +1,55 @@
+--- chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
+@@ -81,8 +81,10 @@
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if defined(__GLIBC__) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++#if defined(__GLIBC__) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
++#if !BUILDFLAG(IS_BSD)
+ #include <gnu/libc-version.h>
++#endif
+
+ #include "base/linux_util.h"
+ #include "base/strings/string_split.h"
+@@ -106,7 +108,7 @@
+ #include "chromeos/crosapi/cpp/crosapi_constants.h"
+ #endif // BUILDFLAG(IS_CHROMEOS_LACROS)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/metrics/pressure/pressure_metrics_reporter.h"
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -115,7 +117,7 @@
+ #include "components/user_manager/user_manager.h"
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "components/power_metrics/system_power_monitor.h"
+ #endif
+
+@@ -862,7 +864,7 @@ void RecordStartupMetrics() {
+
+ // Record whether Chrome is the default browser or not.
+ // Disabled on Linux due to hanging browser tests, see crbug.com/1216328.
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ shell_integration::DefaultWebClientState default_state =
+ shell_integration::GetDefaultBrowser();
+ base::UmaHistogramEnumeration("DefaultBrowser.State", default_state,
+@@ -1154,11 +1156,11 @@ void ChromeBrowserMainExtraPartsMetrics::PostBrowserSt
+ }
+ #endif // !BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ pressure_metrics_reporter_ = std::make_unique<PressureMetricsReporter>();
+ #endif // BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::trace_event::TraceLog::GetInstance()->AddEnabledStateObserver(
+ power_metrics::SystemPowerMonitor::GetInstance());
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
diff --git a/devel/electron31/files/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.h b/devel/electron31/files/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.h
new file mode 100644
index 000000000000..b4f4c921c9c4
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.h
@@ -0,0 +1,20 @@
+--- chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h.orig 2024-02-21 00:20:34 UTC
++++ chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h
+@@ -28,7 +28,7 @@ class ProcessMonitor;
+ class ProcessMonitor;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ class PressureMetricsReporter;
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -115,7 +115,7 @@ class ChromeBrowserMainExtraPartsMetrics : public Chro
+ std::unique_ptr<BatteryDischargeReporter> battery_discharge_reporter_;
+ #endif // !BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Reports pressure metrics.
+ std::unique_ptr<PressureMetricsReporter> pressure_metrics_reporter_;
+ #endif // BUILDFLAG(IS_LINUX)
diff --git a/devel/electron31/files/patch-chrome_browser_metrics_chrome__metrics__service__client.cc b/devel/electron31/files/patch-chrome_browser_metrics_chrome__metrics__service__client.cc
new file mode 100644
index 000000000000..38e2739cb0b9
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_metrics_chrome__metrics__service__client.cc
@@ -0,0 +1,83 @@
+--- chrome/browser/metrics/chrome_metrics_service_client.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/metrics/chrome_metrics_service_client.cc
+@@ -195,7 +195,7 @@
+ #include "chrome/notification_helper/notification_helper_constants.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "components/metrics/motherboard_metrics_provider.h"
+ #endif
+
+@@ -212,7 +212,7 @@
+ #include "chrome/browser/metrics/power/power_metrics_provider_mac.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/metrics/bluetooth_metrics_provider.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+@@ -534,7 +534,7 @@ void ChromeMetricsServiceClient::RegisterPrefs(PrefReg
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ metrics::structured::StructuredMetricsService::RegisterPrefs(registry);
+
+ #if !BUILDFLAG(IS_CHROMEOS_ASH)
+@@ -706,7 +706,7 @@ void ChromeMetricsServiceClient::Initialize() {
+ RegisterUKMProviders();
+ }
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ metrics::structured::Recorder::GetInstance()->SetUiTaskRunner(
+ base::SequencedTaskRunner::GetCurrentDefault());
+ #endif
+@@ -757,7 +757,7 @@ void ChromeMetricsServiceClient::RegisterMetricsServic
+ metrics_service_->RegisterMetricsProvider(
+ std::make_unique<metrics::CPUMetricsProvider>());
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ metrics_service_->RegisterMetricsProvider(
+ std::make_unique<metrics::MotherboardMetricsProvider>());
+ #endif
+@@ -842,7 +842,7 @@ void ChromeMetricsServiceClient::RegisterMetricsServic
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || BUILDFLAG(IS_BSD)
+ metrics_service_->RegisterMetricsProvider(
+ std::make_unique<DesktopPlatformFeaturesMetricsProvider>());
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || (BUILDFLAG(IS_LINUX) ||
+@@ -944,7 +944,7 @@ void ChromeMetricsServiceClient::RegisterMetricsServic
+ std::make_unique<PowerMetricsProvider>());
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ metrics_service_->RegisterMetricsProvider(
+ metrics::CreateDesktopSessionMetricsProvider());
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || (BUILDFLAG(IS_LINUX)
+@@ -1131,7 +1131,7 @@ bool ChromeMetricsServiceClient::RegisterForProfileEve
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || BUILDFLAG(IS_BSD)
+ // This creates the DesktopProfileSessionDurationsServices if it didn't exist
+ // already.
+ metrics::DesktopProfileSessionDurationsServiceFactory::GetForBrowserContext(
+@@ -1465,7 +1465,7 @@ void ChromeMetricsServiceClient::CreateStructuredMetri
+ recorder =
+ std::make_unique<metrics::structured::AshStructuredMetricsRecorder>(
+ cros_system_profile_provider_.get());
+-#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+
+ // Make sure that Structured Metrics recording delegates have been created
+ // before the service is created. This is handled in other places for ChromeOS
diff --git a/devel/electron31/files/patch-chrome_browser_metrics_perf_cpu__identity.cc b/devel/electron31/files/patch-chrome_browser_metrics_perf_cpu__identity.cc
new file mode 100644
index 000000000000..950fedc7089a
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_metrics_perf_cpu__identity.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/metrics/perf/cpu_identity.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/metrics/perf/cpu_identity.cc
+@@ -142,7 +142,7 @@ CPUIdentity GetCPUIdentity() {
+ result.release =
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ base::SysInfo::KernelVersion();
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ base::SysInfo::OperatingSystemVersion();
+ #else
+ #error "Unsupported configuration"
diff --git a/devel/electron31/files/patch-chrome_browser_metrics_power_process__metrics__recorder__util.cc b/devel/electron31/files/patch-chrome_browser_metrics_power_process__metrics__recorder__util.cc
new file mode 100644
index 000000000000..77047374d435
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_metrics_power_process__metrics__recorder__util.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/metrics/power/process_metrics_recorder_util.cc.orig 2024-04-15 20:33:47 UTC
++++ chrome/browser/metrics/power/process_metrics_recorder_util.cc
+@@ -65,7 +65,7 @@ void RecordProcessHistograms(const char* histogram_suf
+ const ProcessMonitor::Metrics& metrics) {
+ RecordAverageCPUUsage(histogram_suffix, metrics.cpu_usage);
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ base::UmaHistogramCounts10000(
+ base::StrCat({"PerformanceMonitor.IdleWakeups2.", histogram_suffix}),
+ metrics.idle_wakeups);
diff --git a/devel/electron31/files/patch-chrome_browser_metrics_power_process__monitor.cc b/devel/electron31/files/patch-chrome_browser_metrics_power_process__monitor.cc
new file mode 100644
index 000000000000..47c08a7aadb5
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_metrics_power_process__monitor.cc
@@ -0,0 +1,29 @@
+--- chrome/browser/metrics/power/process_monitor.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/metrics/power/process_monitor.cc
+@@ -64,7 +64,7 @@ ProcessMonitor::Metrics SampleMetrics(base::ProcessMet
+ process_metrics.GetPlatformIndependentCPUUsage());
+
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ metrics.idle_wakeups = process_metrics.GetIdleWakeupsPerSecond();
+ #endif
+ #if BUILDFLAG(IS_MAC)
+@@ -82,7 +82,7 @@ void ScaleMetrics(ProcessMonitor::Metrics* metrics, do
+ }
+
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ metrics->idle_wakeups *= factor;
+ #endif
+
+@@ -157,7 +157,7 @@ ProcessMonitor::Metrics& operator+=(ProcessMonitor::Me
+ }
+
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ lhs.idle_wakeups += rhs.idle_wakeups;
+ #endif
+
diff --git a/devel/electron31/files/patch-chrome_browser_metrics_power_process__monitor.h b/devel/electron31/files/patch-chrome_browser_metrics_power_process__monitor.h
new file mode 100644
index 000000000000..718da081e685
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_metrics_power_process__monitor.h
@@ -0,0 +1,11 @@
+--- chrome/browser/metrics/power/process_monitor.h.orig 2024-04-15 20:33:47 UTC
++++ chrome/browser/metrics/power/process_monitor.h
+@@ -76,7 +76,7 @@ class ProcessMonitor : public content::BrowserChildPro
+ std::optional<double> cpu_usage;
+
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ // Returns the number of average idle cpu wakeups per second since the last
+ // time the metric was sampled.
+ int idle_wakeups = 0;
diff --git a/devel/electron31/files/patch-chrome_browser_net_system__network__context__manager.cc b/devel/electron31/files/patch-chrome_browser_net_system__network__context__manager.cc
new file mode 100644
index 000000000000..06795f024296
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_net_system__network__context__manager.cc
@@ -0,0 +1,174 @@
+--- chrome/browser/net/system_network_context_manager.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/net/system_network_context_manager.cc
+@@ -97,7 +97,7 @@
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #include "chrome/common/chrome_paths_internal.h"
+ #include "chrome/grit/branded_strings.h"
+ #include "ui/base/l10n/l10n_util.h"
+@@ -141,7 +141,7 @@ bool g_previously_failed_to_launch_sandboxed_service =
+ // received a failed launch for a sandboxed network service.
+ bool g_previously_failed_to_launch_sandboxed_service = false;
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Whether kerberos library loading will work in the network service due to the
+ // sandbox.
+ bool g_network_service_will_allow_gssapi_library_load = false;
+@@ -149,7 +149,7 @@ const char* kGssapiDesiredPref =
+ const char* kGssapiDesiredPref =
+ #if BUILDFLAG(IS_CHROMEOS)
+ prefs::kKerberosEnabled;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ prefs::kReceivedHttpAuthNegotiateHeader;
+ #endif
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+@@ -195,7 +195,7 @@ network::mojom::HttpAuthDynamicParamsPtr CreateHttpAut
+ auth_dynamic_params->basic_over_http_enabled =
+ local_state->GetBoolean(prefs::kBasicAuthOverHttpEnabled);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ auth_dynamic_params->delegate_by_kdc_policy =
+ local_state->GetBoolean(prefs::kAuthNegotiateDelegateByKdcPolicy);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
+@@ -210,7 +210,7 @@ network::mojom::HttpAuthDynamicParamsPtr CreateHttpAut
+ local_state->GetString(prefs::kAuthAndroidNegotiateAccountType);
+ #endif // BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auth_dynamic_params->allow_gssapi_library_load =
+ local_state->GetBoolean(kGssapiDesiredPref);
+ #endif // BUILDFLAG(IS_CHROMEOS)
+@@ -220,7 +220,7 @@ void OnNewHttpAuthDynamicParams(
+
+ void OnNewHttpAuthDynamicParams(
+ network::mojom::HttpAuthDynamicParamsPtr& params) {
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // The kerberos library is incompatible with the network service sandbox, so
+ // if library loading is now enabled, the network service needs to be
+ // restarted. It will be restarted unsandboxed because is
+@@ -262,11 +262,11 @@ NetworkSandboxState IsNetworkSandboxEnabledInternal()
+ if (g_previously_failed_to_launch_sandboxed_service) {
+ return NetworkSandboxState::kDisabledBecauseOfFailedLaunch;
+ }
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto* local_state = g_browser_process->local_state();
+ #endif
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // The network service sandbox and the kerberos library are incompatible.
+ // If kerberos is enabled by policy, disable the network service sandbox.
+ if (g_network_service_will_allow_gssapi_library_load ||
+@@ -282,7 +282,7 @@ NetworkSandboxState IsNetworkSandboxEnabledInternal()
+ }
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (local_state &&
+ local_state->HasPrefPath(prefs::kNetworkServiceSandboxEnabled)) {
+ return local_state->GetBoolean(prefs::kNetworkServiceSandboxEnabled)
+@@ -512,7 +512,7 @@ void SystemNetworkContextManager::DeleteInstance() {
+ g_system_network_context_manager = nullptr;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ SystemNetworkContextManager::GssapiLibraryLoadObserver::
+ GssapiLibraryLoadObserver(SystemNetworkContextManager* owner)
+ : owner_(owner) {}
+@@ -570,7 +570,7 @@ SystemNetworkContextManager::SystemNetworkContextManag
+ pref_change_registrar_.Add(prefs::kAllHttpAuthSchemesAllowedForOrigins,
+ auth_pref_callback);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ pref_change_registrar_.Add(prefs::kAuthNegotiateDelegateByKdcPolicy,
+ auth_pref_callback);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
+@@ -584,7 +584,7 @@ SystemNetworkContextManager::SystemNetworkContextManag
+ auth_pref_callback);
+ #endif // BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ pref_change_registrar_.Add(kGssapiDesiredPref, auth_pref_callback);
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+
+@@ -610,7 +610,7 @@ SystemNetworkContextManager::SystemNetworkContextManag
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ pref_change_registrar_.Add(
+ prefs::kEnforceLocalAnchorConstraintsEnabled,
+ base::BindRepeating(&SystemNetworkContextManager::
+@@ -665,7 +665,7 @@ void SystemNetworkContextManager::RegisterPrefs(PrefRe
+ registry->RegisterBooleanPref(prefs::kKerberosEnabled, false);
+ #endif // BUILDFLAG(IS_CHROMEOS_LACROS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ registry->RegisterBooleanPref(prefs::kAuthNegotiateDelegateByKdcPolicy,
+ false);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
+@@ -689,7 +689,7 @@ void SystemNetworkContextManager::RegisterPrefs(PrefRe
+ registry->RegisterIntegerPref(prefs::kMaxConnectionsPerProxy, -1);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // Note that the default value is not relevant because the pref is only
+ // evaluated when it is managed.
+ registry->RegisterBooleanPref(prefs::kEnforceLocalAnchorConstraintsEnabled,
+@@ -698,11 +698,11 @@ void SystemNetworkContextManager::RegisterPrefs(PrefRe
+
+ registry->RegisterListPref(prefs::kExplicitlyAllowedNetworkPorts);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ registry->RegisterBooleanPref(prefs::kNetworkServiceSandboxEnabled, true);
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ registry->RegisterBooleanPref(prefs::kReceivedHttpAuthNegotiateHeader, false);
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -755,7 +755,7 @@ void SystemNetworkContextManager::OnNetworkServiceCrea
+ OnNewHttpAuthDynamicParams(http_auth_dynamic_params);
+ network_service->ConfigureHttpAuthPrefs(std::move(http_auth_dynamic_params));
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ gssapi_library_loader_observer_.Install(network_service);
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -972,7 +972,7 @@ bool SystemNetworkContextManager::IsNetworkSandboxEnab
+ break;
+ }
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!enabled) {
+ g_network_service_will_allow_gssapi_library_load = true;
+ }
+@@ -1059,7 +1059,7 @@ void SystemNetworkContextManager::UpdateExplicitlyAllo
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ void SystemNetworkContextManager::UpdateEnforceLocalAnchorConstraintsEnabled() {
+ const PrefService::Preference* enforce_local_anchor_constraints_enabled_pref =
+ local_state_->FindPreference(
diff --git a/devel/electron31/files/patch-chrome_browser_net_system__network__context__manager.h b/devel/electron31/files/patch-chrome_browser_net_system__network__context__manager.h
new file mode 100644
index 000000000000..3c5b0bb63874
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_net_system__network__context__manager.h
@@ -0,0 +1,29 @@
+--- chrome/browser/net/system_network_context_manager.h.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/net/system_network_context_manager.h
+@@ -197,7 +197,7 @@ class SystemNetworkContextManager {
+ class URLLoaderFactoryForSystem;
+ class NetworkProcessLaunchWatcher;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ class GssapiLibraryLoadObserver
+ : public network::mojom::GssapiLibraryLoadObserver {
+ public:
+@@ -233,7 +233,7 @@ class SystemNetworkContextManager {
+ void UpdateExplicitlyAllowedNetworkPorts();
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // Applies the current value of the kEnforceLocalAnchorConstraintsEnabled
+ // pref to the enforcement state.
+ void UpdateEnforceLocalAnchorConstraintsEnabled();
+@@ -285,7 +285,7 @@ class SystemNetworkContextManager {
+ std::unique_ptr<NetworkAnnotationMonitor> network_annotation_monitor_;
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ GssapiLibraryLoadObserver gssapi_library_loader_observer_{this};
+ #endif // BUILDFLAG(IS_LINUX)
+
diff --git a/devel/electron31/files/patch-chrome_browser_new__tab__page_modules_file__suggestion_drive__service.cc b/devel/electron31/files/patch-chrome_browser_new__tab__page_modules_file__suggestion_drive__service.cc
new file mode 100644
index 000000000000..a326d2bdfe21
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_new__tab__page_modules_file__suggestion_drive__service.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/new_tab_page/modules/file_suggestion/drive_service.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/new_tab_page/modules/file_suggestion/drive_service.cc
+@@ -32,7 +32,7 @@ namespace {
+ #include "services/network/public/cpp/resource_request.h"
+
+ namespace {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ constexpr char kPlatform[] = "LINUX";
+ #elif BUILDFLAG(IS_WIN)
+ constexpr char kPlatform[] = "WINDOWS";
diff --git a/devel/electron31/files/patch-chrome_browser_new__tab__page_new__tab__page__util.cc b/devel/electron31/files/patch-chrome_browser_new__tab__page_new__tab__page__util.cc
new file mode 100644
index 000000000000..3ef8e52d2856
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_new__tab__page_new__tab__page__util.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/new_tab_page/new_tab_page_util.cc.orig 2024-02-21 00:20:34 UTC
++++ chrome/browser/new_tab_page/new_tab_page_util.cc
+@@ -20,7 +20,7 @@ bool IsOsSupportedForDrive() {
+ }
+
+ bool IsOsSupportedForDrive() {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return true;
+ #else
+ return false;
diff --git a/devel/electron31/files/patch-chrome_browser_notifications_notification__display__service__impl.cc b/devel/electron31/files/patch-chrome_browser_notifications_notification__display__service__impl.cc
new file mode 100644
index 000000000000..828ca695f063
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_notifications_notification__display__service__impl.cc
@@ -0,0 +1,38 @@
+--- chrome/browser/notifications/notification_display_service_impl.cc.orig 2024-06-18 21:43:22 UTC
++++ chrome/browser/notifications/notification_display_service_impl.cc
+@@ -32,7 +32,7 @@
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/send_tab_to_self/desktop_notification_handler.h"
+ #include "chrome/browser/sharing/sharing_notification_handler.h"
+ #endif
+@@ -65,7 +65,7 @@ void NotificationDisplayServiceImpl::RegisterProfilePr
+ // static
+ void NotificationDisplayServiceImpl::RegisterProfilePrefs(
+ user_prefs::PrefRegistrySyncable* registry) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ registry->RegisterBooleanPref(prefs::kAllowSystemNotifications, true);
+ #endif
+ }
+@@ -81,7 +81,7 @@ NotificationDisplayServiceImpl::NotificationDisplaySer
+ std::make_unique<PersistentNotificationHandler>());
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ AddNotificationHandler(
+ NotificationHandler::Type::SEND_TAB_TO_SELF,
+ std::make_unique<send_tab_to_self::DesktopNotificationHandler>(
+@@ -89,7 +89,7 @@ NotificationDisplayServiceImpl::NotificationDisplaySer
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ AddNotificationHandler(
+ NotificationHandler::Type::TAILORED_SECURITY,
+ std::make_unique<safe_browsing::TailoredSecurityNotificationHandler>());
diff --git a/devel/electron31/files/patch-chrome_browser_notifications_notification__platform__bridge__delegator.cc b/devel/electron31/files/patch-chrome_browser_notifications_notification__platform__bridge__delegator.cc
new file mode 100644
index 000000000000..1d138c9c3cb0
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_notifications_notification__platform__bridge__delegator.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/notifications/notification_platform_bridge_delegator.cc.orig 2022-02-28 16:54:41 UTC
++++ chrome/browser/notifications/notification_platform_bridge_delegator.cc
+@@ -57,7 +57,7 @@ bool SystemNotificationsEnabled(Profile* profile) {
+ #elif BUILDFLAG(IS_WIN)
+ return NotificationPlatformBridgeWin::SystemNotificationEnabled();
+ #else
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (profile) {
+ // Prefs take precedence over flags.
+ PrefService* prefs = profile->GetPrefs();
diff --git a/devel/electron31/files/patch-chrome_browser_password__manager_chrome__password__manager__client.cc b/devel/electron31/files/patch-chrome_browser_password__manager_chrome__password__manager__client.cc
new file mode 100644
index 000000000000..cae445aa89e3
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_password__manager_chrome__password__manager__client.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/password_manager/chrome_password_manager_client.cc.orig 2024-06-18 21:43:23 UTC
++++ chrome/browser/password_manager/chrome_password_manager_client.cc
+@@ -488,7 +488,7 @@ bool ChromePasswordManagerClient::CanUseBiometricAuthF
+
+ bool ChromePasswordManagerClient::CanUseBiometricAuthForFilling(
+ device_reauth::DeviceAuthenticator* authenticator) {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!GetLocalStatePrefs() || !GetPrefs() || !authenticator) {
+ return false;
+ }
+@@ -712,7 +712,7 @@ void ChromePasswordManagerClient::NotifyKeychainError(
+ }
+
+ void ChromePasswordManagerClient::NotifyKeychainError() {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ PasswordsClientUIDelegate* manage_passwords_ui_controller =
+ PasswordsClientUIDelegateFromWebContents(web_contents());
+ manage_passwords_ui_controller->OnKeychainError();
diff --git a/devel/electron31/files/patch-chrome_browser_password__manager_password__reuse__manager__factory.cc b/devel/electron31/files/patch-chrome_browser_password__manager_password__reuse__manager__factory.cc
new file mode 100644
index 000000000000..49cfe7e04afd
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_password__manager_password__reuse__manager__factory.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/password_manager/password_reuse_manager_factory.cc.orig 2024-06-18 21:43:23 UTC
++++ chrome/browser/password_manager/password_reuse_manager_factory.cc
+@@ -137,7 +137,7 @@ PasswordReuseManagerFactory::BuildServiceInstanceForBr
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<password_manager::PasswordStoreSigninNotifier> notifier =
+ std::make_unique<password_manager::PasswordStoreSigninNotifierImpl>(
+ IdentityManagerFactory::GetForProfile(profile));
diff --git a/devel/electron31/files/patch-chrome_browser_platform__util__linux.cc b/devel/electron31/files/patch-chrome_browser_platform__util__linux.cc
new file mode 100644
index 000000000000..7e7522cfc8e2
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_platform__util__linux.cc
@@ -0,0 +1,12 @@
+--- chrome/browser/platform_util_linux.cc.orig 2024-04-15 20:33:47 UTC
++++ chrome/browser/platform_util_linux.cc
+@@ -300,7 +300,9 @@ void OnLaunchOptionsCreated(const std::string& command
+ argv.push_back(command);
+ argv.push_back(arg);
+ options.current_directory = working_directory;
++#if !BUILDFLAG(IS_BSD)
+ options.allow_new_privs = true;
++#endif
+ // xdg-open can fall back on mailcap which eventually might plumb through
+ // to a command that needs a terminal. Set the environment variable telling
+ // it that we definitely don't have a terminal available and that it should
diff --git a/devel/electron31/files/patch-chrome_browser_policy_browser__signin__policy__handler.cc b/devel/electron31/files/patch-chrome_browser_policy_browser__signin__policy__handler.cc
new file mode 100644
index 000000000000..c423fdd7f157
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_policy_browser__signin__policy__handler.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/policy/browser_signin_policy_handler.cc.orig 2022-10-24 13:33:33 UTC
++++ chrome/browser/policy/browser_signin_policy_handler.cc
+@@ -45,7 +45,7 @@ void BrowserSigninPolicyHandler::ApplyPolicySettings(c
+ policies.GetValue(policy_name(), base::Value::Type::INTEGER);
+ switch (static_cast<BrowserSigninMode>(value->GetInt())) {
+ case BrowserSigninMode::kForced:
+-#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+ prefs->SetValue(prefs::kForceBrowserSignin, base::Value(true));
+ #endif
+ [[fallthrough]];
diff --git a/devel/electron31/files/patch-chrome_browser_policy_chrome__browser__cloud__management__controller__desktop.cc b/devel/electron31/files/patch-chrome_browser_policy_chrome__browser__cloud__management__controller__desktop.cc
new file mode 100644
index 000000000000..fad99aa23662
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_policy_chrome__browser__cloud__management__controller__desktop.cc
@@ -0,0 +1,38 @@
+--- chrome/browser/policy/chrome_browser_cloud_management_controller_desktop.cc.orig 2024-06-18 21:43:23 UTC
++++ chrome/browser/policy/chrome_browser_cloud_management_controller_desktop.cc
+@@ -50,7 +50,7 @@
+ #include "chrome/browser/policy/browser_dm_token_storage_mac.h"
+ #endif // BUILDFLAG(IS_MAC)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/policy/browser_dm_token_storage_linux.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+@@ -59,7 +59,7 @@
+ #include "chrome/install_static/install_util.h"
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/connectors/device_trust/key_management/browser/device_trust_key_manager_impl.h"
+ #include "chrome/browser/enterprise/connectors/device_trust/key_management/browser/key_rotation_launcher.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
+@@ -87,7 +87,7 @@ void ChromeBrowserCloudManagementControllerDesktop::
+
+ #if BUILDFLAG(IS_MAC)
+ storage_delegate = std::make_unique<BrowserDMTokenStorageMac>();
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ storage_delegate = std::make_unique<BrowserDMTokenStorageLinux>();
+ #elif BUILDFLAG(IS_WIN)
+ storage_delegate = std::make_unique<BrowserDMTokenStorageWin>();
+@@ -255,7 +255,7 @@ ChromeBrowserCloudManagementControllerDesktop::CreateD
+
+ std::unique_ptr<enterprise_connectors::DeviceTrustKeyManager>
+ ChromeBrowserCloudManagementControllerDesktop::CreateDeviceTrustKeyManager() {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ auto* browser_dm_token_storage = BrowserDMTokenStorage::Get();
+ auto* device_management_service = GetDeviceManagementService();
+ auto shared_url_loader_factory = GetSharedURLLoaderFactory();
diff --git a/devel/electron31/files/patch-chrome_browser_policy_configuration__policy__handler__list__factory.cc b/devel/electron31/files/patch-chrome_browser_policy_configuration__policy__handler__list__factory.cc
new file mode 100644
index 000000000000..80be9b4c3326
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_policy_configuration__policy__handler__list__factory.cc
@@ -0,0 +1,254 @@
+--- chrome/browser/policy/configuration_policy_handler_list_factory.cc.orig 2024-06-18 21:43:23 UTC
++++ chrome/browser/policy/configuration_policy_handler_list_factory.cc
+@@ -234,19 +234,19 @@
+ #include "components/spellcheck/browser/pref_names.h"
+ #endif // BUILDFLAG(ENABLE_SPELLCHECK)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/idle/action.h"
+ #include "chrome/browser/enterprise/signin/enterprise_signin_prefs.h"
+ #include "components/device_signals/core/browser/pref_names.h" // nogncheck due to crbug.com/1125897
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "components/enterprise/idle/idle_timeout_policy_handler.h"
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/privacy_sandbox/privacy_sandbox_policy_handler.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
+@@ -260,13 +260,13 @@
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/policy/battery_saver_policy_handler.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS_ASH)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "components/search_engines/site_search_policy_handler.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS)
+@@ -871,7 +871,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] =
+ prefs::kManagedDefaultGeolocationSetting,
+ base::Value::Type::INTEGER },
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) \
+- || BUILDFLAG(IS_MAC)
++ || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ { key::kRequireOnlineRevocationChecksForLocalAnchors,
+ prefs::kCertRevocationCheckingRequiredLocalAnchors,
+ base::Value::Type::BOOLEAN },
+@@ -880,7 +880,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] =
+ base::Value::Type::BOOLEAN },
+ #endif // #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+ // || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ { key::kFullscreenAllowed,
+ prefs::kFullscreenAllowed,
+ base::Value::Type::BOOLEAN },
+@@ -1664,7 +1664,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] =
+ base::Value::Type::BOOLEAN },
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ { key::kGSSAPILibraryName,
+ prefs::kGSSAPILibraryName,
+ base::Value::Type::STRING },
+@@ -1715,7 +1715,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] =
+ base::Value::Type::BOOLEAN },
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ { key::kNetworkServiceSandboxEnabled,
+ prefs::kNetworkServiceSandboxEnabled,
+ base::Value::Type::BOOLEAN },
+@@ -1741,12 +1741,12 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] =
+ prefs::kTotalMemoryLimitMb,
+ base::Value::Type::INTEGER },
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ { key::kBackgroundModeEnabled,
+ prefs::kBackgroundModeEnabled,
+ base::Value::Type::BOOLEAN },
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ { key::kUnmanagedDeviceSignalsConsentFlowEnabled,
+ device_signals::prefs::kUnmanagedDeviceSignalsConsentFlowEnabled,
+ base::Value::Type::BOOLEAN },
+@@ -1754,7 +1754,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] =
+ prefs::kProfileSeparationDomainExceptionList,
+ base::Value::Type::LIST },
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ { key::kDefaultBrowserSettingEnabled,
+ prefs::kDefaultBrowserSettingEnabled,
+ base::Value::Type::BOOLEAN },
+@@ -1766,7 +1766,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] =
+ base::Value::Type::BOOLEAN },
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) \
+- || BUILDFLAG(IS_CHROMEOS)
++ || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ { key::kAutoplayAllowed,
+ prefs::kAutoplayAllowed,
+ base::Value::Type::BOOLEAN },
+@@ -1867,7 +1867,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] =
+ base::Value::Type::BOOLEAN },
+ #endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ { key::kAlternativeBrowserPath,
+ browser_switcher::prefs::kAlternativeBrowserPath,
+ base::Value::Type::STRING },
+@@ -1972,7 +1972,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] =
+ base::Value::Type::LIST },
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ { key::kAuthNegotiateDelegateByKdcPolicy,
+ prefs::kAuthNegotiateDelegateByKdcPolicy,
+ base::Value::Type::BOOLEAN },
+@@ -1997,7 +1997,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] =
+ #endif // BUILDFLAG(ENABLE_EXTENSIONS)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ { key::kEnforceLocalAnchorConstraintsEnabled,
+ prefs::kEnforceLocalAnchorConstraintsEnabled,
+ base::Value::Type::BOOLEAN },
+@@ -2055,7 +2055,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] =
+ ash::prefs::kUrlParameterToAutofillSAMLUsername,
+ base::Value::Type::STRING },
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ { key::kTabDiscardingExceptions,
+ performance_manager::user_tuning::prefs::kManagedTabDiscardingExceptions,
+ base::Value::Type::LIST },
+@@ -2084,7 +2084,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] =
+ prefs::kUiAutomationProviderEnabled,
+ base::Value::Type::BOOLEAN },
+ #endif // BUILDFLAG(IS_WIN)
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ { key::kOutOfProcessSystemDnsResolutionEnabled,
+ prefs::kOutOfProcessSystemDnsResolutionEnabled,
+ base::Value::Type::BOOLEAN },
+@@ -2118,7 +2118,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] =
+ base::Value::Type::INTEGER },
+ #endif
+ #if BUILDFLAG(ENABLE_EXTENSIONS)
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ { key::kExtensionInstallTypeBlocklist,
+ extensions::pref_names::kExtensionInstallTypeBlocklist,
+ base::Value::Type::LIST},
+@@ -2139,7 +2139,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] =
+ optimization_guide::model_execution::prefs::kWallpaperSearchEnterprisePolicyAllowed,
+ base::Value::Type::INTEGER},
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ { key::kChromeForTestingAllowed,
+ prefs::kChromeForTestingAllowed,
+ base::Value::Type::BOOLEAN },
+@@ -2267,7 +2267,7 @@ std::unique_ptr<ConfigurationPolicyHandlerList> BuildH
+ // Policies for all platforms - End
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ handlers->AddHandler(std::make_unique<IntRangePolicyHandler>(
+ key::kMemorySaverModeSavings,
+ performance_manager::user_tuning::prefs::kMemorySaverModeAggressiveness,
+@@ -2283,7 +2283,7 @@ std::unique_ptr<ConfigurationPolicyHandlerList> BuildH
+ // BUILDFLAG(IS_CHROMEOS_ASH)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ handlers->AddHandler(
+ std::make_unique<SiteSearchPolicyHandler>(chrome_schema));
+
+@@ -2489,7 +2489,7 @@ std::unique_ptr<ConfigurationPolicyHandlerList> BuildH
+ #endif // BUILDFLAG(IS_ANDROID)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ handlers->AddHandler(
+ std::make_unique<enterprise_idle::IdleTimeoutPolicyHandler>());
+ handlers->AddHandler(
+@@ -2547,7 +2547,7 @@ std::unique_ptr<ConfigurationPolicyHandlerList> BuildH
+ key::kBrowsingDataLifetime, browsing_data::prefs::kBrowsingDataLifetime,
+ chrome_schema));
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ handlers->AddHandler(std::make_unique<LocalSyncPolicyHandler>());
+ handlers->AddHandler(std::make_unique<ThemeColorPolicyHandler>());
+ handlers->AddHandler(
+@@ -2661,7 +2661,7 @@ std::unique_ptr<ConfigurationPolicyHandlerList> BuildH
+ std::vector<std::unique_ptr<ConfigurationPolicyHandler>>
+ signin_legacy_policies;
+ #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_LINUX)
++ BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ signin_legacy_policies.push_back(std::make_unique<SimplePolicyHandler>(
+ key::kForceBrowserSignin, prefs::kForceBrowserSignin,
+ base::Value::Type::BOOLEAN));
+@@ -3018,7 +3018,7 @@ std::unique_ptr<ConfigurationPolicyHandlerList> BuildH
+ #endif
+
+ #if BUILDFLAG(ENABLE_SPELLCHECK)
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ handlers->AddHandler(std::make_unique<SpellcheckLanguagePolicyHandler>());
+ handlers->AddHandler(
+ std::make_unique<SpellcheckLanguageBlocklistPolicyHandler>(
+@@ -3026,7 +3026,7 @@ std::unique_ptr<ConfigurationPolicyHandlerList> BuildH
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
+ #endif // BUILDFLAG(ENABLE_SPELLCHECK)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ handlers->AddHandler(std::make_unique<SimplePolicyHandler>(
+ key::kAllowSystemNotifications, prefs::kAllowSystemNotifications,
+ base::Value::Type::BOOLEAN));
+@@ -3044,7 +3044,7 @@ std::unique_ptr<ConfigurationPolicyHandlerList> BuildH
+ first_party_sets::FirstPartySetsOverridesPolicyHandler>(
+ key::kRelatedWebsiteSetsOverrides, chrome_schema)));
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ handlers->AddHandler(std::make_unique<PrivacySandboxPolicyHandler>());
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
+@@ -3067,7 +3067,7 @@ std::unique_ptr<ConfigurationPolicyHandlerList> BuildH
+ base::Value::Type::BOOLEAN)));
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ handlers->AddHandler(std::make_unique<BatterySaverPolicyHandler>());
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/devel/electron31/files/patch-chrome_browser_policy_device__management__service__configuration.cc b/devel/electron31/files/patch-chrome_browser_policy_device__management__service__configuration.cc
new file mode 100644
index 000000000000..2950a7414560
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_policy_device__management__service__configuration.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/policy/device_management_service_configuration.cc.orig 2024-04-15 20:33:47 UTC
++++ chrome/browser/policy/device_management_service_configuration.cc
+@@ -24,7 +24,7 @@
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+ ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \
+- !BUILDFLAG(IS_ANDROID))
++ !BUILDFLAG(IS_ANDROID)) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/connectors/common.h"
+ #include "chrome/browser/enterprise/connectors/connectors_service.h"
+ #endif
+@@ -102,7 +102,7 @@ DeviceManagementServiceConfiguration::GetReportingConn
+ content::BrowserContext* context) const {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+ ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \
+- !BUILDFLAG(IS_ANDROID))
++ !BUILDFLAG(IS_ANDROID)) || BUILDFLAG(IS_BSD)
+ auto* service =
+ enterprise_connectors::ConnectorsServiceFactory::GetForBrowserContext(
+ context);
diff --git a/devel/electron31/files/patch-chrome_browser_policy_policy__value__and__status__aggregator.cc b/devel/electron31/files/patch-chrome_browser_policy_policy__value__and__status__aggregator.cc
new file mode 100644
index 000000000000..383bfce1cb14
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_policy_policy__value__and__status__aggregator.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/policy/policy_value_and_status_aggregator.cc.orig 2024-06-18 21:43:23 UTC
++++ chrome/browser/policy/policy_value_and_status_aggregator.cc
+@@ -53,7 +53,7 @@
+ #include "chrome/browser/policy/value_provider/extension_policies_value_provider.h"
+ #endif // BUILDFLAG(ENABLE_EXTENSIONS)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "components/policy/core/common/cloud/profile_cloud_policy_manager.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
diff --git a/devel/electron31/files/patch-chrome_browser_prefs_browser__prefs.cc b/devel/electron31/files/patch-chrome_browser_prefs_browser__prefs.cc
new file mode 100644
index 000000000000..73b04c169c2f
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_prefs_browser__prefs.cc
@@ -0,0 +1,57 @@
+--- chrome/browser/prefs/browser_prefs.cc.orig 2024-06-18 21:43:23 UTC
++++ chrome/browser/prefs/browser_prefs.cc
+@@ -489,18 +489,18 @@
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "components/device_signals/core/browser/pref_names.h" // nogncheck due to crbug.com/1125897
+ #endif
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
+ #include "chrome/browser/browser_switcher/browser_switcher_prefs.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/signin/enterprise_signin_prefs.h"
+ #endif
+
+@@ -535,7 +535,7 @@
+ #include "chrome/browser/sessions/session_service_log.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/color/system_theme.h"
+ #endif
+
+@@ -1861,7 +1861,7 @@ void RegisterLocalState(PrefRegistrySimple* registry)
+ true);
+ #endif // BUILDFLAG(ENABLE_PDF)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ registry->RegisterBooleanPref(prefs::kChromeForTestingAllowed, true);
+ #endif
+
+@@ -2213,12 +2213,12 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySync
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ device_signals::RegisterProfilePrefs(registry);
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ browser_switcher::BrowserSwitcherPrefs::RegisterProfilePrefs(registry);
+ enterprise_signin::RegisterProfilePrefs(registry);
+ #endif
diff --git a/devel/electron31/files/patch-chrome_browser_prefs_pref__service__incognito__allowlist.cc b/devel/electron31/files/patch-chrome_browser_prefs_pref__service__incognito__allowlist.cc
new file mode 100644
index 000000000000..b64e7548d140
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_prefs_pref__service__incognito__allowlist.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/prefs/pref_service_incognito_allowlist.cc.orig 2024-04-15 20:33:47 UTC
++++ chrome/browser/prefs/pref_service_incognito_allowlist.cc
+@@ -184,7 +184,7 @@ const char* const kPersistentPrefNames[] = {
+ prefs::kShowFullscreenToolbar,
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Toggleing custom frames affects all open windows in the profile, hence
+ // should be written to the regular profile when changed in incognito mode.
+ prefs::kUseCustomChromeFrame,
diff --git a/devel/electron31/files/patch-chrome_browser_printing_print__backend__service__manager.cc b/devel/electron31/files/patch-chrome_browser_printing_print__backend__service__manager.cc
new file mode 100644
index 000000000000..f8e52788b5f1
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_printing_print__backend__service__manager.cc
@@ -0,0 +1,29 @@
+--- chrome/browser/printing/print_backend_service_manager.cc.orig 2024-06-18 21:43:23 UTC
++++ chrome/browser/printing/print_backend_service_manager.cc
+@@ -35,7 +35,7 @@
+ #include "printing/printing_context.h"
+ #include "printing/printing_features.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "content/public/common/content_switches.h"
+ #endif
+
+@@ -862,7 +862,7 @@ PrintBackendServiceManager::GetServiceFromBundle(
+ host.BindNewPipeAndPassReceiver(),
+ content::ServiceProcessHost::Options()
+ .WithDisplayName(IDS_UTILITY_PROCESS_PRINT_BACKEND_SERVICE_NAME)
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ .WithExtraCommandLineSwitches({switches::kMessageLoopTypeUi})
+ #endif
+ .Pass());
+@@ -1039,7 +1039,7 @@ PrintBackendServiceManager::DetermineIdleTimeoutUpdate
+ return kNoClientsRegisteredResetOnIdleTimeout;
+
+ case ClientType::kQueryWithUi:
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // No need to update if there were other query with UI clients.
+ if (HasQueryWithUiClientForRemoteId(remote_id)) {
+ return std::nullopt;
diff --git a/devel/electron31/files/patch-chrome_browser_printing_printer__query.cc b/devel/electron31/files/patch-chrome_browser_printing_printer__query.cc
new file mode 100644
index 000000000000..f916ff7895b2
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_printing_printer__query.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/printing/printer_query.cc.orig 2024-02-27 21:36:00 UTC
++++ chrome/browser/printing/printer_query.cc
+@@ -341,7 +341,7 @@ void PrinterQuery::UpdatePrintSettings(base::Value::Di
+ crash_key = std::make_unique<crash_keys::ScopedPrinterInfo>(
+ printer_name, print_backend->GetPrinterDriverInfo(printer_name));
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_CUPS)
++#if (BUILDFLAG(IS_BSD) || BUILDFLAG(IS_LINUX)) && BUILDFLAG(USE_CUPS)
+ PrinterBasicInfo basic_info;
+ if (print_backend->GetPrinterBasicInfo(printer_name, &basic_info) ==
+ mojom::ResultCode::kSuccess) {
diff --git a/devel/electron31/files/patch-chrome_browser_process__singleton__posix.cc b/devel/electron31/files/patch-chrome_browser_process__singleton__posix.cc
new file mode 100644
index 000000000000..c0c63ed10d5b
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_process__singleton__posix.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/process_singleton_posix.cc.orig 2024-02-27 21:36:00 UTC
++++ chrome/browser/process_singleton_posix.cc
+@@ -359,7 +359,7 @@ bool DisplayProfileInUseError(const base::FilePath& lo
+ if (g_disable_prompt)
+ return g_user_opted_unlock_in_use_profile;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::u16string relaunch_button_text =
+ l10n_util::GetStringUTF16(IDS_PROFILE_IN_USE_LINUX_RELAUNCH);
+ return ShowProcessSingletonDialog(error, relaunch_button_text);
diff --git a/devel/electron31/files/patch-chrome_browser_profiles_chrome__browser__main__extra__parts__profiles.cc b/devel/electron31/files/patch-chrome_browser_profiles_chrome__browser__main__extra__parts__profiles.cc
new file mode 100644
index 000000000000..b6a446d6dc25
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_profiles_chrome__browser__main__extra__parts__profiles.cc
@@ -0,0 +1,114 @@
+--- chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc.orig 2024-06-18 21:43:23 UTC
++++ chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
+@@ -329,7 +329,7 @@
+ #include "chromeos/constants/chromeos_features.h"
+ #endif
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/policy/messaging_layer/util/manual_test_heartbeat_event_factory.h"
+ #endif
+
+@@ -413,18 +413,18 @@
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service_factory.h"
+ #include "chrome/browser/enterprise/connectors/device_trust/device_trust_service_factory.h"
+ #include "chrome/browser/enterprise/signals/user_permission_service_factory.h"
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/idle/idle_service_factory.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/browser_switcher/browser_switcher_service_factory.h"
+ #include "chrome/browser/enterprise/client_certificates/certificate_provisioning_service_factory.h"
+ #include "chrome/browser/enterprise/client_certificates/certificate_store_factory.h"
+@@ -660,7 +660,7 @@ void ChromeBrowserMainExtraPartsProfiles::
+ DiceBoundSessionCookieServiceFactory::GetInstance();
+ #endif // BUILDFLAG(ENABLE_DICE_SUPPORT)
+ #endif // BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ browser_switcher::BrowserSwitcherServiceFactory::GetInstance();
+ #endif
+ browser_sync::UserEventServiceFactory::GetInstance();
+@@ -785,29 +785,29 @@ void ChromeBrowserMainExtraPartsProfiles::
+ enterprise_commands::UserRemoteCommandsServiceFactory::GetInstance();
+ #endif
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ enterprise_connectors::DeviceTrustConnectorServiceFactory::GetInstance();
+ enterprise_connectors::DeviceTrustServiceFactory::GetInstance();
+ #endif
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ enterprise_connectors::LocalBinaryUploadServiceFactory::GetInstance();
+ #endif
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ enterprise_idle::IdleServiceFactory::GetInstance();
+ #endif
+ #if !BUILDFLAG(IS_CHROMEOS_ASH)
+ enterprise_reporting::CloudProfileReportingServiceFactory::GetInstance();
+ #endif
+ enterprise_reporting::LegacyTechServiceFactory::GetInstance();
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ enterprise_signals::SignalsAggregatorFactory::GetInstance();
+ #endif
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ enterprise_signals::UserPermissionServiceFactory::GetInstance();
+ #endif
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ enterprise_signin::EnterpriseSigninServiceFactory::GetInstance();
+ #endif
+ #if BUILDFLAG(ENABLE_SESSION_SERVICE)
+@@ -933,7 +933,7 @@ void ChromeBrowserMainExtraPartsProfiles::
+ #endif
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
+ metrics::DesktopProfileSessionDurationsServiceFactory::GetInstance();
+ #endif
+@@ -1038,7 +1038,7 @@ void ChromeBrowserMainExtraPartsProfiles::
+ #if BUILDFLAG(IS_CHROMEOS)
+ policy::PolicyCertServiceFactory::GetInstance();
+ #endif
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ policy::ProfileTokenPolicyWebSigninServiceFactory::GetInstance();
+ policy::UserPolicyOidcSigninServiceFactory::GetInstance();
+ #endif
+@@ -1080,7 +1080,7 @@ void ChromeBrowserMainExtraPartsProfiles::
+ #if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID)
+ ProfileStatisticsFactory::GetInstance();
+ #endif
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ProfileTokenWebSigninInterceptorFactory::GetInstance();
+ OidcAuthenticationSigninInterceptorFactory::GetInstance();
+ #endif
+@@ -1099,7 +1099,7 @@ void ChromeBrowserMainExtraPartsProfiles::
+ #endif
+ ReduceAcceptLanguageFactory::GetInstance();
+ RendererUpdaterFactory::GetInstance();
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ reporting::ManualTestHeartbeatEventFactory::GetInstance();
+ #endif
+ #if BUILDFLAG(IS_CHROMEOS_LACROS)
diff --git a/devel/electron31/files/patch-chrome_browser_profiles_profile__impl.cc b/devel/electron31/files/patch-chrome_browser_profiles_profile__impl.cc
new file mode 100644
index 000000000000..22d8b80e73a0
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_profiles_profile__impl.cc
@@ -0,0 +1,40 @@
+--- chrome/browser/profiles/profile_impl.cc.orig 2024-06-18 21:43:23 UTC
++++ chrome/browser/profiles/profile_impl.cc
+@@ -262,6 +262,10 @@
+ #include "chrome/browser/spellchecker/spellcheck_service.h"
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#endif
++
+ using bookmarks::BookmarkModel;
+ using content::BrowserThread;
+ using content::DownloadManagerDelegate;
+@@ -596,7 +600,7 @@ void ProfileImpl::LoadPrefsForNormalStartup(bool async
+ #else
+ {
+ #endif // BUILDFLAG(IS_CHROMEOS_LACROS)
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ProfileManager* profile_manager = g_browser_process->profile_manager();
+ ProfileAttributesEntry* entry =
+ profile_manager->GetProfileAttributesStorage()
+@@ -890,7 +894,17 @@ base::FilePath ProfileImpl::last_selected_directory()
+ }
+
+ base::FilePath ProfileImpl::last_selected_directory() {
++#if BUILDFLAG(IS_OPENBSD)
++ // If unveil(2) is used, force the file dialog directory to something we
++ // know is available.
++ auto* sandbox = sandbox::policy::SandboxLinux::GetInstance();
++ if (sandbox->unveil_initialized())
++ return GetPrefs()->GetFilePath(prefs::kDownloadDefaultDirectory);
++ else
++ return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory);
++#else
+ return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory);
++#endif
+ }
+
+ void ProfileImpl::set_last_selected_directory(const base::FilePath& path) {
diff --git a/devel/electron31/files/patch-chrome_browser_profiles_profiles__state.cc b/devel/electron31/files/patch-chrome_browser_profiles_profiles__state.cc
new file mode 100644
index 000000000000..6d44814e300e
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_profiles_profiles__state.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/profiles/profiles_state.cc.orig 2024-02-21 00:20:35 UTC
++++ chrome/browser/profiles/profiles_state.cc
+@@ -195,7 +195,7 @@ bool IsGuestModeRequested(const base::CommandLine& com
+ PrefService* local_state,
+ bool show_warning) {
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ DCHECK(local_state);
+
+ // Check if guest mode enforcement commandline switch or policy are provided.
diff --git a/devel/electron31/files/patch-chrome_browser_renderer__preferences__util.cc b/devel/electron31/files/patch-chrome_browser_renderer__preferences__util.cc
new file mode 100644
index 000000000000..d64cbe1a3b53
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_renderer__preferences__util.cc
@@ -0,0 +1,29 @@
+--- chrome/browser/renderer_preferences_util.cc.orig 2024-04-15 20:33:47 UTC
++++ chrome/browser/renderer_preferences_util.cc
+@@ -39,7 +39,7 @@
+ #include "ui/views/controls/textfield/textfield.h"
+ #endif
+
+-#if defined(USE_AURA) && BUILDFLAG(IS_LINUX)
++#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))
+ #include "chrome/browser/themes/theme_service.h"
+ #include "chrome/browser/themes/theme_service_factory.h"
+ #include "ui/linux/linux_ui.h"
+@@ -154,7 +154,7 @@ void UpdateFromSystemSettings(blink::RendererPreferenc
+ prefs->caret_blink_interval = views::Textfield::GetCaretBlinkInterval();
+ #endif
+
+-#if defined(USE_AURA) && BUILDFLAG(IS_LINUX)
++#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))
+ auto* linux_ui_theme = ui::LinuxUiTheme::GetForProfile(profile);
+ if (linux_ui_theme) {
+ if (ThemeServiceFactory::GetForProfile(profile)->UsingSystemTheme()) {
+@@ -177,7 +177,7 @@ void UpdateFromSystemSettings(blink::RendererPreferenc
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ content::UpdateFontRendererPreferencesFromSystemSettings(prefs);
+ #endif
+
diff --git a/devel/electron31/files/patch-chrome_browser_resources_settings_autofill__page_passwords__shared.css b/devel/electron31/files/patch-chrome_browser_resources_settings_autofill__page_passwords__shared.css
new file mode 100644
index 000000000000..8df7a08eb462
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_resources_settings_autofill__page_passwords__shared.css
@@ -0,0 +1,11 @@
+--- chrome/browser/resources/settings/autofill_page/passwords_shared.css.orig 2022-10-24 13:33:33 UTC
++++ chrome/browser/resources/settings/autofill_page/passwords_shared.css
+@@ -100,7 +100,7 @@ cr-input.password-input::part(input),
+ * necessary to prevent Chrome from using the operating system's font
+ * instead of the Material Design font.
+ * TODO(dbeam): why not font: inherit? */
+-<if expr="is_linux or is_chromeos">
++<if expr="is_posix or is_chromeos">
+ font-family: 'DejaVu Sans Mono', monospace;
+ </if>
+ <if expr="is_win">
diff --git a/devel/electron31/files/patch-chrome_browser_resources_signin_signin__shared.css b/devel/electron31/files/patch-chrome_browser_resources_signin_signin__shared.css
new file mode 100644
index 000000000000..1531cc39292f
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_resources_signin_signin__shared.css
@@ -0,0 +1,11 @@
+--- chrome/browser/resources/signin/signin_shared.css.orig 2022-11-30 08:12:58 UTC
++++ chrome/browser/resources/signin/signin_shared.css
+@@ -54,7 +54,7 @@ a {
+ border-radius: var(--scrollbar-width);
+ }
+
+-<if expr="is_macosx or is_linux or is_chromeos">
++<if expr="is_macosx or is_posix or is_chromeos">
+ .action-container {
+ flex-flow: row-reverse;
+ justify-content: flex-start;
diff --git a/devel/electron31/files/patch-chrome_browser_safe__browsing_cloud__content__scanning_binary__upload__service.cc b/devel/electron31/files/patch-chrome_browser_safe__browsing_cloud__content__scanning_binary__upload__service.cc
new file mode 100644
index 000000000000..9f923aac381a
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_safe__browsing_cloud__content__scanning_binary__upload__service.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.cc.orig 2024-06-18 21:43:23 UTC
++++ chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.cc
+@@ -18,7 +18,7 @@
+ #include "net/base/url_util.h"
+ #include "third_party/abseil-cpp/absl/types/variant.h"
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/connectors/analysis/local_binary_upload_service_factory.h"
+ #endif
+
+@@ -434,7 +434,7 @@ BinaryUploadService* BinaryUploadService::GetForProfil
+ Profile* profile,
+ const enterprise_connectors::AnalysisSettings& settings) {
+ // Local content analysis is supported only on desktop platforms.
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (settings.cloud_or_local_settings.is_cloud_analysis()) {
+ return CloudBinaryUploadServiceFactory::GetForProfile(profile);
+ } else {
diff --git a/devel/electron31/files/patch-chrome_browser_safe__browsing_download__protection_file__analyzer.cc b/devel/electron31/files/patch-chrome_browser_safe__browsing_download__protection_file__analyzer.cc
new file mode 100644
index 000000000000..d8a4e394a4de
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_safe__browsing_download__protection_file__analyzer.cc
@@ -0,0 +1,29 @@
+--- chrome/browser/safe_browsing/download_protection/file_analyzer.cc.orig 2024-04-15 20:33:48 UTC
++++ chrome/browser/safe_browsing/download_protection/file_analyzer.cc
+@@ -21,7 +21,7 @@
+ #include "content/public/browser/browser_thread.h"
+ #include "url/gurl.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/safe_browsing/download_protection/document_analysis_service.h"
+ #endif
+
+@@ -85,7 +85,7 @@ void FileAnalyzer::Start(const base::FilePath& target_
+ } else if (inspection_type == DownloadFileType::DMG) {
+ StartExtractDmgFeatures();
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ } else if (inspection_type == DownloadFileType::OFFICE_DOCUMENT &&
+ !base::FeatureList::IsEnabled(kMaldocaSkipCheck)) {
+ StartExtractDocumentFeatures();
+@@ -326,7 +326,7 @@ void FileAnalyzer::OnDmgAnalysisFinished(
+ }
+ #endif // BUILDFLAG(IS_MAC)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ void FileAnalyzer::StartExtractDocumentFeatures() {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
diff --git a/devel/electron31/files/patch-chrome_browser_safe__browsing_download__protection_file__analyzer.h b/devel/electron31/files/patch-chrome_browser_safe__browsing_download__protection_file__analyzer.h
new file mode 100644
index 000000000000..e7fef7d0b6be
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_safe__browsing_download__protection_file__analyzer.h
@@ -0,0 +1,29 @@
+--- chrome/browser/safe_browsing/download_protection/file_analyzer.h.orig 2023-11-29 21:39:50 UTC
++++ chrome/browser/safe_browsing/download_protection/file_analyzer.h
+@@ -18,7 +18,7 @@
+ #include "components/safe_browsing/core/common/proto/csd.pb.h"
+ #include "third_party/protobuf/src/google/protobuf/repeated_field.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/services/file_util/public/cpp/sandboxed_document_analyzer.h"
+ #endif
+
+@@ -110,7 +110,7 @@ class FileAnalyzer {
+ const safe_browsing::ArchiveAnalyzerResults& archive_results);
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ void StartExtractDocumentFeatures();
+ void OnDocumentAnalysisFinished(
+ const DocumentAnalyzerResults& document_results);
+@@ -141,7 +141,7 @@ class FileAnalyzer {
+ dmg_analyzer_{nullptr, base::OnTaskRunnerDeleter(nullptr)};
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<SandboxedDocumentAnalyzer, base::OnTaskRunnerDeleter>
+ document_analyzer_{nullptr, base::OnTaskRunnerDeleter(nullptr)};
+ base::TimeTicks document_analysis_start_time_;
diff --git a/devel/electron31/files/patch-chrome_browser_safe__browsing_incident__reporting_incident__reporting__service.cc b/devel/electron31/files/patch-chrome_browser_safe__browsing_incident__reporting_incident__reporting__service.cc
new file mode 100644
index 000000000000..1bce1d5e5d0e
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_safe__browsing_incident__reporting_incident__reporting__service.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc.orig 2023-11-29 21:39:50 UTC
++++ chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
+@@ -694,7 +694,7 @@ void IncidentReportingService::OnEnvironmentDataCollec
+
+ // Process::Current().CreationTime() is missing on some platforms.
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::TimeDelta uptime =
+ first_incident_time_ - base::Process::Current().CreationTime();
+ environment_data->mutable_process()->set_uptime_msec(uptime.InMilliseconds());
diff --git a/devel/electron31/files/patch-chrome_browser_screen__ai_screen__ai__install__state.cc b/devel/electron31/files/patch-chrome_browser_screen__ai_screen__ai__install__state.cc
new file mode 100644
index 000000000000..747774d7b2da
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_screen__ai_screen__ai__install__state.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/screen_ai/screen_ai_install_state.cc.orig 2024-06-18 21:43:23 UTC
++++ chrome/browser/screen_ai/screen_ai_install_state.cc
+@@ -22,7 +22,7 @@
+ #include "services/screen_ai/public/cpp/utilities.h"
+ #include "ui/accessibility/accessibility_features.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/cpu.h"
+ #include "base/files/file_util.h"
+ #endif
+@@ -32,7 +32,7 @@ bool IsDeviceCompatible() {
+ const char kMinExpectedVersion[] = "123.1";
+
+ bool IsDeviceCompatible() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #if defined(ARCH_CPU_X86_FAMILY)
+ // Check if the CPU has the required instruction set to run the Screen AI
+ // library.
diff --git a/devel/electron31/files/patch-chrome_browser_screen__ai_screen__ai__service__router.cc b/devel/electron31/files/patch-chrome_browser_screen__ai_screen__ai__service__router.cc
new file mode 100644
index 000000000000..345eb6cf041b
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_screen__ai_screen__ai__service__router.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/screen_ai/screen_ai_service_router.cc.orig 2024-06-18 21:43:23 UTC
++++ chrome/browser/screen_ai/screen_ai_service_router.cc
+@@ -280,7 +280,7 @@ void ScreenAIServiceRouter::LaunchIfNotRunning() {
+ base::FilePath binary_path = state_instance->get_component_binary_path();
+ #if BUILDFLAG(IS_WIN)
+ std::vector<base::FilePath> preload_libraries = {binary_path};
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::vector<std::string> extra_switches = {
+ base::StringPrintf("--%s=%s", screen_ai::GetBinaryPathSwitch(),
+ binary_path.MaybeAsASCII().c_str())};
+@@ -294,7 +294,7 @@ void ScreenAIServiceRouter::LaunchIfNotRunning() {
+ .WithPreloadedLibraries(
+ preload_libraries,
+ content::ServiceProcessHostPreloadLibraries::GetPassKey())
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ .WithExtraCommandLineSwitches(extra_switches)
+ #endif // BUILDFLAG(IS_WIN)
+ .Pass());
diff --git a/devel/electron31/files/patch-chrome_browser_send__tab__to__self_receiving__ui__handler__registry.cc b/devel/electron31/files/patch-chrome_browser_send__tab__to__self_receiving__ui__handler__registry.cc
new file mode 100644
index 000000000000..49407c1212fa
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_send__tab__to__self_receiving__ui__handler__registry.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/send_tab_to_self/receiving_ui_handler_registry.cc.orig 2024-06-18 21:43:23 UTC
++++ chrome/browser/send_tab_to_self/receiving_ui_handler_registry.cc
+@@ -15,7 +15,7 @@
+ #include "components/send_tab_to_self/features.h"
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/send_tab_to_self/desktop_notification_handler.h"
+ #include "chrome/browser/ui/send_tab_to_self/send_tab_to_self_toolbar_icon_controller.h"
+ #endif
+@@ -47,7 +47,7 @@ ReceivingUiHandlerRegistry::GetToolbarButtonController
+ ReceivingUiHandlerRegistry::GetToolbarButtonControllerForProfile(
+ Profile* profile) {
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ for (const std::unique_ptr<ReceivingUiHandler>& handler :
+ applicable_handlers_) {
+ auto* button_controller =
diff --git a/devel/electron31/files/patch-chrome_browser_send__tab__to__self_send__tab__to__self__client__service.cc b/devel/electron31/files/patch-chrome_browser_send__tab__to__self_send__tab__to__self__client__service.cc
new file mode 100644
index 000000000000..08f48edc2433
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_send__tab__to__self_send__tab__to__self__client__service.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/send_tab_to_self/send_tab_to_self_client_service.cc.orig 2024-04-15 20:33:48 UTC
++++ chrome/browser/send_tab_to_self/send_tab_to_self_client_service.cc
+@@ -16,7 +16,7 @@
+ #include "components/send_tab_to_self/send_tab_to_self_model.h"
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/send_tab_to_self/send_tab_to_self_toolbar_icon_controller.h"
+ #endif
+
+@@ -50,7 +50,7 @@ void SendTabToSelfClientService::EntriesAddedRemotely(
+ const std::vector<const SendTabToSelfEntry*>& new_entries) {
+ for (const std::unique_ptr<ReceivingUiHandler>& handler : GetHandlers()) {
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Only respond to notifications corresponding to this service's profile
+ // for these OSes; mobile does not have a Profile.
+ // Cast note: on desktop, handlers are guaranteed to be the derived class
diff --git a/devel/electron31/files/patch-chrome_browser_sharing_sharing__device__registration.cc b/devel/electron31/files/patch-chrome_browser_sharing_sharing__device__registration.cc
new file mode 100644
index 000000000000..92dc7cf941e3
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_sharing_sharing__device__registration.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/sharing/sharing_device_registration.cc.orig 2024-02-21 00:20:36 UTC
++++ chrome/browser/sharing/sharing_device_registration.cc
+@@ -328,7 +328,7 @@ bool SharingDeviceRegistration::IsRemoteCopySupported(
+
+ bool SharingDeviceRegistration::IsRemoteCopySupported() const {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return true;
+ #else
+ return false;
diff --git a/devel/electron31/files/patch-chrome_browser_sharing_sharing__handler__registry__impl.cc b/devel/electron31/files/patch-chrome_browser_sharing_sharing__handler__registry__impl.cc
new file mode 100644
index 000000000000..7f6d529a6fe3
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_sharing_sharing__handler__registry__impl.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/sharing/sharing_handler_registry_impl.cc.orig 2024-06-18 21:43:23 UTC
++++ chrome/browser/sharing/sharing_handler_registry_impl.cc
+@@ -22,7 +22,7 @@
+ #endif // BUILDFLAG(IS_ANDROID)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/sharing/shared_clipboard/remote_copy_message_handler.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || (BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS_LACROS)) BUILDFLAG(IS_CHROMEOS)
+@@ -74,7 +74,7 @@ SharingHandlerRegistryImpl::SharingHandlerRegistryImpl
+ #endif // !BUILDFLAG(IS_ANDROID)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (sharing_device_registration->IsRemoteCopySupported()) {
+ AddSharingHandler(
+ std::make_unique<RemoteCopyMessageHandler>(profile),
diff --git a/devel/electron31/files/patch-chrome_browser_shortcuts_icon__badging.cc b/devel/electron31/files/patch-chrome_browser_shortcuts_icon__badging.cc
new file mode 100644
index 000000000000..98e27521c5b0
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_shortcuts_icon__badging.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/shortcuts/icon_badging.cc.orig 2024-06-18 21:43:23 UTC
++++ chrome/browser/shortcuts/icon_badging.cc
+@@ -59,7 +59,7 @@ constexpr ShortcutSize kSizesNeededForShortcutCreation
+ constexpr ShortcutSize kSizesNeededForShortcutCreation[] = {
+ ShortcutSize::k16, ShortcutSize::k32, ShortcutSize::k128,
+ ShortcutSize::k256, ShortcutSize::k512};
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ constexpr ShortcutSize kSizesNeededForShortcutCreation[] = {ShortcutSize::k32,
+ ShortcutSize::k128};
+ #elif BUILDFLAG(IS_WIN)
diff --git a/devel/electron31/files/patch-chrome_browser_signin_signin__util.cc b/devel/electron31/files/patch-chrome_browser_signin_signin__util.cc
new file mode 100644
index 000000000000..883bd03840f2
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_signin_signin__util.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/signin/signin_util.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/signin/signin_util.cc
+@@ -80,7 +80,7 @@ void CookiesMover::StartMovingCookies() {
+ CookiesMover::~CookiesMover() = default;
+
+ void CookiesMover::StartMovingCookies() {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ bool allow_cookies_to_be_moved = base::FeatureList::IsEnabled(
+ profile_management::features::kThirdPartyProfileManagement);
+ #else
diff --git a/devel/electron31/files/patch-chrome_browser_supervised__user_supervised__user__extensions__delegate__impl.cc b/devel/electron31/files/patch-chrome_browser_supervised__user_supervised__user__extensions__delegate__impl.cc
new file mode 100644
index 000000000000..03c772b8d5a0
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_supervised__user_supervised__user__extensions__delegate__impl.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/supervised_user/supervised_user_extensions_delegate_impl.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/supervised_user/supervised_user_extensions_delegate_impl.cc
+@@ -185,7 +185,7 @@ void SupervisedUserExtensionsDelegateImpl::RequestExte
+ return;
+ }
+ }
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ CHECK(contents.value());
+ content::WebContents* web_contents = contents.value().get();
+ if (CanInstallExtensions()) {
diff --git a/devel/electron31/files/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.cc b/devel/electron31/files/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.cc
new file mode 100644
index 000000000000..168821ce4ba9
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/supervised_user/supervised_user_extensions_manager.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/supervised_user/supervised_user_extensions_manager.cc
+@@ -353,7 +353,7 @@ void SupervisedUserExtensionsManager::
+ ActivateManagementPolicyAndUpdateRegistration() {
+ SetActiveForSupervisedUsers();
+ UpdateManagementPolicyRegistration();
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ MaybeMarkExtensionsLocallyParentApproved();
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+ }
+@@ -470,7 +470,7 @@ bool SupervisedUserExtensionsManager::ShouldBlockExten
+ return false;
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SupervisedUserExtensionsManager::
+ MaybeMarkExtensionsLocallyParentApproved() {
+ supervised_user::LocallyParentApprovedExtensionsMigrationState
diff --git a/devel/electron31/files/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.h b/devel/electron31/files/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.h
new file mode 100644
index 000000000000..ebbcd55a4b47
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.h
@@ -0,0 +1,11 @@
+--- chrome/browser/supervised_user/supervised_user_extensions_manager.h.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/supervised_user/supervised_user_extensions_manager.h
+@@ -147,7 +147,7 @@ class SupervisedUserExtensionsManager : public Extensi
+ // launched.
+ bool ShouldBlockExtension(const std::string& extension_id) const;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Triggers an one-time migration of the present extensions as parent-approved
+ // when the feature
+ // `kEnableSupervisedUserSkipParentApprovalToInstallExtensions` becomes
diff --git a/devel/electron31/files/patch-chrome_browser_supervised__user_supervised__user__navigation__observer.cc b/devel/electron31/files/patch-chrome_browser_supervised__user_supervised__user__navigation__observer.cc
new file mode 100644
index 000000000000..dd79c3b823f1
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_supervised__user_supervised__user__navigation__observer.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/supervised_user/supervised_user_navigation_observer.cc.orig 2024-02-21 00:20:36 UTC
++++ chrome/browser/supervised_user/supervised_user_navigation_observer.cc
+@@ -47,7 +47,7 @@
+ #include "chrome/browser/supervised_user/android/supervised_user_web_content_handler_impl.h"
+ #elif BUILDFLAG(IS_CHROMEOS)
+ #include "chrome/browser/supervised_user/chromeos/supervised_user_web_content_handler_impl.h"
+-#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/supervised_user/linux_mac_windows/supervised_user_web_content_handler_impl.h"
+ #endif
+
+@@ -67,7 +67,7 @@ std::unique_ptr<supervised_user::WebContentHandler> Cr
+ #elif BUILDFLAG(IS_ANDROID)
+ return std::make_unique<SupervisedUserWebContentHandlerImpl>(
+ web_contents, frame_id, navigation_id);
+-#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ return std::make_unique<SupervisedUserWebContentHandlerImpl>(
+ web_contents, frame_id, navigation_id);
+ #endif
diff --git a/devel/electron31/files/patch-chrome_browser_sync_chrome__sync__client.cc b/devel/electron31/files/patch-chrome_browser_sync_chrome__sync__client.cc
new file mode 100644
index 000000000000..5519e5a6b98a
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_sync_chrome__sync__client.cc
@@ -0,0 +1,38 @@
+--- chrome/browser/sync/chrome_sync_client.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/sync/chrome_sync_client.cc
+@@ -116,7 +116,7 @@
+ #endif // BUILDFLAG(ENABLE_SPELLCHECK)
+
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_keyed_service.h"
+ #include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_service_factory.h"
+ #elif BUILDFLAG(IS_ANDROID)
+@@ -474,7 +474,7 @@ ChromeSyncClient::CreateModelTypeControllers(
+ // platforms.
+ bool enable_tab_group_sync = false;
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ enable_tab_group_sync = true;
+ #elif BUILDFLAG(IS_ANDROID)
+ enable_tab_group_sync = tab_groups::IsTabGroupSyncEnabled(GetPrefService());
+@@ -506,7 +506,7 @@ ChromeSyncClient::CreateModelTypeControllers(
+
+ // Chrome prefers OS provided spell checkers where they exist. So only sync the
+ // custom dictionary on platforms that typically don't provide one.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Dictionary sync is enabled by default.
+ if (GetPrefService()->GetBoolean(spellcheck::prefs::kSpellCheckEnable)) {
+ controllers.push_back(
+@@ -663,7 +663,7 @@ ChromeSyncClient::GetControllerDelegateForModelType(sy
+ switch (type) {
+ case syncer::SAVED_TAB_GROUP: {
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ auto* keyed_service =
+ tab_groups::SavedTabGroupServiceFactory::GetForProfile(profile_);
+ CHECK(keyed_service);
diff --git a/devel/electron31/files/patch-chrome_browser_sync_device__info__sync__client__impl.cc b/devel/electron31/files/patch-chrome_browser_sync_device__info__sync__client__impl.cc
new file mode 100644
index 000000000000..f00088bfe822
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_sync_device__info__sync__client__impl.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/sync/device_info_sync_client_impl.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/sync/device_info_sync_client_impl.cc
+@@ -41,7 +41,7 @@ std::string DeviceInfoSyncClientImpl::GetSigninScopedD
+ // included in lacros-chrome once build flag switch of lacros-chrome is
+ // complete.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ syncer::SyncPrefs prefs(profile_->GetPrefs());
+ if (prefs.IsLocalSyncEnabled()) {
+ return "local_device";
diff --git a/devel/electron31/files/patch-chrome_browser_sync_sync__service__factory.cc b/devel/electron31/files/patch-chrome_browser_sync_sync__service__factory.cc
new file mode 100644
index 000000000000..34c08f5da647
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_sync_sync__service__factory.cc
@@ -0,0 +1,29 @@
+--- chrome/browser/sync/sync_service_factory.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/sync/sync_service_factory.cc
+@@ -82,7 +82,7 @@
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_service_factory.h"
+ #elif BUILDFLAG(IS_ANDROID)
+ #include "chrome/browser/tab_group_sync/tab_group_sync_service_factory.h"
+@@ -133,7 +133,7 @@ std::unique_ptr<KeyedService> BuildSyncService(
+ // TODO(crbug.com/40118868): Reassess whether the following block needs to be
+ // included in lacros-chrome once build flag switch of lacros-chrome is
+ // complete.
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
+ syncer::SyncPrefs prefs(profile->GetPrefs());
+ local_sync_backend_enabled = prefs.IsLocalSyncEnabled();
+@@ -269,7 +269,7 @@ SyncServiceFactory::SyncServiceFactory()
+ DependsOn(ProfilePasswordStoreFactory::GetInstance());
+ DependsOn(PowerBookmarkServiceFactory::GetInstance());
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ DependsOn(tab_groups::SavedTabGroupServiceFactory::GetInstance());
+ #elif BUILDFLAG(IS_ANDROID)
+ DependsOn(tab_groups::TabGroupSyncServiceFactory::GetInstance());
diff --git a/devel/electron31/files/patch-chrome_browser_sync_sync__service__util.cc b/devel/electron31/files/patch-chrome_browser_sync_sync__service__util.cc
new file mode 100644
index 000000000000..9ad33e0499f3
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_sync_sync__service__util.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/sync/sync_service_util.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/sync/sync_service_util.cc
+@@ -9,7 +9,7 @@
+ #include "components/sync/base/features.h"
+
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "components/variations/service/variations_service.h"
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) ||
+ // BUILDFLAG(IS_WIN)
+@@ -21,7 +21,7 @@ bool IsDesktopEnUSLocaleOnlySyncPollFeatureEnabled() {
+ }
+
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ std::string country_code;
+ auto* variations_service = g_browser_process->variations_service();
+ if (variations_service) {
diff --git a/devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__group.cc b/devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__group.cc
new file mode 100644
index 000000000000..66573c3610d6
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__group.cc
@@ -0,0 +1,38 @@
+--- chrome/browser/task_manager/sampling/task_group.cc.orig 2023-02-01 18:43:12 UTC
++++ chrome/browser/task_manager/sampling/task_group.cc
+@@ -38,7 +38,7 @@ const int kBackgroundRefreshTypesMask =
+ #if BUILDFLAG(IS_WIN)
+ REFRESH_TYPE_START_TIME | REFRESH_TYPE_CPU_TIME |
+ #endif // BUILDFLAG(IS_WIN)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ REFRESH_TYPE_FD_COUNT |
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+ #if BUILDFLAG(ENABLE_NACL)
+@@ -123,7 +123,7 @@ TaskGroup::TaskGroup(
+ #if BUILDFLAG(ENABLE_NACL)
+ nacl_debug_stub_port_(nacl::kGdbDebugStubPortUnknown),
+ #endif // BUILDFLAG(ENABLE_NACL)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ open_fd_count_(-1),
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+ idle_wakeups_per_second_(-1),
+@@ -142,7 +142,7 @@ TaskGroup::TaskGroup(
+ weak_ptr_factory_.GetWeakPtr()),
+ base::BindRepeating(&TaskGroup::OnIdleWakeupsRefreshDone,
+ weak_ptr_factory_.GetWeakPtr()),
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ base::BindRepeating(&TaskGroup::OnOpenFdCountRefreshDone,
+ weak_ptr_factory_.GetWeakPtr()),
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+@@ -322,7 +322,7 @@ void TaskGroup::OnRefreshNaClDebugStubPortDone(int nac
+ }
+ #endif // BUILDFLAG(ENABLE_NACL)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ void TaskGroup::OnOpenFdCountRefreshDone(int open_fd_count) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+
diff --git a/devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__group.h b/devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__group.h
new file mode 100644
index 000000000000..96726f380317
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__group.h
@@ -0,0 +1,38 @@
+--- chrome/browser/task_manager/sampling/task_group.h.orig 2024-02-21 00:20:36 UTC
++++ chrome/browser/task_manager/sampling/task_group.h
+@@ -44,7 +44,7 @@ constexpr int kUnsupportedVMRefreshFlags =
+ REFRESH_TYPE_WEBCACHE_STATS | REFRESH_TYPE_NETWORK_USAGE |
+ REFRESH_TYPE_NACL | REFRESH_TYPE_IDLE_WAKEUPS | REFRESH_TYPE_HANDLES |
+ REFRESH_TYPE_START_TIME | REFRESH_TYPE_CPU_TIME | REFRESH_TYPE_PRIORITY |
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ REFRESH_TYPE_FD_COUNT |
+ #endif
+ REFRESH_TYPE_HARD_FAULTS;
+@@ -152,7 +152,7 @@ class TaskGroup {
+ }
+ #endif // BUILDFLAG(ENABLE_NACL)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ int open_fd_count() const { return open_fd_count_; }
+ void set_open_fd_count(int open_fd_count) { open_fd_count_ = open_fd_count; }
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+@@ -172,7 +172,7 @@ class TaskGroup {
+ void RefreshNaClDebugStubPort(int child_process_unique_id);
+ void OnRefreshNaClDebugStubPortDone(int port);
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ void OnOpenFdCountRefreshDone(int open_fd_count);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+
+@@ -244,7 +244,7 @@ class TaskGroup {
+ #if BUILDFLAG(ENABLE_NACL)
+ int nacl_debug_stub_port_;
+ #endif // BUILDFLAG(ENABLE_NACL)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // The number of file descriptors currently open by the process.
+ int open_fd_count_;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
diff --git a/devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__group__sampler.cc b/devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__group__sampler.cc
new file mode 100644
index 000000000000..d42101ef7b4e
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__group__sampler.cc
@@ -0,0 +1,47 @@
+--- chrome/browser/task_manager/sampling/task_group_sampler.cc.orig 2024-04-15 20:33:48 UTC
++++ chrome/browser/task_manager/sampling/task_group_sampler.cc
+@@ -46,7 +46,7 @@ TaskGroupSampler::TaskGroupSampler(
+ const OnCpuRefreshCallback& on_cpu_refresh,
+ const OnSwappedMemRefreshCallback& on_swapped_mem_refresh,
+ const OnIdleWakeupsCallback& on_idle_wakeups,
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ const OnOpenFdCountCallback& on_open_fd_count,
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+ const OnProcessPriorityCallback& on_process_priority)
+@@ -56,7 +56,7 @@ TaskGroupSampler::TaskGroupSampler(
+ on_cpu_refresh_callback_(on_cpu_refresh),
+ on_swapped_mem_refresh_callback_(on_swapped_mem_refresh),
+ on_idle_wakeups_callback_(on_idle_wakeups),
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ on_open_fd_count_callback_(on_open_fd_count),
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+ on_process_priority_callback_(on_process_priority) {
+@@ -86,7 +86,7 @@ void TaskGroupSampler::Refresh(int64_t refresh_flags)
+ base::BindOnce(on_swapped_mem_refresh_callback_));
+ }
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (TaskManagerObserver::IsResourceRefreshEnabled(REFRESH_TYPE_IDLE_WAKEUPS,
+ refresh_flags)) {
+ blocking_pool_runner_->PostTaskAndReplyWithResult(
+@@ -96,7 +96,7 @@ void TaskGroupSampler::Refresh(int64_t refresh_flags)
+ }
+ #endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (TaskManagerObserver::IsResourceRefreshEnabled(REFRESH_TYPE_FD_COUNT,
+ refresh_flags)) {
+ blocking_pool_runner_->PostTaskAndReplyWithResult(
+@@ -150,7 +150,7 @@ int TaskGroupSampler::RefreshIdleWakeupsPerSecond() {
+ return process_metrics_->GetIdleWakeupsPerSecond();
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ int TaskGroupSampler::RefreshOpenFdCount() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(worker_pool_sequenced_checker_);
+
diff --git a/devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__group__sampler.h b/devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__group__sampler.h
new file mode 100644
index 000000000000..d148301a5b99
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__group__sampler.h
@@ -0,0 +1,38 @@
+--- chrome/browser/task_manager/sampling/task_group_sampler.h.orig 2023-10-19 19:58:06 UTC
++++ chrome/browser/task_manager/sampling/task_group_sampler.h
+@@ -31,7 +31,7 @@ class TaskGroupSampler : public base::RefCountedThread
+ using OnCpuRefreshCallback = base::RepeatingCallback<void(double)>;
+ using OnSwappedMemRefreshCallback = base::RepeatingCallback<void(int64_t)>;
+ using OnIdleWakeupsCallback = base::RepeatingCallback<void(int)>;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ using OnOpenFdCountCallback = base::RepeatingCallback<void(int)>;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+ using OnProcessPriorityCallback =
+@@ -43,7 +43,7 @@ class TaskGroupSampler : public base::RefCountedThread
+ const OnCpuRefreshCallback& on_cpu_refresh,
+ const OnSwappedMemRefreshCallback& on_memory_refresh,
+ const OnIdleWakeupsCallback& on_idle_wakeups,
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ const OnOpenFdCountCallback& on_open_fd_count,
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+ const OnProcessPriorityCallback& on_process_priority);
+@@ -63,7 +63,7 @@ class TaskGroupSampler : public base::RefCountedThread
+ double RefreshCpuUsage();
+ int64_t RefreshSwappedMem();
+ int RefreshIdleWakeupsPerSecond();
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ int RefreshOpenFdCount();
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+ base::Process::Priority RefreshProcessPriority();
+@@ -87,7 +87,7 @@ class TaskGroupSampler : public base::RefCountedThread
+ const OnCpuRefreshCallback on_cpu_refresh_callback_;
+ const OnSwappedMemRefreshCallback on_swapped_mem_refresh_callback_;
+ const OnIdleWakeupsCallback on_idle_wakeups_callback_;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ const OnOpenFdCountCallback on_open_fd_count_callback_;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+ const OnProcessPriorityCallback on_process_priority_callback_;
diff --git a/devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__manager__impl.cc b/devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__manager__impl.cc
new file mode 100644
index 000000000000..33cb674deee0
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_task__manager_sampling_task__manager__impl.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/task_manager/sampling/task_manager_impl.cc.orig 2024-02-21 00:20:36 UTC
++++ chrome/browser/task_manager/sampling/task_manager_impl.cc
+@@ -218,7 +218,7 @@ int TaskManagerImpl::GetOpenFdCount(TaskId task_id) co
+ }
+
+ int TaskManagerImpl::GetOpenFdCount(TaskId task_id) const {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ return GetTaskGroupByTaskId(task_id)->open_fd_count();
+ #else
+ return -1;
diff --git a/devel/electron31/files/patch-chrome_browser_task__manager_task__manager__observer.h b/devel/electron31/files/patch-chrome_browser_task__manager_task__manager__observer.h
new file mode 100644
index 000000000000..a2f4e51049f7
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_task__manager_task__manager__observer.h
@@ -0,0 +1,11 @@
+--- chrome/browser/task_manager/task_manager_observer.h.orig 2022-02-28 16:54:41 UTC
++++ chrome/browser/task_manager/task_manager_observer.h
+@@ -47,7 +47,7 @@ enum RefreshType {
+ // or backgrounded.
+ REFRESH_TYPE_PRIORITY = 1 << 13,
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // For observers interested in getting the number of open file descriptors of
+ // processes.
+ REFRESH_TYPE_FD_COUNT = 1 << 14,
diff --git a/devel/electron31/files/patch-chrome_browser_themes_theme__helper.cc b/devel/electron31/files/patch-chrome_browser_themes_theme__helper.cc
new file mode 100644
index 000000000000..032985e9aeae
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_themes_theme__helper.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/themes/theme_helper.cc.orig 2022-10-24 13:33:33 UTC
++++ chrome/browser/themes/theme_helper.cc
+@@ -18,7 +18,7 @@
+ #include "ui/gfx/image/image.h"
+ #include "ui/native_theme/native_theme.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui.h"
+ #endif
+
diff --git a/devel/electron31/files/patch-chrome_browser_themes_theme__service.cc b/devel/electron31/files/patch-chrome_browser_themes_theme__service.cc
new file mode 100644
index 000000000000..7462b20d259b
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_themes_theme__service.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/themes/theme_service.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/themes/theme_service.cc
+@@ -73,7 +73,7 @@
+ #include "extensions/browser/extension_registry_observer.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui.h"
+ #include "ui/ozone/public/ozone_platform.h"
+ #endif
+@@ -329,7 +329,7 @@ bool ThemeService::ShouldUseCustomFrame() const {
+ }
+
+ bool ThemeService::ShouldUseCustomFrame() const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!ui::OzonePlatform::GetInstance()
+ ->GetPlatformRuntimeProperties()
+ .supports_server_side_window_decorations) {
diff --git a/devel/electron31/files/patch-chrome_browser_themes_theme__service__aura__linux.cc b/devel/electron31/files/patch-chrome_browser_themes_theme__service__aura__linux.cc
new file mode 100644
index 000000000000..1e9040e78ce0
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_themes_theme__service__aura__linux.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/themes/theme_service_aura_linux.cc.orig 2022-11-30 08:12:58 UTC
++++ chrome/browser/themes/theme_service_aura_linux.cc
+@@ -24,7 +24,7 @@ namespace {
+ ui::SystemTheme ValidateSystemTheme(ui::SystemTheme system_theme) {
+ switch (system_theme) {
+ case ui::SystemTheme::kDefault:
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ case ui::SystemTheme::kGtk:
+ case ui::SystemTheme::kQt:
+ #endif
diff --git a/devel/electron31/files/patch-chrome_browser_themes_theme__service__factory.cc b/devel/electron31/files/patch-chrome_browser_themes_theme__service__factory.cc
new file mode 100644
index 000000000000..0026d7654cbe
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_themes_theme__service__factory.cc
@@ -0,0 +1,37 @@
+--- chrome/browser/themes/theme_service_factory.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/themes/theme_service_factory.cc
+@@ -27,11 +27,11 @@
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/themes/theme_service_aura_linux.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui_factory.h"
+ #endif
+
+@@ -103,7 +103,7 @@ KeyedService* ThemeServiceFactory::BuildServiceInstanc
+
+ KeyedService* ThemeServiceFactory::BuildServiceInstanceFor(
+ content::BrowserContext* profile) const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ using ThemeService = ThemeServiceAuraLinux;
+ #endif
+
+@@ -117,9 +117,9 @@ void ThemeServiceFactory::RegisterProfilePrefs(
+ user_prefs::PrefRegistrySyncable* registry) {
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ ui::SystemTheme default_system_theme = ui::SystemTheme::kDefault;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ default_system_theme = ui::GetDefaultSystemTheme();
+ #endif
+ registry->RegisterIntegerPref(prefs::kSystemTheme,
diff --git a/devel/electron31/files/patch-chrome_browser_ui_actions_chrome__action__id.h b/devel/electron31/files/patch-chrome_browser_ui_actions_chrome__action__id.h
new file mode 100644
index 000000000000..526b4200f753
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_actions_chrome__action__id.h
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/actions/chrome_action_id.h.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/actions/chrome_action_id.h
+@@ -518,7 +518,7 @@
+ IDC_CONTENT_CONTEXT_QUICK_ANSWERS_INLINE_ANSWER) \
+ E(kActionContentContextQuickAnswersInlineQuery, \
+ IDC_CONTENT_CONTEXT_QUICK_ANSWERS_INLINE_QUERY)
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #define CHROME_PLATFORM_SPECIFIC_ACTION_IDS \
+ E(kUseSystemTitleBar, IDC_USE_SYSTEM_TITLE_BAR) \
+ E(kRestoreWindow, IDC_RESTORE_WINDOW)
diff --git a/devel/electron31/files/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.cc b/devel/electron31/files/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.cc
new file mode 100644
index 000000000000..b9e1b303ec96
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/autofill/payments/desktop_payments_window_manager.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/autofill/payments/desktop_payments_window_manager.cc
+@@ -47,7 +47,7 @@ DesktopPaymentsWindowManager::DesktopPaymentsWindowMan
+ DesktopPaymentsWindowManager::DesktopPaymentsWindowManager(
+ ContentAutofillClient* client)
+ : client_(CHECK_DEREF(client)) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ scoped_observation_.Observe(BrowserList::GetInstance());
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
+ }
+@@ -90,7 +90,7 @@ void DesktopPaymentsWindowManager::WebContentsDestroye
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ void DesktopPaymentsWindowManager::OnBrowserSetLastActive(Browser* browser) {
+ // If there is an ongoing payments window manager pop-up flow, and the
+ // original tab's WebContents become active, activate the pop-up's
diff --git a/devel/electron31/files/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.h b/devel/electron31/files/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.h
new file mode 100644
index 000000000000..240c22e53399
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.h
@@ -0,0 +1,38 @@
+--- chrome/browser/ui/autofill/payments/desktop_payments_window_manager.h.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/autofill/payments/desktop_payments_window_manager.h
+@@ -14,7 +14,7 @@
+ #include "components/autofill/core/browser/payments/payments_window_manager.h"
+ #include "content/public/browser/web_contents_observer.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #include "base/scoped_observation.h"
+ #include "chrome/browser/ui/browser_list.h"
+ #include "chrome/browser/ui/browser_list_observer.h"
+@@ -39,7 +39,7 @@ class DesktopPaymentsWindowManager : public PaymentsWi
+ // WebContents of the original tab that the pop-up is created in. If there is a
+ // pop-up currently present, `this` will observe the WebContents of that pop-up.
+ class DesktopPaymentsWindowManager : public PaymentsWindowManager,
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ public BrowserListObserver,
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
+ public content::WebContentsObserver {
+@@ -58,7 +58,7 @@ class DesktopPaymentsWindowManager : public PaymentsWi
+ content::NavigationHandle* navigation_handle) override;
+ void WebContentsDestroyed() override;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // BrowserListObserver:
+ void OnBrowserSetLastActive(Browser* browser) override;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
+@@ -132,7 +132,7 @@ class DesktopPaymentsWindowManager : public PaymentsWi
+ std::unique_ptr<PaymentsWindowUserConsentDialogControllerImpl>
+ payments_window_user_consent_dialog_controller_;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ base::ScopedObservation<BrowserList, BrowserListObserver> scoped_observation_{
+ this};
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
diff --git a/devel/electron31/files/patch-chrome_browser_ui_browser.h b/devel/electron31/files/patch-chrome_browser_ui_browser.h
new file mode 100644
index 000000000000..89b97c4f7efb
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_browser.h
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/browser.h.orig 2024-06-30 11:48:29 UTC
++++ chrome/browser/ui/browser.h
+@@ -329,7 +329,7 @@ class Browser : public TabStripModelObserver,
+ std::optional<int64_t> display_id;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // When the browser window is shown, the desktop environment is notified
+ // using this ID. In response, the desktop will stop playing the "waiting
+ // for startup" animation (if any).
diff --git a/devel/electron31/files/patch-chrome_browser_ui_browser__command__controller.cc b/devel/electron31/files/patch-chrome_browser_ui_browser__command__controller.cc
new file mode 100644
index 000000000000..d8ecb4ce455b
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_browser__command__controller.cc
@@ -0,0 +1,62 @@
+--- chrome/browser/ui/browser_command_controller.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/browser_command_controller.cc
+@@ -127,7 +127,7 @@
+ #include "components/user_manager/user_manager.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/base/ime/text_input_flags.h"
+ #include "ui/linux/linux_ui.h"
+ #endif
+@@ -309,7 +309,7 @@ bool BrowserCommandController::IsReservedCommandOrKey(
+ #endif
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // If this key was registered by the user as a content editing hotkey, then
+ // it is not reserved.
+ auto* linux_ui = ui::LinuxUi::instance();
+@@ -561,7 +561,7 @@ bool BrowserCommandController::ExecuteCommandWithDispo
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ case IDC_MINIMIZE_WINDOW:
+ browser_->window()->Minimize();
+ break;
+@@ -573,7 +573,7 @@ bool BrowserCommandController::ExecuteCommandWithDispo
+ break;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ case IDC_USE_SYSTEM_TITLE_BAR: {
+ PrefService* prefs = profile()->GetPrefs();
+ prefs->SetBoolean(prefs::kUseCustomChromeFrame,
+@@ -767,7 +767,7 @@ bool BrowserCommandController::ExecuteCommandWithDispo
+ break;
+ case IDC_CREATE_SHORTCUT:
+ base::RecordAction(base::UserMetricsAction("CreateShortcut"));
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (base::FeatureList::IsEnabled(features::kShortcutsNotApps)) {
+ chrome::CreateDesktopShortcutForActiveWebContents(browser_);
+ } else {
+@@ -1270,12 +1270,12 @@ void BrowserCommandController::InitCommandState() {
+ #endif
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ command_updater_.UpdateCommandEnabled(IDC_MINIMIZE_WINDOW, true);
+ command_updater_.UpdateCommandEnabled(IDC_MAXIMIZE_WINDOW, true);
+ command_updater_.UpdateCommandEnabled(IDC_RESTORE_WINDOW, true);
+ #endif
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool use_system_title_bar = true;
+ #if BUILDFLAG(IS_OZONE)
+ use_system_title_bar = ui::OzonePlatform::GetInstance()
diff --git a/devel/electron31/files/patch-chrome_browser_ui_browser__ui__prefs.cc b/devel/electron31/files/patch-chrome_browser_ui_browser__ui__prefs.cc
new file mode 100644
index 000000000000..2b87835e34d3
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_browser__ui__prefs.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/browser_ui_prefs.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/browser_ui_prefs.cc
+@@ -175,7 +175,7 @@ void RegisterBrowserUserPrefs(user_prefs::PrefRegistry
+ registry->RegisterDictionaryPref(prefs::kHttpsUpgradeFallbacks);
+ registry->RegisterDictionaryPref(prefs::kHttpsUpgradeNavigations);
+ registry->RegisterBooleanPref(prefs::kHttpsOnlyModeAutoEnabled, false);
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ registry->RegisterStringPref(prefs::kEnterpriseLogoUrl, std::string());
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
+ }
diff --git a/devel/electron31/files/patch-chrome_browser_ui_browser__view__prefs.cc b/devel/electron31/files/patch-chrome_browser_ui_browser__view__prefs.cc
new file mode 100644
index 000000000000..a46310ac1ca2
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_browser__view__prefs.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/browser_view_prefs.cc.orig 2023-08-10 01:48:36 UTC
++++ chrome/browser/ui/browser_view_prefs.cc
+@@ -15,7 +15,7 @@
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool GetCustomFramePrefDefault() {
+ #if BUILDFLAG(IS_OZONE)
+ return ui::OzonePlatform::GetInstance()
+@@ -31,7 +31,7 @@ bool GetCustomFramePrefDefault() {
+
+ void RegisterBrowserViewProfilePrefs(
+ user_prefs::PrefRegistrySyncable* registry) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ registry->RegisterBooleanPref(prefs::kUseCustomChromeFrame,
+ GetCustomFramePrefDefault());
+ #endif
diff --git a/devel/electron31/files/patch-chrome_browser_ui_chrome__pages.cc b/devel/electron31/files/patch-chrome_browser_ui_chrome__pages.cc
new file mode 100644
index 000000000000..2fd36d181acd
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_chrome__pages.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/chrome_pages.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/chrome_pages.cc
+@@ -86,7 +86,7 @@
+ #include "components/signin/public/identity_manager/identity_manager.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/web_applications/web_app_utils.h"
+ #endif
+
+@@ -719,7 +719,7 @@ void ShowShortcutCustomizationApp(Profile* profile,
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void ShowWebAppSettingsImpl(Browser* browser,
+ Profile* profile,
+ const std::string& app_id,
diff --git a/devel/electron31/files/patch-chrome_browser_ui_chrome__pages.h b/devel/electron31/files/patch-chrome_browser_ui_chrome__pages.h
new file mode 100644
index 000000000000..55ffc1905813
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_chrome__pages.h
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/chrome_pages.h.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/chrome_pages.h
+@@ -39,7 +39,7 @@ enum class ConsentLevel;
+ enum class ConsentLevel;
+ } // namespace signin
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ namespace web_app {
+ enum class AppSettingsPageEntryPoint;
+ } // namespace web_app
+@@ -196,7 +196,7 @@ void ShowShortcutCustomizationApp(Profile* profile,
+ const std::string& category);
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Show chrome://app-settings/<app-id> page.
+ void ShowWebAppSettings(Browser* browser,
+ const std::string& app_id,
diff --git a/devel/electron31/files/patch-chrome_browser_ui_color_native__chrome__color__mixer.cc b/devel/electron31/files/patch-chrome_browser_ui_color_native__chrome__color__mixer.cc
new file mode 100644
index 000000000000..ec344b260e7c
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_color_native__chrome__color__mixer.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/color/native_chrome_color_mixer.cc.orig 2023-10-19 19:58:07 UTC
++++ chrome/browser/ui/color/native_chrome_color_mixer.cc
+@@ -7,7 +7,7 @@
+ #include "build/build_config.h"
+
+ #if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_MAC) && \
+- !BUILDFLAG(IS_WIN)
++ !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_BSD)
+ void AddNativeChromeColorMixer(ui::ColorProvider* provider,
+ const ui::ColorProviderKey& key) {}
+ #endif
diff --git a/devel/electron31/files/patch-chrome_browser_ui_omnibox_omnibox__pedal__implementations.cc b/devel/electron31/files/patch-chrome_browser_ui_omnibox_omnibox__pedal__implementations.cc
new file mode 100644
index 000000000000..2d2b5b49d9aa
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_omnibox_omnibox__pedal__implementations.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/omnibox/omnibox_pedal_implementations.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/omnibox/omnibox_pedal_implementations.cc
+@@ -1978,7 +1978,7 @@ const gfx::VectorIcon& GetSharingHubVectorIcon() {
+ return omnibox::kShareMacChromeRefreshIcon;
+ #elif BUILDFLAG(IS_WIN)
+ return omnibox::kShareWinChromeRefreshIcon;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return omnibox::kShareLinuxChromeRefreshIcon;
+ #else
+ return omnibox::kShareChromeRefreshIcon;
diff --git a/devel/electron31/files/patch-chrome_browser_ui_passwords_bubble__controllers_relaunch__chrome__bubble__controller.cc b/devel/electron31/files/patch-chrome_browser_ui_passwords_bubble__controllers_relaunch__chrome__bubble__controller.cc
new file mode 100644
index 000000000000..a2e83e29a704
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_passwords_bubble__controllers_relaunch__chrome__bubble__controller.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/passwords/bubble_controllers/relaunch_chrome_bubble_controller.cc.orig 2024-02-21 00:20:36 UTC
++++ chrome/browser/ui/passwords/bubble_controllers/relaunch_chrome_bubble_controller.cc
+@@ -44,7 +44,7 @@ std::u16string RelaunchChromeBubbleController::GetTitl
+ #if BUILDFLAG(IS_MAC)
+ ? IDS_PASSWORD_MANAGER_RELAUNCH_CHROME_BUBBLE_TITLE_BRANDED
+ : IDS_PASSWORD_MANAGER_RELAUNCH_CHROME_BUBBLE_TITLE_NON_BRANDED
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ? IDS_PASSWORD_MANAGER_RELAUNCH_CHROME_BUBBLE_TITLE_LINUX_BRANDED
+ : IDS_PASSWORD_MANAGER_RELAUNCH_CHROME_BUBBLE_TITLE_LINUX_NON_BRANDED
+ #endif
+@@ -57,7 +57,7 @@ std::u16string RelaunchChromeBubbleController::GetBody
+ #if BUILDFLAG(IS_MAC)
+ ? IDS_PASSWORD_MANAGER_RELAUNCH_CHROME_BUBBLE_DESCRIPTION_BRANDED
+ : IDS_PASSWORD_MANAGER_RELAUNCH_CHROME_BUBBLE_DESCRIPTION_NON_BRANDED
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ? IDS_PASSWORD_MANAGER_RELAUNCH_CHROME_BUBBLE_DESCRIPTION_LINUX_BRANDED
+ : IDS_PASSWORD_MANAGER_RELAUNCH_CHROME_BUBBLE_DESCRIPTION_LINUX_NON_BRANDED
+ #endif
diff --git a/devel/electron31/files/patch-chrome_browser_ui_passwords_manage__passwords__ui__controller.cc b/devel/electron31/files/patch-chrome_browser_ui_passwords_manage__passwords__ui__controller.cc
new file mode 100644
index 000000000000..43d1fc5e3d18
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_passwords_manage__passwords__ui__controller.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/passwords/manage_passwords_ui_controller.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
+@@ -92,7 +92,7 @@ namespace {
+
+ namespace {
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Should be kept in sync with constant declared in
+ // bubble_controllers/relaunch_chrome_bubble_controller.cc.
+ constexpr int kMaxNumberOfTimesKeychainErrorBubbleIsShown = 3;
+@@ -475,7 +475,7 @@ void ManagePasswordsUIController::OnKeychainError() {
+ }
+
+ void ManagePasswordsUIController::OnKeychainError() {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ CHECK(!dialog_controller_);
+ PrefService* prefs =
+ Profile::FromBrowserContext(web_contents()->GetBrowserContext())
diff --git a/devel/electron31/files/patch-chrome_browser_ui_sad__tab.cc b/devel/electron31/files/patch-chrome_browser_ui_sad__tab.cc
new file mode 100644
index 000000000000..6a631ca76209
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_sad__tab.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/sad_tab.cc.orig 2023-02-01 18:43:13 UTC
++++ chrome/browser/ui/sad_tab.cc
+@@ -176,7 +176,7 @@ std::vector<int> SadTab::GetSubMessages() {
+ // Only show Incognito suggestion if not already in Incognito mode.
+ if (!web_contents_->GetBrowserContext()->IsOffTheRecord())
+ message_ids.insert(message_ids.begin(), IDS_SAD_TAB_RELOAD_INCOGNITO);
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Note: on macOS, Linux and ChromeOS, the first bullet is either one of
+ // IDS_SAD_TAB_RELOAD_CLOSE_TABS or IDS_SAD_TAB_RELOAD_CLOSE_NOTABS
+ // followed by one of the above suggestions.
diff --git a/devel/electron31/files/patch-chrome_browser_ui_sharing__hub_sharing__hub__bubble__controller.h b/devel/electron31/files/patch-chrome_browser_ui_sharing__hub_sharing__hub__bubble__controller.h
new file mode 100644
index 000000000000..01db715af2a4
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_sharing__hub_sharing__hub__bubble__controller.h
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/sharing_hub/sharing_hub_bubble_controller.h.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/sharing_hub/sharing_hub_bubble_controller.h
+@@ -36,7 +36,7 @@ class SharingHubBubbleController {
+ // Returns true if the omnibox icon should be shown.
+ virtual bool ShouldOfferOmniboxIcon() = 0;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // This method returns the set of first-party actions, which are actions
+ // internal to Chrome. Third-party actions (those outside Chrome) are
+ // currently not supported.
diff --git a/devel/electron31/files/patch-chrome_browser_ui_signin_signin__view__controller.cc b/devel/electron31/files/patch-chrome_browser_ui_signin_signin__view__controller.cc
new file mode 100644
index 000000000000..69a887557cbf
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_signin_signin__view__controller.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/signin/signin_view_controller.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/signin/signin_view_controller.cc
+@@ -334,7 +334,7 @@ void SigninViewController::ShowModalManagedUserNoticeD
+ bool show_link_data_option,
+ signin::SigninChoiceCallback callback) {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ CloseModalSignin();
+ dialog_ = std::make_unique<SigninModalDialogImpl>(
+ SigninViewControllerDelegate::CreateManagedUserNoticeDelegate(
diff --git a/devel/electron31/files/patch-chrome_browser_ui_signin_signin__view__controller__delegate.h b/devel/electron31/files/patch-chrome_browser_ui_signin_signin__view__controller__delegate.h
new file mode 100644
index 000000000000..fa98b6b4fa25
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_signin_signin__view__controller__delegate.h
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/signin/signin_view_controller_delegate.h.orig 2024-02-21 00:20:36 UTC
++++ chrome/browser/ui/signin/signin_view_controller_delegate.h
+@@ -81,7 +81,7 @@ class SigninViewControllerDelegate {
+ #endif // BUILDFLAG(ENABLE_DICE_SUPPORT) || BUILDFLAG(IS_CHROMEOS_LACROS)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Returns a platform-specific SigninViewContolllerDelegate instance that
+ // displays the managed user notice modal dialog. The returned object
+ // should delete itself when the window it's managing is closed.
diff --git a/devel/electron31/files/patch-chrome_browser_ui_startup_bad__flags__prompt.cc b/devel/electron31/files/patch-chrome_browser_ui_startup_bad__flags__prompt.cc
new file mode 100644
index 000000000000..6a4a32dc03e3
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_startup_bad__flags__prompt.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/startup/bad_flags_prompt.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/startup/bad_flags_prompt.cc
+@@ -107,7 +107,7 @@ const char* const kBadFlags[] = {
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Speech dispatcher is buggy, it can crash and it can make Chrome freeze.
+ // http://crbug.com/327295
+ switches::kEnableSpeechDispatcher,
diff --git a/devel/electron31/files/patch-chrome_browser_ui_startup_startup__browser__creator.cc b/devel/electron31/files/patch-chrome_browser_ui_startup_startup__browser__creator.cc
new file mode 100644
index 000000000000..7712164945f7
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_startup_startup__browser__creator.cc
@@ -0,0 +1,38 @@
+--- chrome/browser/ui/startup/startup_browser_creator.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/startup/startup_browser_creator.cc
+@@ -136,7 +136,7 @@
+ #include "chrome/credential_provider/common/gcp_strings.h"
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/headless/headless_mode_util.h"
+ #include "chrome/browser/ui/startup/web_app_info_recorder_utils.h"
+ #include "components/headless/policy/headless_mode_policy.h"
+@@ -965,7 +965,7 @@ bool StartupBrowserCreator::ProcessCmdLineImpl(
+ TRACE_EVENT0("startup", "StartupBrowserCreator::ProcessCmdLineImpl");
+ ComputeAndRecordLaunchMode(command_line);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ if (headless::IsHeadlessMode() &&
+ headless::HeadlessModePolicy::IsHeadlessModeDisabled(
+ g_browser_process->local_state())) {
+@@ -1078,7 +1078,7 @@ bool StartupBrowserCreator::ProcessCmdLineImpl(
+ silent_launch = true;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Writes open and installed web apps to the specified file without
+ // launching a new browser window or tab.
+ if (base::FeatureList::IsEnabled(features::kListWebAppsSwitch) &&
+@@ -1288,7 +1288,7 @@ bool StartupBrowserCreator::ProcessCmdLineImpl(
+ CHECK_EQ(profile_info.mode, StartupProfileMode::kBrowserWindow)
+ << "Failed launch with app: couldn't pick a profile";
+ std::string app_id = command_line.GetSwitchValueASCII(switches::kAppId);
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // If Chrome Apps are deprecated and |app_id| is a Chrome App, display the
+ // deprecation UI instead of launching the app.
+ if (apps::OpenDeprecatedApplicationPrompt(privacy_safe_profile, app_id))
diff --git a/devel/electron31/files/patch-chrome_browser_ui_startup_startup__browser__creator__impl.cc b/devel/electron31/files/patch-chrome_browser_ui_startup_startup__browser__creator__impl.cc
new file mode 100644
index 000000000000..beb737bbcd2a
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_startup_startup__browser__creator__impl.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/startup/startup_browser_creator_impl.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/startup/startup_browser_creator_impl.cc
+@@ -233,7 +233,7 @@ Browser* StartupBrowserCreatorImpl::OpenTabsInBrowser(
+ // at the state of the MessageLoop.
+ Browser::CreateParams params = Browser::CreateParams(profile_, false);
+ params.creation_source = Browser::CreationSource::kStartupCreator;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ params.startup_id =
+ command_line_->GetSwitchValueASCII("desktop-startup-id");
+ #endif
diff --git a/devel/electron31/files/patch-chrome_browser_ui_startup_startup__tab__provider.cc b/devel/electron31/files/patch-chrome_browser_ui_startup_startup__tab__provider.cc
new file mode 100644
index 000000000000..a19267c6fc82
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_startup_startup__tab__provider.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/startup/startup_tab_provider.cc.orig 2024-04-15 20:33:49 UTC
++++ chrome/browser/ui/startup/startup_tab_provider.cc
+@@ -61,7 +61,7 @@
+ #include "extensions/browser/extension_registry.h"
+ #endif // !BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/headless/headless_mode_util.h"
+ #endif
+
+@@ -105,7 +105,7 @@ bool ValidateUrl(const GURL& url) {
+ #if BUILDFLAG(IS_CHROMEOS_LACROS)
+ // In ChromeOS, allow any URL pattern that matches chrome:// scheme.
+ url_scheme_is_chrome = url.SchemeIs(content::kChromeUIScheme);
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // In Headless mode, allow any URL pattern that matches chrome:// scheme if
+ // the user explicitly allowed it.
+ if (headless::IsHeadlessMode() && url.SchemeIs(content::kChromeUIScheme)) {
diff --git a/devel/electron31/files/patch-chrome_browser_ui_tab__helpers.cc b/devel/electron31/files/patch-chrome_browser_ui_tab__helpers.cc
new file mode 100644
index 000000000000..c4416f53f7ec
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_tab__helpers.cc
@@ -0,0 +1,26 @@
+--- chrome/browser/ui/tab_helpers.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/tab_helpers.cc
+@@ -241,7 +241,7 @@
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/blocked_content/framebust_block_tab_helper.h"
+ #include "chrome/browser/ui/browser_finder.h"
+ #include "chrome/browser/ui/hats/hats_helper.h"
+@@ -696,12 +696,12 @@ void TabHelpers::AttachTabHelpers(WebContents* web_con
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ metrics::DesktopSessionDurationObserver::CreateForWebContents(web_contents);
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (base::FeatureList::IsEnabled(
+ features::kHappinessTrackingSurveysForDesktopDemo) ||
+ base::FeatureList::IsEnabled(features::kTrustSafetySentimentSurvey) ||
diff --git a/devel/electron31/files/patch-chrome_browser_ui_task__manager_task__manager__columns.cc b/devel/electron31/files/patch-chrome_browser_ui_task__manager_task__manager__columns.cc
new file mode 100644
index 000000000000..410884208108
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_task__manager_task__manager__columns.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/task_manager/task_manager_columns.cc.orig 2022-04-21 18:48:31 UTC
++++ chrome/browser/ui/task_manager/task_manager_columns.cc
+@@ -93,7 +93,7 @@ const TableColumnData kColumns[] = {
+ std::size("100000") * kCharWidth, -1, true, false, false},
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ {IDS_TASK_MANAGER_OPEN_FD_COUNT_COLUMN, ui::TableColumn::RIGHT, -1, 0,
+ std::size("999") * kCharWidth, -1, true, false, false},
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
diff --git a/devel/electron31/files/patch-chrome_browser_ui_task__manager_task__manager__table__model.cc b/devel/electron31/files/patch-chrome_browser_ui_task__manager_task__manager__table__model.cc
new file mode 100644
index 000000000000..23318abea4f3
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_task__manager_task__manager__table__model.cc
@@ -0,0 +1,29 @@
+--- chrome/browser/ui/task_manager/task_manager_table_model.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/task_manager/task_manager_table_model.cc
+@@ -454,7 +454,7 @@ std::u16string TaskManagerTableModel::GetText(size_t r
+ ? stringifier_->backgrounded_string()
+ : stringifier_->foregrounded_string();
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ case IDS_TASK_MANAGER_OPEN_FD_COUNT_COLUMN: {
+ const int fd_count = observed_task_manager()->GetOpenFdCount(tasks_[row]);
+ return fd_count >= 0 ? base::FormatNumber(fd_count)
+@@ -621,7 +621,7 @@ int TaskManagerTableModel::CompareValues(size_t row1,
+ return BooleanCompare(is_proc1_bg, is_proc2_bg);
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ case IDS_TASK_MANAGER_OPEN_FD_COUNT_COLUMN: {
+ const int proc1_fd_count =
+ observed_task_manager()->GetOpenFdCount(tasks_[row1]);
+@@ -806,7 +806,7 @@ void TaskManagerTableModel::UpdateRefreshTypes(int col
+ type = REFRESH_TYPE_KEEPALIVE_COUNT;
+ break;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ case IDS_TASK_MANAGER_OPEN_FD_COUNT_COLUMN:
+ type = REFRESH_TYPE_FD_COUNT;
+ break;
diff --git a/devel/electron31/files/patch-chrome_browser_ui_test_popup__browsertest.cc b/devel/electron31/files/patch-chrome_browser_ui_test_popup__browsertest.cc
new file mode 100644
index 000000000000..90b9e41bbfd7
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_test_popup__browsertest.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/test/popup_browsertest.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/test/popup_browsertest.cc
+@@ -74,7 +74,7 @@ IN_PROC_BROWSER_TEST_F(PopupTest, OpenLeftAndTopZeroCo
+ const display::Display display = GetDisplayNearestBrowser(popup);
+ gfx::Rect expected(popup->window()->GetBounds().size());
+ expected.AdjustToFit(display.work_area());
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/40815883) Desktop Linux window bounds are inaccurate.
+ expected.Outset(50);
+ EXPECT_TRUE(expected.Contains(popup->window()->GetBounds()))
+@@ -106,7 +106,7 @@ IN_PROC_BROWSER_TEST_F(PopupTest, OpenClampedToCurrent
+ // The popup should be constrained to the opener's available display space.
+ EXPECT_EQ(display, GetDisplayNearestBrowser(popup));
+ gfx::Rect work_area(display.work_area());
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/40815883) Desktop Linux bounds flakily extend outside the
+ // work area on trybots, when opening with excessive width and height, e.g.:
+ // width=${screen.availWidth+300},height=${screen.availHeight+300} yields:
diff --git a/devel/electron31/files/patch-chrome_browser_ui_test_test__browser__ui.cc b/devel/electron31/files/patch-chrome_browser_ui_test_test__browser__ui.cc
new file mode 100644
index 000000000000..1da09fb37ed9
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_test_test__browser__ui.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/test/test_browser_ui.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/test/test_browser_ui.cc
+@@ -22,7 +22,7 @@
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
+ #include "content/public/common/content_switches.h"
+ #include "ui/base/test/skia_gold_matching_algorithm.h"
+@@ -39,7 +39,7 @@
+ // TODO(crbug.com/40625383) support Mac for pixel tests.
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ #define SUPPORTS_PIXEL_TEST
+ #endif
+
diff --git a/devel/electron31/files/patch-chrome_browser_ui_ui__features.cc b/devel/electron31/files/patch-chrome_browser_ui_ui__features.cc
new file mode 100644
index 000000000000..0e4df5abd6f4
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_ui__features.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/ui_features.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/ui_features.cc
+@@ -446,7 +446,7 @@ BASE_FEATURE(kTopChromeWebUIUsesSpareRenderer,
+ "TopChromeWebUIUsesSpareRenderer",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Enables alternate update-related text to be displayed in browser app menu
+ // button, menu item and confirmation dialog.
+ BASE_FEATURE(kUpdateTextOptions,
diff --git a/devel/electron31/files/patch-chrome_browser_ui_ui__features.h b/devel/electron31/files/patch-chrome_browser_ui_ui__features.h
new file mode 100644
index 000000000000..e198f210af2f
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_ui__features.h
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/ui_features.h.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/ui_features.h
+@@ -288,7 +288,7 @@ BASE_DECLARE_FEATURE(kTopChromeWebUIUsesSpareRenderer)
+
+ BASE_DECLARE_FEATURE(kTopChromeWebUIUsesSpareRenderer);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ BASE_DECLARE_FEATURE(kUpdateTextOptions);
+ extern const base::FeatureParam<int> kUpdateTextOptionNumber;
+ #endif
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_accelerator__table.cc b/devel/electron31/files/patch-chrome_browser_ui_views_accelerator__table.cc
new file mode 100644
index 000000000000..30a4fc5c5734
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_accelerator__table.cc
@@ -0,0 +1,43 @@
+--- chrome/browser/ui/views/accelerator_table.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/views/accelerator_table.cc
+@@ -72,11 +72,11 @@ const AcceleratorMapping kAcceleratorMap[] = {
+ {ui::VKEY_S, ui::EF_PLATFORM_ACCELERATOR, IDC_SAVE_PAGE},
+ {ui::VKEY_9, ui::EF_PLATFORM_ACCELERATOR, IDC_SELECT_LAST_TAB},
+ {ui::VKEY_NUMPAD9, ui::EF_PLATFORM_ACCELERATOR, IDC_SELECT_LAST_TAB},
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {ui::VKEY_9, ui::EF_ALT_DOWN, IDC_SELECT_LAST_TAB},
+ {ui::VKEY_NUMPAD9, ui::EF_ALT_DOWN, IDC_SELECT_LAST_TAB},
+ #endif // BUILDFLAG(IS_LINUX)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ {ui::VKEY_NEXT, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN, IDC_MOVE_TAB_NEXT},
+ {ui::VKEY_PRIOR, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN,
+ IDC_MOVE_TAB_PREVIOUS},
+@@ -104,7 +104,7 @@ const AcceleratorMapping kAcceleratorMap[] = {
+ {ui::VKEY_NUMPAD7, ui::EF_PLATFORM_ACCELERATOR, IDC_SELECT_TAB_6},
+ {ui::VKEY_8, ui::EF_PLATFORM_ACCELERATOR, IDC_SELECT_TAB_7},
+ {ui::VKEY_NUMPAD8, ui::EF_PLATFORM_ACCELERATOR, IDC_SELECT_TAB_7},
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {ui::VKEY_1, ui::EF_ALT_DOWN, IDC_SELECT_TAB_0},
+ {ui::VKEY_NUMPAD1, ui::EF_ALT_DOWN, IDC_SELECT_TAB_0},
+ {ui::VKEY_2, ui::EF_ALT_DOWN, IDC_SELECT_TAB_1},
+@@ -154,7 +154,7 @@ const AcceleratorMapping kAcceleratorMap[] = {
+ IDC_SHOW_AVATAR_MENU},
+
+ // Platform-specific key maps.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ {ui::VKEY_BROWSER_BACK, ui::EF_NONE, IDC_BACK},
+ {ui::VKEY_BROWSER_FORWARD, ui::EF_NONE, IDC_FORWARD},
+ {ui::VKEY_BROWSER_HOME, ui::EF_NONE, IDC_HOME},
+@@ -249,7 +249,7 @@ const AcceleratorMapping kAcceleratorMap[] = {
+ #endif // !BUILDFLAG(IS_CHROMEOS)
+ #endif // !BUILDFLAG(IS_MAC)
+ #if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
+ {ui::VKEY_S, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN,
+ IDC_CONTENT_CONTEXT_RUN_LAYOUT_EXTRACTION},
+ #endif
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_apps_chrome__native__app__window__views__aura.cc b/devel/electron31/files/patch-chrome_browser_ui_views_apps_chrome__native__app__window__views__aura.cc
new file mode 100644
index 000000000000..4e0a6bba92a4
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_apps_chrome__native__app__window__views__aura.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.cc.orig 2022-07-22 17:30:31 UTC
++++ chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.cc
+@@ -19,7 +19,7 @@
+ #include "ui/gfx/image/image_skia.h"
+ #include "ui/views/widget/widget.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/shell_integration_linux.h"
+ #endif
+
+@@ -55,7 +55,7 @@ void ChromeNativeAppWindowViewsAura::OnBeforeWidgetIni
+ const AppWindow::CreateParams& create_params,
+ views::Widget::InitParams* init_params,
+ views::Widget* widget) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::string app_name =
+ web_app::GenerateApplicationNameFromAppId(app_window()->extension_id());
+ // Set up a custom WM_CLASS for app windows. This allows task switchers in
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_chrome__browser__main__extra__parts__views.cc b/devel/electron31/files/patch-chrome_browser_ui_views_chrome__browser__main__extra__parts__views.cc
new file mode 100644
index 000000000000..29b0549bbe42
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_chrome__browser__main__extra__parts__views.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc.orig 2024-04-15 20:33:49 UTC
++++ chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc
+@@ -38,7 +38,7 @@
+ #include "ui/wm/core/wm_state.h"
+ #endif // defined(USE_AURA)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include <sys/stat.h>
+ #include <sys/types.h>
+ #include <unistd.h>
+@@ -131,7 +131,7 @@ void ChromeBrowserMainExtraPartsViews::PreProfileInit(
+ return controller;
+ }));
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On the Linux desktop, we want to prevent the user from logging in as root,
+ // so that we don't destroy the profile. Now that we have some minimal ui
+ // initialized, check to see if we're running as root and bail if we are.
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_chrome__views__delegate.h b/devel/electron31/files/patch-chrome_browser_ui_views_chrome__views__delegate.h
new file mode 100644
index 000000000000..615e66391f22
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_chrome__views__delegate.h
@@ -0,0 +1,16 @@
+--- chrome/browser/ui/views/chrome_views_delegate.h.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/views/chrome_views_delegate.h
+@@ -59,11 +59,11 @@ class ChromeViewsDelegate : public views::ViewsDelegat
+ base::OnceClosure callback) override;
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ bool WindowManagerProvidesTitleBar(bool maximized) override;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ gfx::ImageSkia* GetDefaultWindowIcon() const override;
+ #endif
+
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_chrome__views__delegate__linux.cc b/devel/electron31/files/patch-chrome_browser_ui_views_chrome__views__delegate__linux.cc
new file mode 100644
index 000000000000..73124c3bda09
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_chrome__views__delegate__linux.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/views/chrome_views_delegate_linux.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/views/chrome_views_delegate_linux.cc
+@@ -26,7 +26,7 @@ bool IsDesktopEnvironmentUnity() {
+ return desktop_env == base::nix::DESKTOP_ENVIRONMENT_UNITY;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ int GetWindowIconResourceId() {
+ #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ switch (chrome::GetChannel()) {
+@@ -80,7 +80,7 @@ views::NativeWidget* ChromeViewsDelegate::CreateNative
+ delegate);
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ gfx::ImageSkia* ChromeViewsDelegate::GetDefaultWindowIcon() const {
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
+ return rb.GetImageSkiaNamed(GetWindowIconResourceId());
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_compose_compose__dialog__view.cc b/devel/electron31/files/patch-chrome_browser_ui_views_compose_compose__dialog__view.cc
new file mode 100644
index 000000000000..5db50ac10b20
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_compose_compose__dialog__view.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/views/compose/compose_dialog_view.cc.orig 2024-04-15 20:33:49 UTC
++++ chrome/browser/ui/views/compose/compose_dialog_view.cc
+@@ -159,7 +159,7 @@ void ComposeDialogView::OnBeforeBubbleWidgetInit(
+ views::Widget::InitParams* params,
+ views::Widget* widget) const {
+ WebUIBubbleDialogView::OnBeforeBubbleWidgetInit(params, widget);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // In linux, windows may be clipped to their anchors' bounds,
+ // resulting in visual errors, unless they use accelerated rendering. See
+ // crbug.com/1445770 for details.
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame.cc b/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame.cc
new file mode 100644
index 000000000000..55cd00d5d3ef
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame.cc
@@ -0,0 +1,56 @@
+--- chrome/browser/ui/views/frame/browser_frame.cc.orig 2024-02-21 00:20:37 UTC
++++ chrome/browser/ui/views/frame/browser_frame.cc
+@@ -54,7 +54,7 @@
+ #include "components/user_manager/user_manager.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/display/screen.h"
+ #include "ui/linux/linux_ui.h"
+ #endif
+@@ -89,7 +89,7 @@ bool IsUsingLinuxSystemTheme(Profile* profile) {
+ };
+
+ bool IsUsingLinuxSystemTheme(Profile* profile) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return ThemeServiceFactory::GetForProfile(profile)->UsingSystemTheme();
+ #else
+ return false;
+@@ -184,7 +184,7 @@ void BrowserFrame::InitBrowserFrame() {
+
+ Init(std::move(params));
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ SelectNativeTheme();
+ #else
+ SetNativeTheme(ui::NativeTheme::GetInstanceForNativeUi());
+@@ -370,7 +370,7 @@ void BrowserFrame::OnNativeWidgetWorkspaceChanged() {
+ chrome::SaveWindowWorkspace(browser_view_->browser(), GetWorkspace());
+ chrome::SaveWindowVisibleOnAllWorkspaces(browser_view_->browser(),
+ IsVisibleOnAllWorkspaces());
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // If the window was sent to a different workspace, prioritize it if
+ // it was sent to the current workspace and deprioritize it
+ // otherwise. This is done by MoveBrowsersInWorkspaceToFront()
+@@ -563,7 +563,7 @@ void BrowserFrame::SelectNativeTheme() {
+ }
+
+ void BrowserFrame::SelectNativeTheme() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Use the regular NativeTheme instance if running incognito mode, regardless
+ // of system theme (gtk, qt etc).
+ ui::NativeTheme* native_theme = ui::NativeTheme::GetInstanceForNativeUi();
+@@ -604,7 +604,7 @@ bool BrowserFrame::RegenerateFrameOnThemeChange(
+ bool BrowserFrame::RegenerateFrameOnThemeChange(
+ BrowserThemeChangeType theme_change_type) {
+ bool need_regenerate = false;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // System and user theme changes can both change frame buttons, so the frame
+ // always needs to be regenerated on Linux.
+ need_regenerate = true;
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame.h b/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame.h
new file mode 100644
index 000000000000..08d15c6076d2
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame.h
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/views/frame/browser_frame.h.orig 2024-02-21 00:20:37 UTC
++++ chrome/browser/ui/views/frame/browser_frame.h
+@@ -65,7 +65,7 @@ class BrowserFrame : public views::Widget, public view
+
+ ~BrowserFrame() override;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Returns whether the frame is in a tiled state.
+ bool tiled() const { return tiled_; }
+ void set_tiled(bool tiled) { tiled_ = tiled; }
+@@ -225,7 +225,7 @@ class BrowserFrame : public views::Widget, public view
+ // contents for smoother dragging.
+ TabDragKind tab_drag_kind_ = TabDragKind::kNone;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool tiled_ = false;
+ #endif
+
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux.cc b/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux.cc
new file mode 100644
index 000000000000..63bb112088ae
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/views/frame/browser_frame_view_layout_linux.cc.orig 2024-02-21 00:20:37 UTC
++++ chrome/browser/ui/views/frame/browser_frame_view_layout_linux.cc
+@@ -53,7 +53,7 @@ gfx::Insets BrowserFrameViewLayoutLinux::RestoredFrame
+ OpaqueBrowserFrameViewLayout::RestoredFrameBorderInsets());
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const bool tiled = delegate_->IsTiled();
+ #else
+ const bool tiled = false;
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux__native.cc b/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux__native.cc
new file mode 100644
index 000000000000..09d4a3ed5725
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux__native.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/views/frame/browser_frame_view_layout_linux_native.cc.orig 2024-02-21 00:20:37 UTC
++++ chrome/browser/ui/views/frame/browser_frame_view_layout_linux_native.cc
+@@ -18,7 +18,7 @@ ui::WindowFrameProvider* BrowserFrameViewLayoutLinuxNa
+
+ ui::WindowFrameProvider* BrowserFrameViewLayoutLinuxNative::GetFrameProvider()
+ const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const bool tiled = delegate_->IsTiled();
+ #else
+ const bool tiled = false;
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame__view__linux.cc b/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame__view__linux.cc
new file mode 100644
index 000000000000..1c92add02856
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__frame__view__linux.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/views/frame/browser_frame_view_linux.cc.orig 2024-04-15 20:33:49 UTC
++++ chrome/browser/ui/views/frame/browser_frame_view_linux.cc
+@@ -60,7 +60,7 @@ void BrowserFrameViewLinux::PaintRestoredFrameBorder(
+
+ void BrowserFrameViewLinux::PaintRestoredFrameBorder(
+ gfx::Canvas* canvas) const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const bool tiled = frame()->tiled();
+ #else
+ const bool tiled = false;
+@@ -104,7 +104,7 @@ float BrowserFrameViewLinux::GetRestoredCornerRadiusDi
+ }
+
+ float BrowserFrameViewLinux::GetRestoredCornerRadiusDip() const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const bool tiled = frame()->tiled();
+ #else
+ const bool tiled = false;
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__non__client__frame__view__factory__views.cc b/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__non__client__frame__view__factory__views.cc
new file mode 100644
index 000000000000..c6c114a44b9b
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__non__client__frame__view__factory__views.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_views.cc.orig 2024-04-15 20:33:49 UTC
++++ chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_views.cc
+@@ -16,7 +16,7 @@
+ #include "chrome/browser/ui/views/frame/browser_frame_view_win.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/views/frame/browser_frame_view_layout_linux.h"
+ #include "chrome/browser/ui/views/frame/browser_frame_view_layout_linux_native.h"
+ #include "chrome/browser/ui/views/frame/browser_frame_view_linux_native.h"
+@@ -33,7 +33,7 @@ std::unique_ptr<OpaqueBrowserFrameView> CreateOpaqueBr
+ std::unique_ptr<OpaqueBrowserFrameView> CreateOpaqueBrowserFrameView(
+ BrowserFrame* frame,
+ BrowserView* browser_view) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto* profile = browser_view->browser()->profile();
+ auto* linux_ui_theme = ui::LinuxUiTheme::GetForProfile(profile);
+ auto* theme_service_factory = ThemeServiceFactory::GetForProfile(profile);
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__view.cc b/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__view.cc
new file mode 100644
index 000000000000..660dc56b49f4
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_frame_browser__view.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/views/frame/browser_view.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/views/frame/browser_view.cc
+@@ -2220,7 +2220,7 @@ void BrowserView::TabDraggingStatusChanged(bool is_dra
+ // CrOS cleanup is done.
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++#if !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ contents_web_view_->SetFastResize(is_dragging);
+ if (!is_dragging) {
+ // When tab dragging is ended, we need to make sure the web contents get
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.cc b/devel/electron31/files/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.cc
new file mode 100644
index 000000000000..49f06999436a
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.cc
@@ -0,0 +1,38 @@
+--- chrome/browser/ui/views/frame/opaque_browser_frame_view.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
+@@ -54,7 +54,7 @@
+ #include "ui/views/window/vector_icons/vector_icons.h"
+ #include "ui/views/window/window_shape.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "ui/views/controls/menu/menu_runner.h"
+ #endif
+
+@@ -566,7 +566,7 @@ OpaqueBrowserFrameView::GetFrameButtonStyle() const {
+ OpaqueBrowserFrameView::GetFrameButtonStyle() const {
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ return FrameButtonStyle::kMdButton;
+ #else
+ return FrameButtonStyle::kImageButton;
+@@ -585,7 +585,7 @@ bool OpaqueBrowserFrameView::ShouldDrawRestoredFrameSh
+ return false;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool OpaqueBrowserFrameView::IsTiled() const {
+ return frame()->tiled();
+ }
+@@ -783,7 +783,7 @@ void OpaqueBrowserFrameView::WindowIconPressed() {
+ }
+
+ void OpaqueBrowserFrameView::WindowIconPressed() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Chrome OS doesn't show the window icon, and Windows handles this on its own
+ // due to the hit test being HTSYSMENU.
+ menu_runner_ = std::make_unique<views::MenuRunner>(
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.h b/devel/electron31/files/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.h
new file mode 100644
index 000000000000..6b29dddd08b1
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.h
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/views/frame/opaque_browser_frame_view.h.orig 2024-02-21 00:20:37 UTC
++++ chrome/browser/ui/views/frame/opaque_browser_frame_view.h
+@@ -115,7 +115,7 @@ class OpaqueBrowserFrameView : public BrowserNonClient
+ void UpdateWindowControlsOverlay(
+ const gfx::Rect& bounding_rect) const override;
+ bool ShouldDrawRestoredFrameShadow() const override;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool IsTiled() const override;
+ #endif
+ int WebAppButtonHeight() const override;
+@@ -232,7 +232,7 @@ class OpaqueBrowserFrameView : public BrowserNonClient
+ // Background painter for the window frame.
+ std::unique_ptr<views::FrameBackground> frame_background_;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<views::MenuRunner> menu_runner_;
+ #endif
+
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view__layout__delegate.h b/devel/electron31/files/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view__layout__delegate.h
new file mode 100644
index 000000000000..25df2dc19048
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view__layout__delegate.h
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_delegate.h.orig 2024-02-21 00:20:37 UTC
++++ chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_delegate.h
+@@ -10,7 +10,7 @@
+ #include "build/build_config.h"
+ #include "build/chromeos_buildflags.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #include "ui/base/ui_base_types.h"
+ #endif
+
+@@ -94,7 +94,7 @@ class OpaqueBrowserFrameViewLayoutDelegate {
+ // Returns true if a client-side shadow should be drawn for restored windows.
+ virtual bool ShouldDrawRestoredFrameShadow() const = 0;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Returns whether the window is in a tiled state.
+ virtual bool IsTiled() const = 0;
+ #endif
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.cc b/devel/electron31/files/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.cc
new file mode 100644
index 000000000000..9cc11bd225d3
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.cc
@@ -0,0 +1,92 @@
+--- chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.cc
+@@ -58,7 +58,7 @@
+ #include "ui/aura/window.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/themes/theme_service.h"
+ #include "chrome/browser/themes/theme_service_factory.h"
+ #include "chrome/browser/ui/views/frame/browser_frame_view_paint_utils_linux.h"
+@@ -88,7 +88,7 @@ constexpr int kTopControlsHeight = 34;
+ // The height of the controls bar at the top of the window.
+ constexpr int kTopControlsHeight = 34;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Frame border when window shadow is not drawn.
+ constexpr int kFrameBorderThickness = 4;
+ #endif
+@@ -180,7 +180,7 @@ class WindowEventObserver : public ui::EventObserver {
+
+ gfx::Rect input_bounds = pip_browser_frame_view_->GetLocalBounds();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Calculate input bounds for Linux. This is needed because the input bounds
+ // is not necessary the same as the local bounds on Linux.
+ if (pip_browser_frame_view_->ShouldDrawFrameShadow()) {
+@@ -579,7 +579,7 @@ PictureInPictureBrowserFrameView::PictureInPictureBrow
+ AddChildView(std::move(auto_pip_setting_overlay));
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto* profile = browser_view->browser()->profile();
+ auto* linux_ui_theme = ui::LinuxUiTheme::GetForProfile(profile);
+ auto* theme_service_factory = ThemeServiceFactory::GetForProfile(profile);
+@@ -798,7 +798,7 @@ void PictureInPictureBrowserFrameView::OnThemeChanged(
+ for (ContentSettingImageView* view : content_setting_views_)
+ view->SetIconColor(color_provider->GetColor(kColorPipWindowForeground));
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ // On Linux the top bar background will be drawn in OnPaint().
+ top_bar_container_view_->SetBackground(views::CreateSolidBackground(
+ color_provider->GetColor(kColorPipWindowTopBarBackground)));
+@@ -880,7 +880,7 @@ void PictureInPictureBrowserFrameView::RemovedFromWidg
+ BrowserNonClientFrameView::RemovedFromWidget();
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ gfx::Insets PictureInPictureBrowserFrameView::MirroredFrameBorderInsets()
+ const {
+ auto border = FrameBorderInsets();
+@@ -1136,7 +1136,7 @@ void PictureInPictureBrowserFrameView::OnPaint(gfx::Ca
+ // views::View implementations:
+
+ void PictureInPictureBrowserFrameView::OnPaint(gfx::Canvas* canvas) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Draw the PiP window frame borders and shadows, including the top bar
+ // background.
+ if (window_frame_provider_) {
+@@ -1270,7 +1270,7 @@ gfx::Insets PictureInPictureBrowserFrameView::FrameBor
+ }
+
+ gfx::Insets PictureInPictureBrowserFrameView::FrameBorderInsets() const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (window_frame_provider_) {
+ const auto insets = window_frame_provider_->GetFrameThicknessDip();
+ const bool tiled = frame()->tiled();
+@@ -1288,7 +1288,7 @@ gfx::Insets PictureInPictureBrowserFrameView::ResizeBo
+ }
+
+ gfx::Insets PictureInPictureBrowserFrameView::ResizeBorderInsets() const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return FrameBorderInsets();
+ #elif !BUILDFLAG(IS_CHROMEOS_ASH)
+ return gfx::Insets(kResizeBorder);
+@@ -1309,7 +1309,7 @@ gfx::Size PictureInPictureBrowserFrameView::GetNonClie
+ top_height + border_thickness.bottom());
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool PictureInPictureBrowserFrameView::ShouldDrawFrameShadow() const {
+ return static_cast<DesktopBrowserFrameAuraLinux*>(
+ frame()->native_browser_frame())
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.h b/devel/electron31/files/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.h
new file mode 100644
index 000000000000..aa41d67f225d
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.h
@@ -0,0 +1,47 @@
+--- chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.h.orig 2024-04-15 20:33:49 UTC
++++ chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.h
+@@ -27,7 +27,7 @@
+ #include "ui/views/layout/flex_layout_view.h"
+ #include "ui/views/widget/widget_observer.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/window_frame_provider.h"
+ #endif
+
+@@ -35,7 +35,7 @@
+ // parent window, so to prevent cutting off important dialogs we resize the
+ // picture-in-picture window to fit them. While ChromeOS Ash also uses Aura, it
+ // does not have this issue so we do not resize on ChromeOS Ash.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #define RESIZE_DOCUMENT_PICTURE_IN_PICTURE_TO_DIALOG 1
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) ||
+ // BUILDFLAG(IS_CHROMEOS_LACROS)
+@@ -101,7 +101,7 @@ class PictureInPictureBrowserFrameView
+ void Layout(PassKey) override;
+ void AddedToWidget() override;
+ void RemovedFromWidget() override;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ gfx::Insets MirroredFrameBorderInsets() const override;
+ gfx::Insets GetInputInsets() const override;
+ SkRRect GetRestoredClipRegion() const override;
+@@ -192,7 +192,7 @@ class PictureInPictureBrowserFrameView
+ // Returns true if there's an overlay view that's currently shown.
+ bool IsOverlayViewVisible() const;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Returns whether a client-side shadow should be drawn for the window.
+ bool ShouldDrawFrameShadow() const;
+
+@@ -368,7 +368,7 @@ class PictureInPictureBrowserFrameView
+ // `top_bar_color_animation_`.
+ std::optional<SkColor> current_foreground_color_;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Used to draw window frame borders and shadow on Linux when GTK theme is
+ // enabled.
+ raw_ptr<ui::WindowFrameProvider> window_frame_provider_ = nullptr;
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_frame_system__menu__model__builder.cc b/devel/electron31/files/patch-chrome_browser_ui_views_frame_system__menu__model__builder.cc
new file mode 100644
index 000000000000..503241be1cef
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_frame_system__menu__model__builder.cc
@@ -0,0 +1,29 @@
+--- chrome/browser/ui/views/frame/system_menu_model_builder.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/views/frame/system_menu_model_builder.cc
+@@ -75,7 +75,7 @@ void SystemMenuModelBuilder::BuildSystemMenuForBrowser
+ ui::SimpleMenuModel* model) {
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && !BUILDFLAG(IS_CHROMEOS_LACROS)
+ model->AddItemWithStringId(IDC_MINIMIZE_WINDOW, IDS_MINIMIZE_WINDOW_MENU);
+ model->AddItemWithStringId(IDC_MAXIMIZE_WINDOW, IDS_MAXIMIZE_WINDOW_MENU);
+ model->AddItemWithStringId(IDC_RESTORE_WINDOW, IDS_RESTORE_WINDOW_MENU);
+@@ -91,7 +91,7 @@ void SystemMenuModelBuilder::BuildSystemMenuForBrowser
+ }
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && !BUILDFLAG(IS_CHROMEOS_LACROS)
+ model->AddSeparator(ui::NORMAL_SEPARATOR);
+ bool supports_server_side_decorations = true;
+ #if BUILDFLAG(IS_OZONE) && !BUILDFLAG(IS_CHROMEOS)
+@@ -147,7 +147,7 @@ void SystemMenuModelBuilder::BuildSystemMenuForAppOrPo
+ model->AddSeparator(ui::NORMAL_SEPARATOR);
+ model->AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER);
+ }
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ model->AddSeparator(ui::NORMAL_SEPARATOR);
+ model->AddItemWithStringId(IDC_CLOSE_WINDOW, IDS_CLOSE);
+ #endif
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_frame_system__menu__model__delegate.cc b/devel/electron31/files/patch-chrome_browser_ui_views_frame_system__menu__model__delegate.cc
new file mode 100644
index 000000000000..04c850ee4260
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_frame_system__menu__model__delegate.cc
@@ -0,0 +1,29 @@
+--- chrome/browser/ui/views/frame/system_menu_model_delegate.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/views/frame/system_menu_model_delegate.cc
+@@ -21,7 +21,7 @@
+ #include "chromeos/ui/frame/desks/move_to_desks_menu_model.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/common/pref_names.h"
+ #include "components/prefs/pref_service.h"
+ #endif
+@@ -36,7 +36,7 @@ bool SystemMenuModelDelegate::IsCommandIdChecked(int c
+ SystemMenuModelDelegate::~SystemMenuModelDelegate() {}
+
+ bool SystemMenuModelDelegate::IsCommandIdChecked(int command_id) const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (command_id == IDC_USE_SYSTEM_TITLE_BAR) {
+ PrefService* prefs = browser_->profile()->GetPrefs();
+ return !prefs->GetBoolean(prefs::kUseCustomChromeFrame);
+@@ -58,7 +58,7 @@ bool SystemMenuModelDelegate::IsCommandIdVisible(int c
+ bool SystemMenuModelDelegate::IsCommandIdVisible(int command_id) const {
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ bool is_maximized = browser_->window()->IsMaximized();
+ switch (command_id) {
+ case IDC_MAXIMIZE_WINDOW:
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_frame_tab__strip__region__view.cc b/devel/electron31/files/patch-chrome_browser_ui_views_frame_tab__strip__region__view.cc
new file mode 100644
index 000000000000..d876532a7321
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_frame_tab__strip__region__view.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/views/frame/tab_strip_region_view.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/views/frame/tab_strip_region_view.cc
+@@ -193,7 +193,7 @@ TabStripRegionView::TabStripRegionView(std::unique_ptr
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag
+ // switch of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // The New Tab Button can be middle-clicked on Linux.
+ new_tab_button_->SetTriggerableEventFlags(
+ new_tab_button_->GetTriggerableEventFlags() |
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_hung__renderer__view.cc b/devel/electron31/files/patch-chrome_browser_ui_views_hung__renderer__view.cc
new file mode 100644
index 000000000000..9f3cd4183f53
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_hung__renderer__view.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/views/hung_renderer_view.cc.orig 2024-02-21 00:20:37 UTC
++++ chrome/browser/ui/views/hung_renderer_view.cc
+@@ -406,7 +406,7 @@ void HungRendererDialogView::ForceCrashHungRenderer()
+ content::RenderProcessHost* rph =
+ hung_pages_table_model_->GetRenderWidgetHost()->GetProcess();
+ if (rph) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // A generic |CrashDumpHungChildProcess()| is not implemented for Linux.
+ // Instead we send an explicit IPC to crash on the renderer's IO thread.
+ rph->ForceCrash();
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_omnibox_omnibox__view__views.cc b/devel/electron31/files/patch-chrome_browser_ui_views_omnibox_omnibox__view__views.cc
new file mode 100644
index 000000000000..aa285e4b9506
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_omnibox_omnibox__view__views.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/views/omnibox/omnibox_view_views.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+@@ -1951,7 +1951,7 @@ void OmniboxViewViews::OnPopupOpened() {
+ }
+
+ void OmniboxViewViews::OnPopupOpened() {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // It's not great for promos to overlap the omnibox if the user opens the
+ // drop-down after showing the promo. This especially causes issues on Mac and
+ // Linux due to z-order/rendering issues, see crbug.com/1225046 and
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_passwords_password__bubble__view__base.cc b/devel/electron31/files/patch-chrome_browser_ui_views_passwords_password__bubble__view__base.cc
new file mode 100644
index 000000000000..236f75dc50df
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_passwords_password__bubble__view__base.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/views/passwords/password_bubble_view_base.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/views/passwords/password_bubble_view_base.cc
+@@ -34,7 +34,7 @@
+ #include "ui/base/metadata/metadata_impl_macros.h"
+ #include "ui/views/controls/button/button.h"
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/views/passwords/password_relaunch_chrome_view.h"
+ #endif
+
+@@ -132,7 +132,7 @@ PasswordBubbleViewBase* PasswordBubbleViewBase::Create
+ } else if (model_state ==
+ password_manager::ui::NOTIFY_RECEIVED_SHARED_CREDENTIALS) {
+ view = new SharedPasswordsNotificationView(web_contents, anchor_view);
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ } else if (model_state == password_manager::ui::KEYCHAIN_ERROR_STATE) {
+ view = new RelaunchChromeView(
+ web_contents, anchor_view,
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_profiles_profile__menu__view.cc b/devel/electron31/files/patch-chrome_browser_ui_views_profiles_profile__menu__view.cc
new file mode 100644
index 000000000000..9af8c0b26382
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_profiles_profile__menu__view.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/views/profiles/profile_menu_view.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/views/profiles/profile_menu_view.cc
+@@ -83,7 +83,7 @@
+ #include "ui/strings/grit/ui_strings.h"
+ #include "ui/views/accessibility/view_accessibility.h"
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/signin/enterprise_signin_prefs.h"
+ #endif
+
+@@ -589,7 +589,7 @@ void ProfileMenuView::BuildIdentity() {
+ badge_image_model, menu_title_, menu_subtitle_, management_label);
+ } else {
+ std::string profile_user_display_name, profile_user_email;
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ profile_user_display_name = profile->GetPrefs()->GetString(
+ enterprise_signin::prefs::kProfileUserDisplayName);
+ profile_user_email = profile->GetPrefs()->GetString(
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_profiles_profile__menu__view__base.cc b/devel/electron31/files/patch-chrome_browser_ui_views_profiles_profile__menu__view__base.cc
new file mode 100644
index 000000000000..9b0bd2697a5f
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_profiles_profile__menu__view__base.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/views/profiles/profile_menu_view_base.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/views/profiles/profile_menu_view_base.cc
+@@ -723,7 +723,7 @@ void ProfileMenuViewBase::SetProfileIdentityInfo(
+
+ // TODO(crbug.com/40118868): Revisit once build flag switch of lacros-chrome is
+ // complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // crbug.com/1161166: Orca does not read the accessible window title of the
+ // bubble, so we duplicate it in the top-level menu item. To be revisited
+ // after considering other options, including fixes on the AT side.
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.cc b/devel/electron31/files/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.cc
new file mode 100644
index 000000000000..da88da9ae5ab
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.cc
@@ -0,0 +1,47 @@
+--- chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc
+@@ -58,7 +58,7 @@ const int kModalDialogWidth = 448;
+
+ const int kModalDialogWidth = 448;
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ const int kManagedUserNoticeConfirmationDialogWidth = 512;
+ const int kManagedUserNoticeConfirmationDialogHeight = 576;
+ const int kManagedUserNoticeConfirmationUpdatedDialogWidth = 900;
+@@ -187,7 +187,7 @@ SigninViewControllerDelegateViews::CreateProfileCustom
+ #endif // BUILDFLAG(ENABLE_DICE_SUPPORT) || BUILDFLAG(IS_CHROMEOS_LACROS)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // static
+ std::unique_ptr<views::WebView>
+ SigninViewControllerDelegateViews::CreateManagedUserNoticeConfirmationWebView(
+@@ -348,7 +348,7 @@ SigninViewControllerDelegateViews::SigninViewControlle
+ SetButtons(ui::DIALOG_BUTTON_NONE);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // On the local profile creation dialog, cancelling the dialog (for instance
+ // through the VKEY_ESCAPE accelerator) should delete the profile.
+ if (delete_profile_on_cancel) {
+@@ -438,7 +438,7 @@ void SigninViewControllerDelegateViews::DisplayModal()
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ void SigninViewControllerDelegateViews::DeleteProfileOnCancel() {
+ ProfileAttributesEntry* entry =
+ g_browser_process->profile_manager()
+@@ -511,7 +511,7 @@ SigninViewControllerDelegate::CreateProfileCustomizati
+ #endif // BUILDFLAG(ENABLE_DICE_SUPPORT) || BUILDFLAG(IS_CHROMEOS_LACROS)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // static
+ SigninViewControllerDelegate*
+ SigninViewControllerDelegate::CreateManagedUserNoticeDelegate(
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.h b/devel/electron31/files/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.h
new file mode 100644
index 000000000000..2ccca15b3a30
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.h
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h.orig 2024-06-18 21:43:24 UTC
++++ chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h
+@@ -73,7 +73,7 @@ class SigninViewControllerDelegateViews
+ #endif // BUILDFLAG(ENABLE_DICE_SUPPORT) || BUILDFLAG(IS_CHROMEOS_LACROS)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ static std::unique_ptr<views::WebView>
+ CreateManagedUserNoticeConfirmationWebView(
+ Browser* browser,
+@@ -139,7 +139,7 @@ class SigninViewControllerDelegateViews
+ InitializeSigninWebDialogUI initialize_signin_web_dialog_ui);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Deletes the ephemeral profile when cancelling the local profile creation
+ // dialog.
+ void DeleteProfileOnCancel();
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_tab__search__bubble__host.cc b/devel/electron31/files/patch-chrome_browser_ui_views_tab__search__bubble__host.cc
new file mode 100644
index 000000000000..8a9650175a66
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_tab__search__bubble__host.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/views/tab_search_bubble_host.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/views/tab_search_bubble_host.cc
+@@ -268,7 +268,7 @@ bool TabSearchBubbleHost::ShouldTabSearchRenderBeforeT
+ // Mac should have tabsearch on the right side. Windows >= Win10 has the
+ // Tab Search button as a FrameCaptionButton, but it still needs to be on the
+ // left if it exists.
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ return features::IsChromeRefresh2023();
+ #else
+ return false;
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_tabs_tab.cc b/devel/electron31/files/patch-chrome_browser_ui_views_tabs_tab.cc
new file mode 100644
index 000000000000..0ec5bbc1fa40
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_tabs_tab.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/views/tabs/tab.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/views/tabs/tab.cc
+@@ -629,7 +629,7 @@ void Tab::MaybeUpdateHoverStatus(const ui::MouseEvent&
+ return;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Move the hit test area for hovering up so that it is not overlapped by tab
+ // hover cards when they are shown.
+ // TODO(crbug.com/41467565): Once Linux/CrOS widget transparency is solved,
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_tabs_tab__drag__controller.cc b/devel/electron31/files/patch-chrome_browser_ui_views_tabs_tab__drag__controller.cc
new file mode 100644
index 000000000000..da91529b0fd3
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_tabs_tab__drag__controller.cc
@@ -0,0 +1,56 @@
+--- chrome/browser/ui/views/tabs/tab_drag_controller.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/views/tabs/tab_drag_controller.cc
+@@ -95,7 +95,7 @@
+ #include "components/remote_cocoa/browser/window.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/aura/client/drag_drop_client.h"
+ #endif
+
+@@ -215,7 +215,7 @@ void UpdateSystemDnDDragImage(TabDragContext* attached
+
+ void UpdateSystemDnDDragImage(TabDragContext* attached_context,
+ const gfx::ImageSkia& image) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ aura::Window* root_window =
+ attached_context->GetWidget()->GetNativeWindow()->GetRootWindow();
+ if (aura::client::GetDragDropClient(root_window)) {
+@@ -405,7 +405,7 @@ TabDragController::Liveness TabDragController::Init(
+ // synchronous on desktop Linux, so use that.
+ // - ChromeOS Ash
+ // Releasing capture on Ash cancels gestures so avoid it.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ ref->can_release_capture_ = false;
+ #endif
+ ref->start_point_in_screen_ =
+@@ -1069,7 +1069,7 @@ TabDragController::DragBrowserToNewTabStrip(TabDragCon
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++#if !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ // EndMoveLoop is going to snap the window back to its original location.
+ // Hide it so users don't see this. Hiding a window in Linux aura causes
+ // it to lose capture so skip it.
+@@ -2151,7 +2151,7 @@ void TabDragController::CompleteDrag() {
+ }
+
+ // If source window was maximized - maximize the new window as well.
+-#if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_MAC)
++#if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD)
+ // Keeping maximized state breaks snap to Grid on Windows when dragging
+ // tabs from maximized windows. TODO:(crbug.com/727051) Explore doing this
+ // for other desktop OS's. kMaximizedStateRetainedOnTabDrag in
+@@ -2581,7 +2581,7 @@ TabDragController::Liveness TabDragController::GetLoca
+ }
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Exclude windows which are pending deletion via Browser::TabStripEmpty().
+ // These windows can be returned in the Linux Aura port because the browser
+ // window which was used for dragging is not hidden once all of its tabs are
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_tabs_tab__hover__card__bubble__view.cc b/devel/electron31/files/patch-chrome_browser_ui_views_tabs_tab__hover__card__bubble__view.cc
new file mode 100644
index 000000000000..cf3a093ed13a
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_tabs_tab__hover__card__bubble__view.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.cc
+@@ -375,7 +375,7 @@ TabHoverCardBubbleView::TabHoverCardBubbleView(Tab* ta
+ // not become active. Setting this to false creates the need to explicitly
+ // hide the hovercard on press, touch, and keyboard events.
+ SetCanActivate(false);
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ set_accept_events(false);
+ #endif
+
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_tabs_tab__style__views.cc b/devel/electron31/files/patch-chrome_browser_ui_views_tabs_tab__style__views.cc
new file mode 100644
index 000000000000..92892b903a1c
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_tabs_tab__style__views.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/views/tabs/tab_style_views.cc.orig 2023-10-19 19:58:07 UTC
++++ chrome/browser/ui/views/tabs/tab_style_views.cc
+@@ -490,7 +490,7 @@ float GM2TabStyleViews::GetCurrentActiveOpacity() cons
+ if (!IsHoverAnimationActive()) {
+ return base_opacity;
+ }
+- return std::lerp(base_opacity, GetHoverOpacity(), GetHoverAnimationValue());
++ return std::lerp(base_opacity, GetHoverOpacity(), static_cast<float>(GetHoverAnimationValue()));
+ }
+
+ TabActive GM2TabStyleViews::GetApparentActiveState() const {
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_user__education_browser__user__education__service.cc b/devel/electron31/files/patch-chrome_browser_ui_views_user__education_browser__user__education__service.cc
new file mode 100644
index 000000000000..02de3e64ade3
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_user__education_browser__user__education__service.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/views/user_education/browser_user_education_service.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/views/user_education/browser_user_education_service.cc
+@@ -992,7 +992,7 @@ void MaybeRegisterChromeFeaturePromos(
+ FeaturePromoSpecification::AcceleratorInfo())
+ .SetBubbleArrow(HelpBubbleArrow::kTopLeft)));
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // kIPHDesktopPWAsLinkCapturingLaunch:
+ registry.RegisterFeature(std::move(
+ FeaturePromoSpecification::CreateForCustomAction(
diff --git a/devel/electron31/files/patch-chrome_browser_ui_views_web__apps_web__app__integration__test__driver.cc b/devel/electron31/files/patch-chrome_browser_ui_views_web__apps_web__app__integration__test__driver.cc
new file mode 100644
index 000000000000..b11cf484d081
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_views_web__apps_web__app__integration__test__driver.cc
@@ -0,0 +1,83 @@
+--- chrome/browser/ui/views/web_apps/web_app_integration_test_driver.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/views/web_apps/web_app_integration_test_driver.cc
+@@ -515,7 +515,7 @@ std::string GetFileExtension(FileExtension file_extens
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ SiteConfig GetSiteConfigurationFromAppName(const std::string& app_name) {
+ SiteConfig config;
+ bool is_app_found = false;
+@@ -2096,7 +2096,7 @@ void WebAppIntegrationTestDriver::DeletePlatformShortc
+ if (app_name.empty()) {
+ app_name = GetSiteConfiguration(site).app_name;
+ }
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ASSERT_TRUE(override_registration_->test_override().IsShortcutCreated(
+ profile(), app_id, app_name));
+ ASSERT_TRUE(
+@@ -3410,7 +3410,7 @@ void WebAppIntegrationTestDriver::CheckRunOnOsLoginEna
+ app_state->id, app_state->name);
+ ASSERT_TRUE(icon_color.has_value());
+ ASSERT_THAT(site_config.icon_color, testing::Eq(icon_color.value()));
+-#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ASSERT_TRUE(override_registration_->test_override().IsRunOnOsLoginEnabled(
+ profile(), app_state->id, app_state->name));
+ #endif
+@@ -3425,7 +3425,7 @@ void WebAppIntegrationTestDriver::CheckRunOnOsLoginDis
+ GetAppBySiteMode(after_state_change_action_state_.get(), profile(), site);
+ ASSERT_TRUE(app_state);
+ base::ScopedAllowBlockingForTesting allow_blocking;
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ASSERT_FALSE(override_registration_->test_override().IsRunOnOsLoginEnabled(
+ profile(), app_state->id, app_state->name));
+ #endif
+@@ -3435,7 +3435,7 @@ void WebAppIntegrationTestDriver::CheckSiteHandlesFile
+ void WebAppIntegrationTestDriver::CheckSiteHandlesFile(
+ Site site,
+ FileExtension file_extension) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!BeforeStateCheckAction(__FUNCTION__)) {
+ return;
+ }
+@@ -3451,7 +3451,7 @@ void WebAppIntegrationTestDriver::CheckSiteNotHandlesF
+ void WebAppIntegrationTestDriver::CheckSiteNotHandlesFile(
+ Site site,
+ FileExtension file_extension) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!BeforeStateCheckAction(__FUNCTION__)) {
+ return;
+ }
+@@ -4265,7 +4265,7 @@ base::FilePath WebAppIntegrationTestDriver::GetShortcu
+ base::FilePath shortcut_dir,
+ const std::string& app_name,
+ const webapps::AppId& app_id) {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ return override_registration_->test_override().GetShortcutPath(
+ profile(), shortcut_dir, app_id, app_name);
+ #else
+@@ -4465,7 +4465,7 @@ bool WebAppIntegrationTestDriver::IsShortcutAndIconCre
+ const webapps::AppId& id) {
+ base::ScopedAllowBlockingForTesting allow_blocking;
+ bool is_shortcut_and_icon_correct = false;
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool is_shortcut_correct =
+ override_registration_->test_override().IsShortcutCreated(profile, id,
+ name);
+@@ -4509,7 +4509,7 @@ bool WebAppIntegrationTestDriver::DoIconColorsMatch(Pr
+ do_icon_colors_match =
+ (expected_icon_pixel_color == shortcut_pixel_color_apps_folder.value());
+ }
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ SkColor expected_icon_pixel_color =
+ GetSiteConfigurationFromAppName(name).icon_color;
+ std::optional<SkColor> actual_color_install_icon_size =
diff --git a/devel/electron31/files/patch-chrome_browser_ui_web__applications_web__app__dialogs.h b/devel/electron31/files/patch-chrome_browser_ui_web__applications_web__app__dialogs.h
new file mode 100644
index 000000000000..25343000dcd8
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_web__applications_web__app__dialogs.h
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/web_applications/web_app_dialogs.h.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/web_applications/web_app_dialogs.h
+@@ -22,7 +22,7 @@ static_assert(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) |
+ #include "ui/gfx/native_widget_types.h"
+
+ static_assert(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+- BUILDFLAG(IS_CHROMEOS));
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD));
+
+ class GURL;
+ class Profile;
diff --git a/devel/electron31/files/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.cc b/devel/electron31/files/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.cc
new file mode 100644
index 000000000000..4f4f6a1b9558
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/web_applications/web_app_ui_manager_impl.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/web_applications/web_app_ui_manager_impl.cc
+@@ -578,7 +578,7 @@ void WebAppUiManagerImpl::MaybeShowIPHPromoForAppsLaun
+ content::WebContents* web_contents,
+ Profile* profile,
+ const std::string& app_id) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ WebAppProvider* provider = WebAppProvider::GetForWebApps(profile);
+ CHECK(provider);
+
+@@ -798,7 +798,7 @@ void WebAppUiManagerImpl::ClearWebAppSiteDataIfNeeded(
+ }
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void WebAppUiManagerImpl::ShowIPHPromoForAppsLaunchedViaLinkCapturing(
+ const Browser* browser,
+ const webapps::AppId& app_id,
diff --git a/devel/electron31/files/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.h b/devel/electron31/files/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.h
new file mode 100644
index 000000000000..843d06e7071d
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.h
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/web_applications/web_app_ui_manager_impl.h.orig 2024-04-15 20:33:49 UTC
++++ chrome/browser/ui/web_applications/web_app_ui_manager_impl.h
+@@ -222,7 +222,7 @@ class WebAppUiManagerImpl : public BrowserListObserver
+ UninstallCompleteCallback uninstall_complete_callback,
+ webapps::UninstallResultCode uninstall_code);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void ShowIPHPromoForAppsLaunchedViaLinkCapturing(const Browser* browser,
+ const webapps::AppId& app_id,
+ bool is_activated);
diff --git a/devel/electron31/files/patch-chrome_browser_ui_webui_about_about__ui.cc b/devel/electron31/files/patch-chrome_browser_ui_webui_about_about__ui.cc
new file mode 100644
index 000000000000..b9d166bd6aed
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_webui_about_about__ui.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/webui/about/about_ui.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/webui/about/about_ui.cc
+@@ -593,7 +593,7 @@ std::string ChromeURLs(content::BrowserContext* browse
+ return html;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OPENBSD)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::string AboutLinuxProxyConfig() {
+ std::string data;
+ AppendHeader(&data,
+@@ -648,7 +648,7 @@ void AboutUIHTMLSource::StartDataRequest(
+ response =
+ ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(idr);
+ }
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OPENBSD)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ } else if (source_name_ == chrome::kChromeUILinuxProxyConfigHost) {
+ response = AboutLinuxProxyConfig();
+ #endif
diff --git a/devel/electron31/files/patch-chrome_browser_ui_webui_app__home_app__home__page__handler.cc b/devel/electron31/files/patch-chrome_browser_ui_webui_app__home_app__home__page__handler.cc
new file mode 100644
index 000000000000..88997c6a3df4
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_webui_app__home_app__home__page__handler.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/webui/app_home/app_home_page_handler.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/webui/app_home/app_home_page_handler.cc
+@@ -376,7 +376,7 @@ app_home::mojom::AppInfoPtr AppHomePageHandler::Create
+ app_info->start_url = start_url;
+
+ bool deprecated_app = false;
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto* context = extension_system_->extension_service()->GetBrowserContext();
+ deprecated_app =
+ extensions::IsExtensionUnsupportedDeprecatedApp(context, extension->id());
+@@ -439,7 +439,7 @@ void AppHomePageHandler::FillExtensionInfoList(
+ continue;
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto* context = extension_system_->extension_service()->GetBrowserContext();
+ const bool is_deprecated_app =
+ extensions::IsExtensionUnsupportedDeprecatedApp(context,
diff --git a/devel/electron31/files/patch-chrome_browser_ui_webui_chrome__web__ui__controller__factory.cc b/devel/electron31/files/patch-chrome_browser_ui_webui_chrome__web__ui__controller__factory.cc
new file mode 100644
index 000000000000..131a41700226
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_webui_chrome__web__ui__controller__factory.cc
@@ -0,0 +1,91 @@
+--- chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+@@ -196,7 +196,7 @@
+ #include "chrome/browser/ui/webui/chromeos/chrome_url_disabled/chrome_url_disabled_ui.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/webui_js_error/webui_js_error_ui.h"
+ #endif
+
+@@ -221,17 +221,17 @@
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/discards/discards_ui.h"
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/sandbox/sandbox_internals_ui.h"
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/connectors_internals/connectors_internals_ui.h"
+ #endif
+
+@@ -375,7 +375,7 @@ bool IsAboutUI(const GURL& url) {
+ #if !BUILDFLAG(IS_ANDROID)
+ || url.host_piece() == chrome::kChromeUITermsHost
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OPENBSD)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ || url.host_piece() == chrome::kChromeUILinuxProxyConfigHost
+ #endif
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+@@ -582,7 +582,7 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* we
+ if (url.host_piece() == chrome::kChromeUIMobileSetupHost)
+ return &NewWebUI<ash::cellular_setup::MobileSetupUI>;
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (url.host_piece() == chrome::kChromeUIWebUIJsErrorHost)
+ return &NewWebUI<WebUIJsErrorUI>;
+ #endif
+@@ -638,7 +638,7 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* we
+ if (url.host_piece() == chrome::kChromeUINaClHost)
+ return &NewWebUI<NaClUI>;
+ #endif
+-#if ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \
++#if ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && \
+ defined(TOOLKIT_VIEWS)) || \
+ defined(USE_AURA)
+ if (url.host_piece() == chrome::kChromeUITabModalConfirmDialogHost)
+@@ -686,26 +686,26 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* we
+ }
+ #endif
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ if (url.host_piece() == chrome::kChromeUISandboxHost) {
+ return &NewWebUI<SandboxInternalsUI>;
+ }
+ #endif
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ if (url.host_piece() == chrome::kChromeUIConnectorsInternalsHost)
+ return &NewWebUI<enterprise_connectors::ConnectorsInternalsUI>;
+ #endif
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (url.host_piece() == chrome::kChromeUIDiscardsHost)
+ return &NewWebUI<DiscardsUI>;
+ #endif
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (url.host_piece() == chrome::kChromeUIBrowserSwitchHost)
+ return &NewWebUI<BrowserSwitchUI>;
+ #endif
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (url.host_piece() == chrome::kChromeUIWebAppSettingsHost)
+ return &NewWebUI<WebAppSettingsUI>;
+ #endif
diff --git a/devel/electron31/files/patch-chrome_browser_ui_webui_connectors__internals_device__trust__utils.cc b/devel/electron31/files/patch-chrome_browser_ui_webui_connectors__internals_device__trust__utils.cc
new file mode 100644
index 000000000000..cd80eedcd8fb
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_webui_connectors__internals_device__trust__utils.cc
@@ -0,0 +1,29 @@
+--- chrome/browser/ui/webui/connectors_internals/device_trust_utils.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/webui/connectors_internals/device_trust_utils.cc
+@@ -7,7 +7,7 @@
+ #include "build/build_config.h"
+ #include "components/enterprise/buildflags/buildflags.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "base/base64url.h"
+ #include "chrome/browser/browser_process.h"
+ #include "chrome/browser/policy/chrome_browser_policy_connector.h"
+@@ -38,7 +38,7 @@ namespace {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+
+ connectors_internals::mojom::KeyTrustLevel ParseTrustLevel(
+ BPKUR::KeyTrustLevel trust_level) {
+@@ -173,7 +173,7 @@ connectors_internals::mojom::KeyInfoPtr GetKeyInfo() {
+ } // namespace
+
+ connectors_internals::mojom::KeyInfoPtr GetKeyInfo() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ auto* key_manager = g_browser_process->browser_policy_connector()
+ ->chrome_browser_cloud_management_controller()
+ ->GetDeviceTrustKeyManager();
diff --git a/devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui.cc b/devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui.cc
new file mode 100644
index 000000000000..b72994898978
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui.cc
@@ -0,0 +1,16 @@
+--- chrome/browser/ui/webui/management/management_ui.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/webui/management/management_ui.cc
+@@ -99,11 +99,11 @@ content::WebUIDataSource* CreateAndAddManagementUIHtml
+ {kManagementOnFileTransferVisibleData,
+ IDS_MANAGEMENT_FILE_TRANSFER_VISIBLE_DATA},
+ #endif // BUILDFLAG(IS_CHROMEOS)
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {kManagementScreenCaptureEvent, IDS_MANAGEMENT_SCREEN_CAPTURE_EVENT},
+ {kManagementScreenCaptureData, IDS_MANAGEMENT_SCREEN_CAPTURE_DATA},
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {kManagementDeviceSignalsDisclosure,
+ IDS_MANAGEMENT_DEVICE_SIGNALS_DISCLOSURE},
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
diff --git a/devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui__constants.cc b/devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui__constants.cc
new file mode 100644
index 000000000000..2da009e3120c
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui__constants.cc
@@ -0,0 +1,17 @@
+--- chrome/browser/ui/webui/management/management_ui_constants.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/webui/management/management_ui_constants.cc
+@@ -78,12 +78,12 @@ const char kProfileReportingPolicy[] = "profileReporti
+ const char kProfileReportingExtension[] = "profileReportingExtension";
+ const char kProfileReportingPolicy[] = "profileReportingPolicy";
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const char kManagementScreenCaptureEvent[] = "managementScreenCaptureEvent";
+ const char kManagementScreenCaptureData[] = "managementScreenCaptureData";
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const char kManagementDeviceSignalsDisclosure[] =
+ "managementDeviceSignalsDisclosure";
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
diff --git a/devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui__constants.h b/devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui__constants.h
new file mode 100644
index 000000000000..47f965faae09
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui__constants.h
@@ -0,0 +1,19 @@
+--- chrome/browser/ui/webui/management/management_ui_constants.h.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/webui/management/management_ui_constants.h
+@@ -8,14 +8,14 @@
+ #include "build/build_config.h"
+ #include "build/chromeos_buildflags.h"
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Constants defining the IDs for the localized strings sent to the page as
+ // load time data.
+ extern const char kManagementScreenCaptureEvent[];
+ extern const char kManagementScreenCaptureData[];
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ extern const char kManagementDeviceSignalsDisclosure[];
+ #endif // #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
diff --git a/devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui__handler.cc b/devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui__handler.cc
new file mode 100644
index 000000000000..d0da87d14c5e
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui__handler.cc
@@ -0,0 +1,29 @@
+--- chrome/browser/ui/webui/management/management_ui_handler.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/webui/management/management_ui_handler.cc
+@@ -58,7 +58,7 @@
+ #include "ui/base/l10n/l10n_util.h"
+ #include "ui/base/webui/web_ui_util.h"
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/signals/user_permission_service_factory.h"
+ #include "components/device_signals/core/browser/user_permission_service.h" // nogncheck
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+@@ -354,7 +354,7 @@ void ManagementUIHandler::AddReportingInfo(base::Value
+ report_sources->Append(std::move(data));
+ }
+ }
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Insert the device signals consent disclosure at the end of browser
+ // reporting section.
+ auto* user_permission_service = GetUserPermissionService();
+@@ -532,7 +532,7 @@ policy::PolicyService* ManagementUIHandler::GetPolicyS
+ ->policy_service();
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ device_signals::UserPermissionService*
+ ManagementUIHandler::GetUserPermissionService() {
+ return enterprise_signals::UserPermissionServiceFactory::GetForProfile(
diff --git a/devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui__handler.h b/devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui__handler.h
new file mode 100644
index 000000000000..1db15fd9d935
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_webui_management_management__ui__handler.h
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/webui/management/management_ui_handler.h.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/webui/management/management_ui_handler.h
+@@ -31,7 +31,7 @@ class PolicyService;
+ class PolicyService;
+ } // namespace policy
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ namespace device_signals {
+ class UserPermissionService;
+ } // namespace device_signals
+@@ -72,7 +72,7 @@ class ManagementUIHandler : public content::WebUIMessa
+ base::Value::List GetManagedWebsitesInfo(Profile* profile) const;
+ base::Value::List GetApplicationsInfo(Profile* profile) const;
+ virtual policy::PolicyService* GetPolicyService();
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ virtual device_signals::UserPermissionService* GetUserPermissionService();
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
diff --git a/devel/electron31/files/patch-chrome_browser_ui_webui_password__manager_promo__cards__handler.cc b/devel/electron31/files/patch-chrome_browser_ui_webui_password__manager_promo__cards__handler.cc
new file mode 100644
index 000000000000..643d83b14a4a
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_webui_password__manager_promo__cards__handler.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/webui/password_manager/promo_cards_handler.cc.orig 2024-02-21 00:20:37 UTC
++++ chrome/browser/ui/webui/password_manager/promo_cards_handler.cc
+@@ -28,7 +28,7 @@
+ #include "chrome/browser/ui/webui/password_manager/promo_cards/web_password_manager_promo.h"
+ #endif
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/password_manager/promo_cards/relaunch_chrome_promo.h"
+ #endif
+
+@@ -71,7 +71,7 @@ std::vector<std::unique_ptr<PasswordPromoCardBase>> Ge
+ .get()));
+ #endif
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ promo_cards.push_back(
+ std::make_unique<RelaunchChromePromo>(profile->GetPrefs()));
+ #endif
diff --git a/devel/electron31/files/patch-chrome_browser_ui_webui_password__manager_promo__cards_relaunch__chrome__promo.cc b/devel/electron31/files/patch-chrome_browser_ui_webui_password__manager_promo__cards_relaunch__chrome__promo.cc
new file mode 100644
index 000000000000..a443f1769af2
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_webui_password__manager_promo__cards_relaunch__chrome__promo.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/ui/webui/password_manager/promo_cards/relaunch_chrome_promo.cc.orig 2024-02-21 00:20:37 UTC
++++ chrome/browser/ui/webui/password_manager/promo_cards/relaunch_chrome_promo.cc
+@@ -37,7 +37,7 @@ std::u16string RelaunchChromePromo::GetTitle() const {
+ return l10n_util::GetStringUTF16(
+ #if BUILDFLAG(IS_MAC)
+ IDS_PASSWORD_MANAGER_UI_RELAUNCH_CHROME_PROMO_CARD_TITLE
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ IDS_PASSWORD_MANAGER_UI_RELAUNCH_CHROME_PROMO_CARD_TITLE_LINUX
+ #endif
+ );
+@@ -47,7 +47,7 @@ std::u16string RelaunchChromePromo::GetDescription() c
+ return l10n_util::GetStringUTF16(
+ #if BUILDFLAG(IS_MAC)
+ IDS_PASSWORD_MANAGER_UI_RELAUNCH_CHROME_PROMO_CARD_DESCRIPTION
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ IDS_PASSWORD_MANAGER_UI_RELAUNCH_CHROME_PROMO_CARD_DESCRIPTION_LINUX
+ #endif
+ );
diff --git a/devel/electron31/files/patch-chrome_browser_ui_webui_searchbox_searchbox__handler.cc b/devel/electron31/files/patch-chrome_browser_ui_webui_searchbox_searchbox__handler.cc
new file mode 100644
index 000000000000..9c28bb9dc7f5
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_webui_searchbox_searchbox__handler.cc
@@ -0,0 +1,29 @@
+--- chrome/browser/ui/webui/searchbox/searchbox_handler.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/webui/searchbox/searchbox_handler.cc
+@@ -105,7 +105,7 @@ const char* kWinShareIconResourceName =
+ #elif BUILDFLAG(IS_WIN)
+ const char* kWinShareIconResourceName =
+ "//resources/cr_components/searchbox/icons/win_share.svg";
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const char* kLinuxShareIconResourceName =
+ "//resources/cr_components/searchbox/icons/share.svg";
+ #else
+@@ -165,7 +165,7 @@ static void DefineChromeRefreshRealboxIcons() {
+ #elif BUILDFLAG(IS_WIN)
+ kWinShareIconResourceName =
+ "//resources/cr_components/searchbox/icons/win_share_cr23.svg";
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ kLinuxShareIconResourceName =
+ "//resources/cr_components/searchbox/icons/share_cr23.svg";
+ #else
+@@ -670,7 +670,7 @@ std::string SearchboxHandler::ActionVectorIconToResour
+ icon.name == omnibox::kShareWinChromeRefreshIcon.name) {
+ return kWinShareIconResourceName;
+ }
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (icon.name == omnibox::kShareIcon.name ||
+ icon.name == omnibox::kShareLinuxChromeRefreshIcon.name) {
+ return kLinuxShareIconResourceName;
diff --git a/devel/electron31/files/patch-chrome_browser_ui_webui_settings_accessibility__main__handler.cc b/devel/electron31/files/patch-chrome_browser_ui_webui_settings_accessibility__main__handler.cc
new file mode 100644
index 000000000000..0d856e5a25a6
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_webui_settings_accessibility__main__handler.cc
@@ -0,0 +1,46 @@
+--- chrome/browser/ui/webui/settings/accessibility_main_handler.cc.orig 2024-02-21 00:20:37 UTC
++++ chrome/browser/ui/webui/settings/accessibility_main_handler.cc
+@@ -19,7 +19,7 @@
+ #include "content/public/browser/web_contents.h"
+ #include "content/public/browser/web_ui.h"
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "ui/accessibility/accessibility_features.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
+
+@@ -39,7 +39,7 @@ void AccessibilityMainHandler::RegisterMessages() {
+ base::BindRepeating(
+ &AccessibilityMainHandler::HandleCheckAccessibilityImageLabels,
+ base::Unretained(this)));
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ web_ui()->RegisterMessageCallback(
+ "getScreenAiInstallState",
+ base::BindRepeating(
+@@ -56,7 +56,7 @@ void AccessibilityMainHandler::OnJavascriptAllowed() {
+ base::Unretained(this)));
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (features::IsPdfOcrEnabled()) {
+ CHECK(!component_ready_observer_.IsObserving());
+ component_ready_observer_.Observe(
+@@ -70,14 +70,14 @@ void AccessibilityMainHandler::OnJavascriptDisallowed(
+ accessibility_subscription_ = {};
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (features::IsPdfOcrEnabled()) {
+ component_ready_observer_.Reset();
+ }
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ void AccessibilityMainHandler::DownloadProgressChanged(double progress) {
+ CHECK_GE(progress, 0.0);
+ CHECK_LE(progress, 1.0);
diff --git a/devel/electron31/files/patch-chrome_browser_ui_webui_settings_accessibility__main__handler.h b/devel/electron31/files/patch-chrome_browser_ui_webui_settings_accessibility__main__handler.h
new file mode 100644
index 000000000000..466c3a3c6e96
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_webui_settings_accessibility__main__handler.h
@@ -0,0 +1,47 @@
+--- chrome/browser/ui/webui/settings/accessibility_main_handler.h.orig 2024-02-21 00:20:37 UTC
++++ chrome/browser/ui/webui/settings/accessibility_main_handler.h
+@@ -13,7 +13,7 @@
+ #include "chrome/browser/ash/accessibility/accessibility_manager.h"
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "base/scoped_observation.h"
+ #include "chrome/browser/screen_ai/screen_ai_install_state.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
+@@ -24,7 +24,7 @@ class AccessibilityMainHandler
+ // chrome://settings/accessibility.
+ class AccessibilityMainHandler
+ : public ::settings::SettingsPageUIHandler
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ ,
+ public screen_ai::ScreenAIInstallState::Observer
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
+@@ -40,7 +40,7 @@ class AccessibilityMainHandler
+ void OnJavascriptAllowed() override;
+ void OnJavascriptDisallowed() override;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // screen_ai::ScreenAIInstallState::Observer:
+ void DownloadProgressChanged(double progress) override;
+ void StateChanged(screen_ai::ScreenAIInstallState::State state) override;
+@@ -50,7 +50,7 @@ class AccessibilityMainHandler
+ void HandleGetScreenReaderState(const base::Value::List& args);
+ void HandleCheckAccessibilityImageLabels(const base::Value::List& args);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ void HandleGetScreenAIInstallState(const base::Value::List& args);
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
+
+@@ -63,7 +63,7 @@ class AccessibilityMainHandler
+ base::CallbackListSubscription accessibility_subscription_;
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ base::ScopedObservation<screen_ai::ScreenAIInstallState,
+ screen_ai::ScreenAIInstallState::Observer>
+ component_ready_observer_{this};
diff --git a/devel/electron31/files/patch-chrome_browser_ui_webui_settings_appearance__handler.cc b/devel/electron31/files/patch-chrome_browser_ui_webui_settings_appearance__handler.cc
new file mode 100644
index 000000000000..f744fa8fd2d3
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_webui_settings_appearance__handler.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/webui/settings/appearance_handler.cc.orig 2022-10-24 13:33:33 UTC
++++ chrome/browser/ui/webui/settings/appearance_handler.cc
+@@ -28,7 +28,7 @@ void AppearanceHandler::RegisterMessages() {
+ "useDefaultTheme",
+ base::BindRepeating(&AppearanceHandler::HandleUseTheme,
+ base::Unretained(this), ui::SystemTheme::kDefault));
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ web_ui()->RegisterMessageCallback(
+ "useGtkTheme",
+ base::BindRepeating(&AppearanceHandler::HandleUseTheme,
diff --git a/devel/electron31/files/patch-chrome_browser_ui_webui_settings_settings__localized__strings__provider.cc b/devel/electron31/files/patch-chrome_browser_ui_webui_settings_settings__localized__strings__provider.cc
new file mode 100644
index 000000000000..376d6048b3af
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_webui_settings_settings__localized__strings__provider.cc
@@ -0,0 +1,56 @@
+--- chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+@@ -136,7 +136,7 @@
+ #include "chrome/browser/ui/chrome_pages.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && !BUILDFLAG(IS_CHROMEOS_LACROS)
+ #include "ui/display/screen.h"
+ #endif
+
+@@ -155,7 +155,7 @@
+ #include "chrome/browser/ui/webui/certificate_manager_localized_strings_provider.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui_factory.h"
+ #include "ui/ozone/public/ozone_platform.h"
+ #endif
+@@ -272,7 +272,7 @@ void AddA11yStrings(content::WebUIDataSource* html_sou
+ {"focusHighlightLabel",
+ IDS_SETTINGS_ACCESSIBILITY_FOCUS_HIGHLIGHT_DESCRIPTION},
+ #endif
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ {"overscrollHistoryNavigationTitle",
+ IDS_SETTINGS_OVERSCROLL_HISTORY_NAVIGATION_TITLE},
+ {"overscrollHistoryNavigationSubtitle",
+@@ -412,7 +412,7 @@ void AddAppearanceStrings(content::WebUIDataSource* ht
+ {"huge", IDS_SETTINGS_HUGE_FONT_SIZE},
+ {"sidePanelAlignLeft", IDS_SETTINGS_SIDE_PANEL_ALIGN_LEFT},
+ {"sidePanelAlignRight", IDS_SETTINGS_SIDE_PANEL_ALIGN_RIGHT},
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {"gtkTheme", IDS_SETTINGS_GTK_THEME},
+ {"useGtkTheme", IDS_SETTINGS_USE_GTK_THEME},
+ {"qtTheme", IDS_SETTINGS_QT_THEME},
+@@ -422,7 +422,7 @@ void AddAppearanceStrings(content::WebUIDataSource* ht
+ #else
+ {"resetToDefaultTheme", IDS_SETTINGS_RESET_TO_DEFAULT_THEME},
+ #endif
+-#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && !BUILDFLAG(IS_CHROMEOS_LACROS)
+ {"showWindowDecorations", IDS_SHOW_WINDOW_DECORATIONS},
+ #endif
+ #if BUILDFLAG(IS_MAC)
+@@ -445,7 +445,7 @@ void AddAppearanceStrings(content::WebUIDataSource* ht
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && !BUILDFLAG(IS_CHROMEOS_LACROS)
+ bool show_custom_chrome_frame = ui::OzonePlatform::GetInstance()
+ ->GetPlatformRuntimeProperties()
+ .supports_server_side_window_decorations;
diff --git a/devel/electron31/files/patch-chrome_browser_ui_window__sizer_window__sizer.cc b/devel/electron31/files/patch-chrome_browser_ui_window__sizer_window__sizer.cc
new file mode 100644
index 000000000000..4e97de457ed0
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_ui_window__sizer_window__sizer.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/ui/window_sizer/window_sizer.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/ui/window_sizer/window_sizer.cc
+@@ -210,7 +210,7 @@ void WindowSizer::GetBrowserWindowBoundsAndShowState(
+ browser, window_bounds, show_state);
+ }
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Linux has its own implementation, see WindowSizerLinux.
+ // static
+ void WindowSizer::GetBrowserWindowBoundsAndShowState(
diff --git a/devel/electron31/files/patch-chrome_browser_visited__url__ranking_visited__url__ranking__service__factory.cc b/devel/electron31/files/patch-chrome_browser_visited__url__ranking_visited__url__ranking__service__factory.cc
new file mode 100644
index 000000000000..84907492ac5f
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_visited__url__ranking_visited__url__ranking__service__factory.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/visited_url_ranking/visited_url_ranking_service_factory.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/visited_url_ranking/visited_url_ranking_service_factory.cc
+@@ -35,7 +35,7 @@
+ #include "components/visited_url_ranking/public/visited_url_ranking_service.h"
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/visited_url_ranking/desktop_tab_model_url_visit_data_fetcher.h"
+ #endif
+
+@@ -80,7 +80,7 @@ VisitedURLRankingServiceFactory::BuildServiceInstanceF
+
+ std::map<Fetcher, std::unique_ptr<URLVisitDataFetcher>> data_fetchers;
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ data_fetchers.emplace(
+ Fetcher::kTabModel,
+ std::make_unique<visited_url_ranking::DesktopTabModelURLVisitDataFetcher>(
diff --git a/devel/electron31/files/patch-chrome_browser_web__applications_extension__status__utils.h b/devel/electron31/files/patch-chrome_browser_web__applications_extension__status__utils.h
new file mode 100644
index 000000000000..ff844a24f567
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_web__applications_extension__status__utils.h
@@ -0,0 +1,11 @@
+--- chrome/browser/web_applications/extension_status_utils.h.orig 2024-04-15 20:33:50 UTC
++++ chrome/browser/web_applications/extension_status_utils.h
+@@ -55,7 +55,7 @@ bool ClearExternalExtensionUninstalled(content::Browse
+ bool ClearExternalExtensionUninstalled(content::BrowserContext* context,
+ const std::string& extension_id);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // If this method returns true, then |extension_id| will not be launchable.
+ //
+ // The eventual goal is that this method should return true for all hosted apps,
diff --git a/devel/electron31/files/patch-chrome_browser_web__applications_extensions_extension__status__utils.cc b/devel/electron31/files/patch-chrome_browser_web__applications_extensions_extension__status__utils.cc
new file mode 100644
index 000000000000..434feedd7c80
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_web__applications_extensions_extension__status__utils.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/web_applications/extensions/extension_status_utils.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/web_applications/extensions/extension_status_utils.cc
+@@ -25,7 +25,7 @@ const char* g_preinstalled_app_for_testing = nullptr;
+
+ const char* g_preinstalled_app_for_testing = nullptr;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // TODO(b/268221237): Remove this allow-list.
+ const char kDefaultAllowedExtensionIds[] =
+ "alhngdkjgnedakdlnamimgfihgkmenbh,"
+@@ -113,7 +113,7 @@ bool ClearExternalExtensionUninstalled(content::Browse
+ extension_id);
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool IsExtensionUnsupportedDeprecatedApp(content::BrowserContext* context,
+ const std::string& extension_id) {
+ if (testing::g_enable_chrome_apps_for_testing) {
diff --git a/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_os__integration__test__override.h b/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_os__integration__test__override.h
new file mode 100644
index 000000000000..84a61383a529
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_os__integration__test__override.h
@@ -0,0 +1,11 @@
+--- chrome/browser/web_applications/os_integration/os_integration_test_override.h.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/web_applications/os_integration/os_integration_test_override.h
+@@ -99,7 +99,7 @@ class OsIntegrationTestOverride
+ virtual base::FilePath chrome_apps_folder() = 0;
+ virtual void EnableOrDisablePathOnLogin(const base::FilePath& file_path,
+ bool enable_on_login) = 0;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ virtual base::Environment* environment() = 0;
+ #endif
+
diff --git a/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_run__on__os__login__sub__manager.cc b/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_run__on__os__login__sub__manager.cc
new file mode 100644
index 000000000000..1e83c5d1b12c
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_run__on__os__login__sub__manager.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/web_applications/os_integration/run_on_os_login_sub_manager.cc.orig 2023-10-19 19:58:08 UTC
++++ chrome/browser/web_applications/os_integration/run_on_os_login_sub_manager.cc
+@@ -54,7 +54,7 @@ proto::RunOnOsLoginMode ConvertWebAppRunOnOsLoginModeT
+ // different from other platforms, see web_app_run_on_os_login_manager.h for
+ // more info.
+ bool DoesRunOnOsLoginRequireExecution() {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return base::FeatureList::IsEnabled(features::kDesktopPWAsRunOnOsLogin);
+ #else
+ return false;
diff --git a/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_shortcut__sub__manager.cc b/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_shortcut__sub__manager.cc
new file mode 100644
index 000000000000..e3569da6941d
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_shortcut__sub__manager.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/web_applications/os_integration/shortcut_sub_manager.cc.orig 2023-10-19 19:58:08 UTC
++++ chrome/browser/web_applications/os_integration/shortcut_sub_manager.cc
+@@ -182,7 +182,7 @@ void ShortcutSubManager::Execute(
+ return;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // Protocol handler update detection. Shortcuts need to be updated in this
+ // case on Linux & Mac because the shortcut itself includes the protocol
+ // handling metadata.
diff --git a/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_web__app__file__handler__registration.h b/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_web__app__file__handler__registration.h
new file mode 100644
index 000000000000..95f3077295e6
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_web__app__file__handler__registration.h
@@ -0,0 +1,11 @@
+--- chrome/browser/web_applications/os_integration/web_app_file_handler_registration.h.orig 2023-05-25 00:41:46 UTC
++++ chrome/browser/web_applications/os_integration/web_app_file_handler_registration.h
+@@ -43,7 +43,7 @@ void UnregisterFileHandlersWithOs(const AppId& app_id,
+ const base::FilePath& profile_path,
+ ResultCallback callback);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Exposed for testing purposes. Register the set of
+ // MIME-type-to-file-extensions mappings corresponding to |file_handlers|. File
+ // I/O and callouts to the Linux shell are performed asynchronously.
diff --git a/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.cc b/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.cc
new file mode 100644
index 000000000000..8b0adf225fb0
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/web_applications/os_integration/web_app_shortcut.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/web_applications/os_integration/web_app_shortcut.cc
+@@ -65,7 +65,7 @@ const int kDesiredIconSizesForShortcut[] = {16, 32, 12
+
+ #if BUILDFLAG(IS_MAC)
+ const int kDesiredIconSizesForShortcut[] = {16, 32, 128, 256, 512};
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Linux supports icons of any size. FreeDesktop Icon Theme Specification states
+ // that "Minimally you should install a 48x48 icon in the hicolor theme."
+ const int kDesiredIconSizesForShortcut[] = {16, 32, 48, 128, 256, 512};
+@@ -227,7 +227,7 @@ std::unique_ptr<ShortcutInfo> BuildShortcutInfoWithout
+
+ // TODO(crbug.com/40257107): Implement tests on Linux for using shortcuts_menu
+ // actions.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const std::vector<WebAppShortcutsMenuItemInfo>& shortcuts_menu_item_infos =
+ CreateShortcutsMenuItemInfos(state.shortcut_menus());
+ DCHECK_LE(shortcuts_menu_item_infos.size(), kMaxApplicationDockMenuItems);
diff --git a/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.h b/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.h
new file mode 100644
index 000000000000..7994b0589e4c
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.h
@@ -0,0 +1,20 @@
+--- chrome/browser/web_applications/os_integration/web_app_shortcut.h.orig 2023-10-19 19:58:08 UTC
++++ chrome/browser/web_applications/os_integration/web_app_shortcut.h
+@@ -21,7 +21,7 @@
+ #include "ui/gfx/image/image_family.h"
+ #include "url/gurl.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/web_applications/os_integration/web_app_shortcut_linux.h"
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -70,7 +70,7 @@ struct ShortcutInfo {
+ std::set<std::string> file_handler_extensions;
+ std::set<std::string> file_handler_mime_types;
+ std::set<std::string> protocol_handlers;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::set<DesktopActionInfo> actions;
+ #endif // BUILDFLAG(IS_LINUX)
+
diff --git a/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_web__app__shortcut__manager.cc b/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_web__app__shortcut__manager.cc
new file mode 100644
index 000000000000..45d42ff6de32
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_web__applications_os__integration_web__app__shortcut__manager.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/web_applications/os_integration/web_app_shortcut_manager.cc.orig 2024-04-15 20:33:50 UTC
++++ chrome/browser/web_applications/os_integration/web_app_shortcut_manager.cc
+@@ -441,7 +441,7 @@ std::unique_ptr<ShortcutInfo> WebAppShortcutManager::B
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const std::vector<WebAppShortcutsMenuItemInfo>& shortcuts_menu_item_infos =
+ app->shortcuts_menu_item_infos();
+ DCHECK_LE(shortcuts_menu_item_infos.size(), kMaxApplicationDockMenuItems);
diff --git a/devel/electron31/files/patch-chrome_browser_web__applications_policy_web__app__policy__manager.cc b/devel/electron31/files/patch-chrome_browser_web__applications_policy_web__app__policy__manager.cc
new file mode 100644
index 000000000000..1f83e86c9f96
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_web__applications_policy_web__app__policy__manager.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/web_applications/policy/web_app_policy_manager.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/web_applications/policy/web_app_policy_manager.cc
+@@ -101,7 +101,7 @@ BASE_FEATURE(kDesktopPWAsForceUnregisterOSIntegration,
+
+ BASE_FEATURE(kDesktopPWAsForceUnregisterOSIntegration,
+ "DesktopPWAsForceUnregisterOSIntegration",
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
diff --git a/devel/electron31/files/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.cc b/devel/electron31/files/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.cc
new file mode 100644
index 000000000000..42821134ed3d
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.cc
@@ -0,0 +1,119 @@
+--- chrome/browser/web_applications/test/os_integration_test_override_impl.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/web_applications/test/os_integration_test_override_impl.cc
+@@ -46,7 +46,7 @@
+ #include "third_party/skia/include/core/SkBitmap.h"
+ #include "third_party/skia/include/core/SkColor.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/nix/xdg_util.h"
+ #endif
+
+@@ -131,7 +131,7 @@ std::vector<std::wstring> GetFileExtensionsForProgId(
+ }
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Performs a blocking read of app icons from the disk.
+ SkColor IconManagerReadIconTopLeftColorForSize(WebAppIconManager& icon_manager,
+ const webapps::AppId& app_id,
+@@ -266,7 +266,7 @@ bool OsIntegrationTestOverrideImpl::SimulateDeleteShor
+ GetShortcutPath(profile, chrome_apps_folder(), app_id, app_name);
+ CHECK(base::PathExists(app_folder_shortcut_path));
+ return base::DeletePathRecursively(app_folder_shortcut_path);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FilePath desktop_shortcut_path =
+ GetShortcutPath(profile, desktop(), app_id, app_name);
+ LOG(INFO) << desktop_shortcut_path;
+@@ -306,7 +306,7 @@ bool OsIntegrationTestOverrideImpl::DeleteApplicationM
+ }
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool OsIntegrationTestOverrideImpl::DeleteDesktopDirOnLinux() {
+ if (desktop_.IsValid()) {
+ return desktop_.Delete();
+@@ -320,7 +320,7 @@ bool OsIntegrationTestOverrideImpl::IsRunOnOsLoginEnab
+ Profile* profile,
+ const webapps::AppId& app_id,
+ const std::string& app_name) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::string shortcut_filename =
+ "chrome-" + app_id + "-" + profile->GetBaseName().value() + ".desktop";
+ return base::PathExists(startup().Append(shortcut_filename));
+@@ -376,7 +376,7 @@ bool OsIntegrationTestOverrideImpl::IsFileExtensionHan
+ is_file_handled =
+ shell_integration::CanApplicationHandleURL(app_path, test_file_url);
+ base::DeleteFile(test_file_path);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FilePath user_applications_dir = applications();
+ bool database_update_called = false;
+ for (const LinuxFileRegistration& command : linux_file_registration_) {
+@@ -419,7 +419,7 @@ OsIntegrationTestOverrideImpl::GetShortcutIconTopLeftC
+ return std::nullopt;
+ }
+ return GetIconTopLeftColorFromShortcutFile(shortcut_path);
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ WebAppProvider* provider = WebAppProvider::GetForLocalAppsUnchecked(profile);
+ if (!provider) {
+ return std::nullopt;
+@@ -469,7 +469,7 @@ base::FilePath OsIntegrationTestOverrideImpl::GetShort
+ app_installed_profiles.end()) {
+ return shortcut_path;
+ }
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::string shortcut_filename =
+ "chrome-" + app_id + "-" + profile->GetBaseName().value() + ".desktop";
+ base::FilePath shortcut_path = shortcut_dir.Append(shortcut_filename);
+@@ -495,7 +495,7 @@ bool OsIntegrationTestOverrideImpl::IsShortcutCreated(
+ base::FilePath app_shortcut_path =
+ GetShortcutPath(profile, chrome_apps_folder(), app_id, app_name);
+ return base::PathExists(app_shortcut_path);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FilePath desktop_shortcut_path =
+ GetShortcutPath(profile, desktop(), app_id, app_name);
+ return base::PathExists(desktop_shortcut_path);
+@@ -683,7 +683,7 @@ void OsIntegrationTestOverrideImpl::EnableOrDisablePat
+ }
+ #endif // BUILDFLAG(IS_MAC)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FilePath OsIntegrationTestOverrideImpl::desktop() {
+ return desktop_.GetPath();
+ }
+@@ -734,7 +734,7 @@ OsIntegrationTestOverrideImpl::OsIntegrationTestOverri
+ success = chrome_apps_folder_.CreateUniqueTempDirUnderPath(
+ outer_temp_dir_.GetPath());
+ CHECK(success);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ success = desktop_.CreateUniqueTempDirUnderPath(outer_temp_dir_.GetPath());
+ CHECK(success);
+ success = startup_.CreateUniqueTempDirUnderPath(outer_temp_dir_.GetPath());
+@@ -747,7 +747,7 @@ OsIntegrationTestOverrideImpl::OsIntegrationTestOverri
+ CHECK(success);
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto callback = base::BindRepeating([](base::FilePath filename_in,
+ std::string xdg_command,
+ std::string file_contents) {
+@@ -819,7 +819,7 @@ OsIntegrationTestOverrideImpl::~OsIntegrationTestOverr
+ EXPECT_TRUE(!startup_.IsValid() || startup_.Delete());
+ #elif BUILDFLAG(IS_MAC)
+ EXPECT_TRUE(!chrome_apps_folder_.IsValid() || chrome_apps_folder_.Delete());
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ EXPECT_TRUE(!desktop_.IsValid() || desktop_.Delete());
+ EXPECT_TRUE(!startup_.IsValid() || startup_.Delete());
+ EXPECT_TRUE(!xdg_data_home_dir_.IsValid() || xdg_data_home_dir_.Delete());
diff --git a/devel/electron31/files/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.h b/devel/electron31/files/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.h
new file mode 100644
index 000000000000..7fd1521eeed9
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.h
@@ -0,0 +1,38 @@
+--- chrome/browser/web_applications/test/os_integration_test_override_impl.h.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/web_applications/test/os_integration_test_override_impl.h
+@@ -40,7 +40,7 @@ namespace web_app {
+
+ namespace web_app {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ struct LinuxFileRegistration {
+ base::FilePath file_name;
+ std::string xdg_command;
+@@ -122,7 +122,7 @@ class OsIntegrationTestOverrideImpl : public OsIntegra
+ bool DeleteApplicationMenuDirOnWin();
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool DeleteDesktopDirOnLinux();
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -242,7 +242,7 @@ class OsIntegrationTestOverrideImpl : public OsIntegra
+ base::FilePath chrome_apps_folder() override;
+ void EnableOrDisablePathOnLogin(const base::FilePath& file_path,
+ bool enable_on_login) override;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FilePath desktop();
+ base::FilePath startup();
+ base::FilePath applications();
+@@ -322,7 +322,7 @@ class OsIntegrationTestOverrideImpl : public OsIntegra
+ base::ScopedTempDir chrome_apps_folder_;
+ std::map<base::FilePath, bool> startup_enabled_;
+
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::ScopedTempDir desktop_;
+ base::ScopedTempDir startup_;
+ base::ScopedTempDir xdg_data_home_dir_;
diff --git a/devel/electron31/files/patch-chrome_browser_web__applications_web__app__helpers.cc b/devel/electron31/files/patch-chrome_browser_web__applications_web__app__helpers.cc
new file mode 100644
index 000000000000..424d9f438021
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_web__applications_web__app__helpers.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/web_applications/web_app_helpers.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/web_applications/web_app_helpers.cc
+@@ -145,7 +145,7 @@ bool IsValidWebAppUrl(const GURL& app_url) {
+ return false;
+
+ bool allow_extension_apps = true;
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Stop allowing apps to be extension urls when the shortcuts are separated -
+ // they can be extension urls instead.
+ allow_extension_apps =
diff --git a/devel/electron31/files/patch-chrome_browser_web__applications_web__app__install__info.h b/devel/electron31/files/patch-chrome_browser_web__applications_web__app__install__info.h
new file mode 100644
index 000000000000..bdfc02653467
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_web__applications_web__app__install__info.h
@@ -0,0 +1,11 @@
+--- chrome/browser/web_applications/web_app_install_info.h.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/web_applications/web_app_install_info.h
+@@ -35,7 +35,7 @@ static_assert(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) |
+ #include "url/gurl.h"
+
+ static_assert(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+- BUILDFLAG(IS_CHROMEOS));
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD));
+
+ namespace web_app {
+
diff --git a/devel/electron31/files/patch-chrome_browser_webauthn_chrome__authenticator__request__delegate.cc b/devel/electron31/files/patch-chrome_browser_webauthn_chrome__authenticator__request__delegate.cc
new file mode 100644
index 000000000000..c47dff4b5311
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_webauthn_chrome__authenticator__request__delegate.cc
@@ -0,0 +1,11 @@
+--- chrome/browser/webauthn/chrome_authenticator_request_delegate.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/webauthn/chrome_authenticator_request_delegate.cc
+@@ -916,7 +916,7 @@ void ChromeAuthenticatorRequestDelegate::ConfigureDisc
+ g_observer->ConfiguringCable(request_type);
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // No caBLEv1 on Linux. It tends to crash bluez.
+ if (base::Contains(pairings_from_extension,
+ device::CableDiscoveryData::Version::V1,
diff --git a/devel/electron31/files/patch-chrome_browser_webauthn_enclave__manager.cc b/devel/electron31/files/patch-chrome_browser_webauthn_enclave__manager.cc
new file mode 100644
index 000000000000..80b816d012a7
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_browser_webauthn_enclave__manager.cc
@@ -0,0 +1,20 @@
+--- chrome/browser/webauthn/enclave_manager.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/browser/webauthn/enclave_manager.cc
+@@ -652,7 +652,7 @@ std::string UserVerifyingLabelToString(crypto::UserVer
+ }
+
+ std::string UserVerifyingLabelToString(crypto::UserVerifyingKeyLabel label) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return label;
+ #else
+ return std::string("placeholder");
+@@ -661,7 +661,7 @@ std::optional<crypto::UserVerifyingKeyLabel> UserVerif
+
+ std::optional<crypto::UserVerifyingKeyLabel> UserVerifyingKeyLabelFromString(
+ std::string saved_label) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return saved_label;
+ #else
+ return std::nullopt;
diff --git a/devel/electron31/files/patch-chrome_common_channel__info.h b/devel/electron31/files/patch-chrome_common_channel__info.h
new file mode 100644
index 000000000000..6d723142ea56
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_common_channel__info.h
@@ -0,0 +1,20 @@
+--- chrome/common/channel_info.h.orig 2024-06-18 21:43:25 UTC
++++ chrome/common/channel_info.h
+@@ -12,7 +12,7 @@
+ #include "build/build_config.h"
+ #include "build/chromeos_buildflags.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ namespace base {
+ class Environment;
+ }
+@@ -100,7 +100,7 @@ std::string GetChannelSuffixForDataDir();
+ std::string GetChannelSuffixForDataDir();
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::string GetChannelSuffixForExtraFlagsEnvVarName();
+
+ // Returns the channel-specific filename of the desktop shortcut used to launch
diff --git a/devel/electron31/files/patch-chrome_common_channel__info__posix.cc b/devel/electron31/files/patch-chrome_common_channel__info__posix.cc
new file mode 100644
index 000000000000..f56dcddf6fde
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_common_channel__info__posix.cc
@@ -0,0 +1,20 @@
+--- chrome/common/channel_info_posix.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/common/channel_info_posix.cc
+@@ -93,7 +93,7 @@ std::string GetChannelSuffixForDataDir() {
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::string GetChannelSuffixForExtraFlagsEnvVarName() {
+ #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ const auto channel_state = GetChannelImpl();
+@@ -121,7 +121,7 @@ std::string GetChannelSuffixForExtraFlagsEnvVarName()
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ std::string GetDesktopName(base::Environment* env) {
+ #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ // Google Chrome packaged as a snap is a special case: the application name
diff --git a/devel/electron31/files/patch-chrome_common_chrome__features.cc b/devel/electron31/files/patch-chrome_common_chrome__features.cc
new file mode 100644
index 000000000000..8cf25db9e8b5
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_common_chrome__features.cc
@@ -0,0 +1,74 @@
+--- chrome/common/chrome_features.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/common/chrome_features.cc
+@@ -81,7 +81,7 @@ BASE_FEATURE(kUseAdHocSigningForWebAppShims,
+ #endif // BUILDFLAG(IS_MAC)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Enables or disables the Autofill survey triggered by opening a prompt to
+ // save address info.
+ BASE_FEATURE(kAutofillAddressSurvey,
+@@ -99,7 +99,7 @@ BASE_FEATURE(kAutofillPasswordSurvey,
+ base::FEATURE_DISABLED_BY_DEFAULT);
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Enables the Restart background mode optimization. When all Chrome UI is
+ // closed and it goes in the background, allows to restart the browser to
+ // discard memory.
+@@ -282,7 +282,7 @@ BASE_FEATURE(kDesktopPWAsRunOnOsLogin,
+ BASE_FEATURE(kDesktopPWAsRunOnOsLogin,
+ "DesktopPWAsRunOnOsLogin",
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -324,7 +324,7 @@ BASE_FEATURE(kDesktopPWAsTabStripSettings,
+ "DesktopPWAsTabStripSettings",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Controls whether Chrome Apps are supported. See https://crbug.com/1221251.
+ // If the feature is disabled, Chrome Apps continue to work. If enabled, Chrome
+ // Apps will not launch and will be marked in the UI as deprecated.
+@@ -346,7 +346,7 @@ BASE_FEATURE(kDnsOverHttps,
+ BASE_FEATURE(kDnsOverHttps,
+ "DnsOverHttps",
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -362,7 +362,7 @@ const base::FeatureParam<bool> kDnsOverHttpsShowUiPara
+ const base::FeatureParam<bool> kDnsOverHttpsShowUiParam{&kDnsOverHttps,
+ "ShowUi",
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ true
+ #else
+ false
+@@ -887,7 +887,7 @@ BASE_FEATURE(kKAnonymityServiceStorage,
+ "KAnonymityServiceStorage",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kLinuxLowMemoryMonitor,
+ "LinuxLowMemoryMonitor",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+@@ -900,7 +900,7 @@ constexpr base::FeatureParam<int> kLinuxLowMemoryMonit
+ &kLinuxLowMemoryMonitor, "critical_level", 255};
+ #endif // BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kListWebAppsSwitch,
+ "ListWebAppsSwitch",
+ base::FEATURE_DISABLED_BY_DEFAULT);
diff --git a/devel/electron31/files/patch-chrome_common_chrome__features.h b/devel/electron31/files/patch-chrome_common_chrome__features.h
new file mode 100644
index 000000000000..7456ddc3636c
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_common_chrome__features.h
@@ -0,0 +1,45 @@
+--- chrome/common/chrome_features.h.orig 2024-06-18 21:43:25 UTC
++++ chrome/common/chrome_features.h
+@@ -60,13 +60,13 @@ BASE_DECLARE_FEATURE(kUseAdHocSigningForWebAppShims);
+ #endif // BUILDFLAG(IS_MAC)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(CHROME_FEATURES) BASE_DECLARE_FEATURE(kAutofillAddressSurvey);
+ COMPONENT_EXPORT(CHROME_FEATURES) BASE_DECLARE_FEATURE(kAutofillCardSurvey);
+ COMPONENT_EXPORT(CHROME_FEATURES) BASE_DECLARE_FEATURE(kAutofillPasswordSurvey);
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(CHROME_FEATURES)
+ BASE_DECLARE_FEATURE(kBackgroundModeAllowRestart);
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+@@ -197,7 +197,7 @@ BASE_DECLARE_FEATURE(kDesktopPWAsTabStripSettings);
+ COMPONENT_EXPORT(CHROME_FEATURES)
+ BASE_DECLARE_FEATURE(kDesktopPWAsTabStripSettings);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(CHROME_FEATURES) BASE_DECLARE_FEATURE(kChromeAppsDeprecation);
+ COMPONENT_EXPORT(CHROME_FEATURES)
+ BASE_DECLARE_FEATURE(kShortcutsNotApps);
+@@ -527,7 +527,7 @@ BASE_DECLARE_FEATURE(kKAnonymityServiceStorage);
+ COMPONENT_EXPORT(CHROME_FEATURES)
+ BASE_DECLARE_FEATURE(kKAnonymityServiceStorage);
+
+-#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(CHROME_FEATURES) BASE_DECLARE_FEATURE(kLinuxLowMemoryMonitor);
+ COMPONENT_EXPORT(CHROME_FEATURES)
+ extern const base::FeatureParam<int> kLinuxLowMemoryMonitorModerateLevel;
+@@ -535,7 +535,7 @@ extern const base::FeatureParam<int> kLinuxLowMemoryMo
+ extern const base::FeatureParam<int> kLinuxLowMemoryMonitorCriticalLevel;
+ #endif // BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(CHROME_FEATURES) BASE_DECLARE_FEATURE(kListWebAppsSwitch);
+ #endif
+
diff --git a/devel/electron31/files/patch-chrome_common_chrome__paths.cc b/devel/electron31/files/patch-chrome_common_chrome__paths.cc
new file mode 100644
index 000000000000..118d5f81ca60
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_common_chrome__paths.cc
@@ -0,0 +1,84 @@
+--- chrome/common/chrome_paths.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/common/chrome_paths.cc
+@@ -30,7 +30,7 @@
+ #include "base/apple/foundation_util.h"
+ #endif
+
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_OPENBSD)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
+ #include "components/policy/core/common/policy_paths.h"
+ #endif
+
+@@ -52,14 +52,14 @@ namespace {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // The path to the external extension <id>.json files.
+ // /usr/share seems like a good choice, see: http://www.pathname.com/fhs/
+ const base::FilePath::CharType kFilepathSinglePrefExtensions[] =
+ #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+- FILE_PATH_LITERAL("/usr/share/google-chrome/extensions");
++ FILE_PATH_LITERAL("/usr/local/share/chromium/extensions");
+ #else
+- FILE_PATH_LITERAL("/usr/share/chromium/extensions");
++ FILE_PATH_LITERAL("/usr/local/share/chromium/extensions");
+ #endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
+
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+@@ -225,7 +225,7 @@ bool PathProvider(int key, base::FilePath* result) {
+ }
+ break;
+ case chrome::DIR_DEFAULT_DOWNLOADS_SAFE:
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (!GetUserDownloadsDirectorySafe(&cur)) {
+ return false;
+ }
+@@ -541,7 +541,7 @@ bool PathProvider(int key, base::FilePath* result) {
+ return false;
+ }
+ break;
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_OPENBSD)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
+ case chrome::DIR_POLICY_FILES: {
+ cur = base::FilePath(policy::kPolicyPath);
+ break;
+@@ -552,7 +552,7 @@ bool PathProvider(int key, base::FilePath* result) {
+ #if BUILDFLAG(IS_CHROMEOS_ASH) || \
+ ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \
+ BUILDFLAG(CHROMIUM_BRANDING)) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ case chrome::DIR_USER_EXTERNAL_EXTENSIONS: {
+ if (!base::PathService::Get(chrome::DIR_USER_DATA, &cur)) {
+ return false;
+@@ -561,7 +561,7 @@ bool PathProvider(int key, base::FilePath* result) {
+ break;
+ }
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ case chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS: {
+ cur = base::FilePath(kFilepathSinglePrefExtensions);
+ break;
+@@ -599,7 +599,7 @@ bool PathProvider(int key, base::FilePath* result) {
+ break;
+
+ #if BUILDFLAG(ENABLE_EXTENSIONS) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD))
+ case chrome::DIR_NATIVE_MESSAGING:
+ #if BUILDFLAG(IS_MAC)
+ #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+@@ -613,6 +613,9 @@ bool PathProvider(int key, base::FilePath* result) {
+ #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ cur = base::FilePath(
+ FILE_PATH_LITERAL("/etc/opt/chrome/native-messaging-hosts"));
++#elif BUILDFLAG(IS_FREEBSD)
++ cur = base::FilePath(FILE_PATH_LITERAL(
++ "/usr/local/etc/chromium/native-messaging-hosts"));
+ #else
+ cur = base::FilePath(
+ FILE_PATH_LITERAL("/etc/chromium/native-messaging-hosts"));
diff --git a/devel/electron31/files/patch-chrome_common_chrome__paths.h b/devel/electron31/files/patch-chrome_common_chrome__paths.h
new file mode 100644
index 000000000000..77c60842b564
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_common_chrome__paths.h
@@ -0,0 +1,29 @@
+--- chrome/common/chrome_paths.h.orig 2024-02-21 00:20:37 UTC
++++ chrome/common/chrome_paths.h
+@@ -59,7 +59,7 @@ enum {
+ #if BUILDFLAG(IS_CHROMEOS_ASH) || \
+ ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \
+ BUILDFLAG(CHROMIUM_BRANDING)) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ DIR_USER_EXTERNAL_EXTENSIONS, // Directory for per-user external extensions
+ // on Chrome Mac and Chromium Linux.
+ // On Chrome OS, this path is used for OEM
+@@ -67,7 +67,7 @@ enum {
+ // create it.
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ DIR_STANDALONE_EXTERNAL_EXTENSIONS, // Directory for 'per-extension'
+ // definition manifest files that
+ // describe extensions which are to be
+@@ -126,7 +126,7 @@ enum {
+
+ #endif
+ #if BUILDFLAG(ENABLE_EXTENSIONS) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD))
+ DIR_NATIVE_MESSAGING, // System directory where native messaging host
+ // manifest files are stored.
+ DIR_USER_NATIVE_MESSAGING, // Directory with Native Messaging Hosts
diff --git a/devel/electron31/files/patch-chrome_common_chrome__paths__internal.h b/devel/electron31/files/patch-chrome_common_chrome__paths__internal.h
new file mode 100644
index 000000000000..85641ebae453
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_common_chrome__paths__internal.h
@@ -0,0 +1,11 @@
+--- chrome/common/chrome_paths_internal.h.orig 2023-05-25 00:41:46 UTC
++++ chrome/common/chrome_paths_internal.h
+@@ -43,7 +43,7 @@ void GetUserCacheDirectory(const base::FilePath& profi
+ // Get the path to the user's documents directory.
+ bool GetUserDocumentsDirectory(base::FilePath* result);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Gets the path to a safe default download directory for a user.
+ bool GetUserDownloadsDirectorySafe(base::FilePath* result);
+ #endif
diff --git a/devel/electron31/files/patch-chrome_common_chrome__switches.cc b/devel/electron31/files/patch-chrome_common_chrome__switches.cc
new file mode 100644
index 000000000000..227a3dd1153c
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_common_chrome__switches.cc
@@ -0,0 +1,19 @@
+--- chrome/common/chrome_switches.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/common/chrome_switches.cc
+@@ -863,14 +863,14 @@ const char kAllowNaClSocketAPI[] = "allow-nacl-socket-
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ const char kEnableNewAppMenuIcon[] = "enable-new-app-menu-icon";
+
+ // Causes the browser to launch directly in guest mode.
+ const char kGuest[] = "guest";
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Writes open and installed web apps for each profile to the specified file
+ // without launching a new browser window or tab. Pass a absolute file path to
+ // specify where to output the information. Can be used together with optional
diff --git a/devel/electron31/files/patch-chrome_common_chrome__switches.h b/devel/electron31/files/patch-chrome_common_chrome__switches.h
new file mode 100644
index 000000000000..fc0553b6aa3b
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_common_chrome__switches.h
@@ -0,0 +1,17 @@
+--- chrome/common/chrome_switches.h.orig 2024-06-18 21:43:25 UTC
++++ chrome/common/chrome_switches.h
+@@ -273,12 +273,12 @@ extern const char kAllowNaClSocketAPI[];
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ extern const char kEnableNewAppMenuIcon[];
+ extern const char kGuest[];
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ extern const char kListApps[];
+ extern const char kProfileBaseName[];
+ extern const char kProfileManagementAttributes[];
diff --git a/devel/electron31/files/patch-chrome_common_extensions_permissions_chrome__permission__message__rules.cc b/devel/electron31/files/patch-chrome_common_extensions_permissions_chrome__permission__message__rules.cc
new file mode 100644
index 000000000000..80a2b15f15dd
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_common_extensions_permissions_chrome__permission__message__rules.cc
@@ -0,0 +1,11 @@
+--- chrome/common/extensions/permissions/chrome_permission_message_rules.cc.orig 2022-11-30 08:12:58 UTC
++++ chrome/common/extensions/permissions/chrome_permission_message_rules.cc
+@@ -285,7 +285,7 @@ int GetEnterpriseReportingPrivatePermissionMessageId()
+ }
+ #if BUILDFLAG(IS_WIN)
+ return IDS_EXTENSION_PROMPT_WARNING_ENTERPRISE_REPORTING_PRIVATE_ENABLED_WIN;
+-#elif BUILDFLAG(IS_LINUX) or BUILDFLAG(IS_MAC)
++#elif BUILDFLAG(IS_LINUX) or BUILDFLAG(IS_MAC) or BUILDFLAG(IS_BSD)
+ return IDS_EXTENSION_PROMPT_WARNING_ENTERPRISE_REPORTING_PRIVATE_ENABLED_LINUX_AND_MACOS;
+ #else
+ return IDS_EXTENSION_PROMPT_WARNING_ENTERPRISE_REPORTING_PRIVATE;
diff --git a/devel/electron31/files/patch-chrome_common_media_cdm__host__file__path.cc b/devel/electron31/files/patch-chrome_common_media_cdm__host__file__path.cc
new file mode 100644
index 000000000000..3b4f828a367e
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_common_media_cdm__host__file__path.cc
@@ -0,0 +1,11 @@
+--- chrome/common/media/cdm_host_file_path.cc.orig 2023-02-01 18:43:13 UTC
++++ chrome/common/media/cdm_host_file_path.cc
+@@ -90,7 +90,7 @@ void AddCdmHostFilePaths(
+ cdm_host_file_paths->emplace_back(chrome_framework_path,
+ chrome_framework_sig_path);
+
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ base::FilePath chrome_exe_dir;
+ if (!base::PathService::Get(base::DIR_EXE, &chrome_exe_dir))
diff --git a/devel/electron31/files/patch-chrome_common_media_cdm__registration.cc b/devel/electron31/files/patch-chrome_common_media_cdm__registration.cc
new file mode 100644
index 000000000000..8bd2d43a13c1
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_common_media_cdm__registration.cc
@@ -0,0 +1,61 @@
+--- chrome/common/media/cdm_registration.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/common/media/cdm_registration.cc
+@@ -30,11 +30,11 @@
+
+ #if BUILDFLAG(ENABLE_WIDEVINE)
+ #include "third_party/widevine/cdm/widevine_cdm_common.h" // nogncheck
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "base/native_library.h"
+ #include "chrome/common/chrome_paths.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/no_destructor.h"
+ #include "chrome/common/media/component_widevine_cdm_hint_file_linux.h"
+ #include "media/cdm/supported_audio_codecs.h"
+@@ -60,7 +60,7 @@ using Robustness = content::CdmInfo::Robustness;
+ #if BUILDFLAG(ENABLE_WIDEVINE)
+ #if (BUILDFLAG(BUNDLE_WIDEVINE_CDM) || \
+ BUILDFLAG(ENABLE_WIDEVINE_CDM_COMPONENT)) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
+ // Create a CdmInfo for a Widevine CDM, using |version|, |cdm_library_path|, and
+ // |capability|.
+ std::unique_ptr<content::CdmInfo> CreateWidevineCdmInfo(
+@@ -105,7 +105,7 @@ std::unique_ptr<content::CdmInfo> CreateCdmInfoFromWid
+ // BUILDFLAG(IS_CHROMEOS))
+
+ #if BUILDFLAG(BUNDLE_WIDEVINE_CDM) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
+ // On Linux/ChromeOS we have to preload the CDM since it uses the zygote
+ // sandbox. On Windows and Mac, CDM registration is handled by Component
+ // Update (as the CDM can be loaded only when needed).
+@@ -129,7 +129,7 @@ content::CdmInfo* GetBundledWidevine() {
+ // (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
+
+ #if BUILDFLAG(ENABLE_WIDEVINE_CDM_COMPONENT) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
+ // This code checks to see if Component Updater picked a version of the Widevine
+ // CDM to be used last time it ran. (Component Updater may choose the bundled
+ // CDM if there is not a new version available for download.) If there is one
+@@ -171,7 +171,7 @@ void AddSoftwareSecureWidevine(std::vector<content::Cd
+ /*supports_sub_key_systems=*/false, kWidevineCdmDisplayName,
+ kWidevineCdmType, base::Version(), base::FilePath());
+
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION)
+ base::Version glibc_version(gnu_get_libc_version());
+ DCHECK(glibc_version.IsValid());
+@@ -429,7 +429,7 @@ void RegisterCdmInfo(std::vector<content::CdmInfo>* cd
+ DVLOG(3) << __func__ << " done with " << cdms->size() << " cdms";
+ }
+
+-#if BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(ENABLE_WIDEVINE) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))
+ std::vector<content::CdmInfo> GetSoftwareSecureWidevineForTesting() {
+ std::vector<content::CdmInfo> cdms;
+ AddSoftwareSecureWidevine(&cdms);
diff --git a/devel/electron31/files/patch-chrome_common_media_cdm__registration.h b/devel/electron31/files/patch-chrome_common_media_cdm__registration.h
new file mode 100644
index 000000000000..bd584de5e83f
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_common_media_cdm__registration.h
@@ -0,0 +1,11 @@
+--- chrome/common/media/cdm_registration.h.orig 2024-06-18 21:43:25 UTC
++++ chrome/common/media/cdm_registration.h
+@@ -14,7 +14,7 @@ void RegisterCdmInfo(std::vector<content::CdmInfo>* cd
+ // Register CdmInfo for Content Decryption Modules (CDM) supported.
+ void RegisterCdmInfo(std::vector<content::CdmInfo>* cdms);
+
+-#if BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(ENABLE_WIDEVINE) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))
+ // Returns the software secure Widevine CDM.
+ std::vector<content::CdmInfo> GetSoftwareSecureWidevineForTesting();
+ #endif
diff --git a/devel/electron31/files/patch-chrome_common_media_component__widevine__cdm__hint__file__linux.h b/devel/electron31/files/patch-chrome_common_media_component__widevine__cdm__hint__file__linux.h
new file mode 100644
index 000000000000..cb394c4c7f5d
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_common_media_component__widevine__cdm__hint__file__linux.h
@@ -0,0 +1,11 @@
+--- chrome/common/media/component_widevine_cdm_hint_file_linux.h.orig 2024-06-18 21:43:25 UTC
++++ chrome/common/media/component_widevine_cdm_hint_file_linux.h
+@@ -17,7 +17,7 @@
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
++#if !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
+ #error "This file only applies to desktop Linux and ChromeOS."
+ #endif
+
diff --git a/devel/electron31/files/patch-chrome_common_pref__names.h b/devel/electron31/files/patch-chrome_common_pref__names.h
new file mode 100644
index 000000000000..32e3f38e3338
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_common_pref__names.h
@@ -0,0 +1,91 @@
+--- chrome/common/pref_names.h.orig 2024-06-18 21:43:25 UTC
++++ chrome/common/pref_names.h
+@@ -1313,7 +1313,7 @@ inline constexpr char kUseAshProxy[] = "lacros.proxy.u
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Linux specific preference on whether we should match the system theme.
+ inline constexpr char kSystemTheme[] = "extensions.theme.system_theme";
+ #endif
+@@ -1457,7 +1457,7 @@ inline constexpr char kShowUpdatePromotionInfoBar[] =
+ "browser.show_update_promotion_info_bar";
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Boolean that is false if we should show window manager decorations. If
+ // true, we draw a custom chrome frame (thicker title bar and blue border).
+ inline constexpr char kUseCustomChromeFrame[] = "browser.custom_chrome_frame";
+@@ -2069,7 +2069,7 @@ inline constexpr char kDownloadDirUpgraded[] = "downlo
+ inline constexpr char kDownloadDirUpgraded[] = "download.directory_upgrade";
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ inline constexpr char kOpenPdfDownloadInSystemReader[] =
+ "download.open_pdf_in_system_reader";
+ #endif
+@@ -2505,14 +2505,14 @@ inline constexpr char kMediaCdmOriginData[] = "media.c
+ inline constexpr char kMediaCdmOriginData[] = "media.cdm.origin_data";
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // A boolean pref to determine whether or not the network service is running
+ // sandboxed.
+ inline constexpr char kNetworkServiceSandboxEnabled[] =
+ "net.network_service_sandbox";
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Records whether the user has seen an HTTP auth "negotiate" header.
+ inline constexpr char kReceivedHttpAuthNegotiateHeader[] =
+ "net.received_http_auth_negotiate_headers";
+@@ -2590,7 +2590,7 @@ inline constexpr char kBasicAuthOverHttpEnabled[] =
+ inline constexpr char kBasicAuthOverHttpEnabled[] =
+ "auth.basic_over_http_enabled";
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Boolean that specifies whether OK-AS-DELEGATE flag from KDC is respected
+ // along with kAuthNegotiateDelegateAllowlist.
+ inline constexpr char kAuthNegotiateDelegateByKdcPolicy[] =
+@@ -3104,7 +3104,7 @@ inline constexpr char kDeviceWeeklyScheduledSuspend[]
+
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Defines administrator-set availability of Chrome for Testing.
+ inline constexpr char kChromeForTestingAllowed[] = "chrome_for_testing.allowed";
+ #endif
+@@ -3673,7 +3673,7 @@ inline constexpr char kSandboxExternalProtocolBlocked[
+ inline constexpr char kSandboxExternalProtocolBlocked[] =
+ "profile.sandbox_external_protocol_blocked";
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Boolean that indicates if system notifications are allowed to be used in
+ // place of Chrome notifications.
+ inline constexpr char kAllowSystemNotifications[] =
+@@ -3722,7 +3722,7 @@ inline constexpr char kCACertificateManagementAllowed[
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ inline constexpr char kEnforceLocalAnchorConstraintsEnabled[] =
+ "enforce_local_anchor_constraints_enabled";
+ #endif
+@@ -4021,7 +4021,7 @@ inline constexpr char kPrintingOAuth2AuthorizationServ
+ "printing.oauth2_authorization_servers";
+ #endif
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // If this exists and is true, Chrome may run system DNS resolution out of the
+ // network process. If false, Chrome will run system DNS resolution in the
+ // network process. If non-existent, Chrome will decide where to run system DNS
diff --git a/devel/electron31/files/patch-chrome_common_url__constants.h b/devel/electron31/files/patch-chrome_common_url__constants.h
new file mode 100644
index 000000000000..4d53bbd9d5da
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_common_url__constants.h
@@ -0,0 +1,11 @@
+--- chrome/common/url_constants.h.orig 2024-06-18 21:43:25 UTC
++++ chrome/common/url_constants.h
+@@ -888,7 +888,7 @@ inline constexpr char kPhoneHubPermissionLearnMoreURL[
+ inline constexpr char kPhoneHubPermissionLearnMoreURL[] =
+ "https://support.google.com/chromebook?p=multidevice";
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // "Learn more" URL for the chrome apps deprecation dialog.
+ inline constexpr char kChromeAppsDeprecationLearnMoreURL[] =
+ "https://support.google.com/chrome?p=chrome_app_deprecation";
diff --git a/devel/electron31/files/patch-chrome_common_webui__url__constants.cc b/devel/electron31/files/patch-chrome_common_webui__url__constants.cc
new file mode 100644
index 000000000000..5777de8288df
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_common_webui__url__constants.cc
@@ -0,0 +1,94 @@
+--- chrome/common/webui_url_constants.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/common/webui_url_constants.cc
+@@ -518,18 +518,18 @@ const char kOsUIVersionURL[] = "os://version";
+ const char kOsUIVersionURL[] = "os://version";
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kChromeUIWebUIJsErrorHost[] = "webuijserror";
+ const char kChromeUIWebUIJsErrorURL[] = "chrome://webuijserror/";
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ const char kChromeUIConnectorsInternalsHost[] = "connectors-internals";
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kChromeUIDiscardsHost[] = "discards";
+ const char kChromeUIDiscardsURL[] = "chrome://discards/";
+ #endif
+@@ -544,14 +544,14 @@ const char kChromeUILinuxProxyConfigHost[] = "linux-pr
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ const char kChromeUISandboxHost[] = "sandbox";
+ #endif
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ const char kChromeUIBrowserSwitchHost[] = "browser-switch";
+ const char kChromeUIBrowserSwitchURL[] = "chrome://browser-switch/";
+ const char kChromeUIIntroHost[] = "intro";
+@@ -570,7 +570,7 @@ const char kChromeUIProfilePickerStartupQuery[] = "sta
+ const char kChromeUIProfilePickerStartupQuery[] = "startup";
+ #endif
+
+-#if ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \
++#if ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && \
+ defined(TOOLKIT_VIEWS)) || \
+ defined(USE_AURA)
+ const char kChromeUITabModalConfirmDialogHost[] = "tab-modal-confirm-dialog";
+@@ -649,7 +649,7 @@ const char kCookiesSubPagePath[] = "/cookies";
+ const char kCookiesSubPagePath[] = "/cookies";
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const char kChromeUIWebAppSettingsURL[] = "chrome://app-settings/";
+ const char kChromeUIWebAppSettingsHost[] = "app-settings";
+ #endif
+@@ -795,21 +795,21 @@ const char* const kChromeHostURLs[] = {
+ kChromeUIAssistantOptInHost,
+ #endif
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ kChromeUIConnectorsInternalsHost,
+ #endif
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ kChromeUIDiscardsHost,
+ #endif
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ kChromeUIWebAppSettingsHost,
+ #endif
+ #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_ANDROID)
+ kChromeUILinuxProxyConfigHost,
+ #endif
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ kChromeUISandboxHost,
+ #endif
+ #if BUILDFLAG(IS_WIN)
+@@ -876,7 +876,7 @@ const char* const kChromeDebugURLs[] = {
+ blink::kChromeUIGpuJavaCrashURL,
+ kChromeUIJavaCrashURL,
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ kChromeUIWebUIJsErrorURL,
+ #endif
+ kChromeUIQuitURL,
diff --git a/devel/electron31/files/patch-chrome_common_webui__url__constants.h b/devel/electron31/files/patch-chrome_common_webui__url__constants.h
new file mode 100644
index 000000000000..97738eb42775
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_common_webui__url__constants.h
@@ -0,0 +1,56 @@
+--- chrome/common/webui_url_constants.h.orig 2024-06-18 21:43:25 UTC
++++ chrome/common/webui_url_constants.h
+@@ -437,23 +437,23 @@ extern const char kOsUIVersionURL[];
+ extern const char kOsUIVersionURL[];
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ extern const char kChromeUIWebUIJsErrorHost[];
+ extern const char kChromeUIWebUIJsErrorURL[];
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ extern const char kChromeUIConnectorsInternalsHost[];
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ extern const char kChromeUIDiscardsHost[];
+ extern const char kChromeUIDiscardsURL[];
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ extern const char kChromeUIWebAppSettingsURL[];
+ extern const char kChromeUIWebAppSettingsHost[];
+ #endif
+@@ -468,14 +468,14 @@ extern const char kChromeUILinuxProxyConfigHost[];
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ extern const char kChromeUISandboxHost[];
+ #endif
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ extern const char kChromeUIBrowserSwitchHost[];
+ extern const char kChromeUIBrowserSwitchURL[];
+ extern const char kChromeUIIntroHost[];
+@@ -491,7 +491,7 @@ extern const char kChromeUIProfilePickerStartupQuery[]
+ extern const char kChromeUIProfilePickerStartupQuery[];
+ #endif
+
+-#if ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \
++#if ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && \
+ defined(TOOLKIT_VIEWS)) || \
+ defined(USE_AURA)
+ extern const char kChromeUITabModalConfirmDialogHost[];
diff --git a/devel/electron31/files/patch-chrome_services_file__util_public_mojom_safe__document__analyzer__mojom__traits.h b/devel/electron31/files/patch-chrome_services_file__util_public_mojom_safe__document__analyzer__mojom__traits.h
new file mode 100644
index 000000000000..21569f0e442a
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_services_file__util_public_mojom_safe__document__analyzer__mojom__traits.h
@@ -0,0 +1,11 @@
+--- chrome/services/file_util/public/mojom/safe_document_analyzer_mojom_traits.h.orig 2024-06-18 21:43:25 UTC
++++ chrome/services/file_util/public/mojom/safe_document_analyzer_mojom_traits.h
+@@ -17,7 +17,7 @@
+ #include "mojo/public/cpp/bindings/struct_traits.h"
+
+ #if !BUILDFLAG(FULL_SAFE_BROWSING) || \
+- (!BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_WIN))
++ (!BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_BSD))
+ #error FULL_SAFE_BROWSING should be set and either IS_LINUX or IS_WIN set.
+ #endif
+
diff --git a/devel/electron31/files/patch-chrome_services_printing_print__backend__service__impl.cc b/devel/electron31/files/patch-chrome_services_printing_print__backend__service__impl.cc
new file mode 100644
index 000000000000..e9aaae26fdb9
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_services_printing_print__backend__service__impl.cc
@@ -0,0 +1,47 @@
+--- chrome/services/printing/print_backend_service_impl.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/services/printing/print_backend_service_impl.cc
+@@ -49,7 +49,7 @@
+ #include "printing/backend/cups_connection_pool.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/no_destructor.h"
+ #include "ui/linux/linux_ui.h"
+ #include "ui/linux/linux_ui_delegate_stub.h"
+@@ -76,7 +76,7 @@ namespace {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void InstantiateLinuxUiDelegate() {
+ // TODO(crbug.com/40561724) Until a real UI can be used in a utility process,
+ // need to use the stub version.
+@@ -85,7 +85,7 @@ scoped_refptr<base::SequencedTaskRunner> GetPrintingTa
+ #endif
+
+ scoped_refptr<base::SequencedTaskRunner> GetPrintingTaskRunner() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Use task runner associated with equivalent of UI thread. Needed for calls
+ // made through `PrintDialogLinuxInterface` to properly execute.
+ CHECK(base::SequencedTaskRunner::HasCurrentDefault());
+@@ -469,7 +469,7 @@ void PrintBackendServiceImpl::Init(
+ // `InitCommon()`.
+ InitializeProcessForPrinting();
+ print_backend_ = PrintBackend::CreateInstance(locale);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Test framework already initializes the UI, so this should not go in
+ // `InitCommon()`. Additionally, low-level Linux UI is not needed when tests
+ // are using `TestPrintingContext`.
+@@ -690,7 +690,7 @@ void PrintBackendServiceImpl::UpdatePrintSettings(
+ crash_keys_ = std::make_unique<crash_keys::ScopedPrinterInfo>(
+ *printer_name, print_backend_->GetPrinterDriverInfo(*printer_name));
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_CUPS)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(USE_CUPS)
+ // Try to fill in advanced settings based upon basic info options.
+ PrinterBasicInfo basic_info;
+ if (print_backend_->GetPrinterBasicInfo(*printer_name, &basic_info) ==
diff --git a/devel/electron31/files/patch-chrome_services_speech_audio__source__fetcher__impl.cc b/devel/electron31/files/patch-chrome_services_speech_audio__source__fetcher__impl.cc
new file mode 100644
index 000000000000..20bfea5c7fe4
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_services_speech_audio__source__fetcher__impl.cc
@@ -0,0 +1,11 @@
+--- chrome/services/speech/audio_source_fetcher_impl.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/services/speech/audio_source_fetcher_impl.cc
+@@ -132,7 +132,7 @@ void AudioSourceFetcherImpl::Start(
+
+ // TODO(crbug.com/40753481): Check implementation / sandbox policy on Mac and
+ // Windows.
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ is_started_ = true;
+ // Initialize the AudioCapturerSource with |this| as the CaptureCallback,
+ // get the parameters for the device ID, then start audio capture.
diff --git a/devel/electron31/files/patch-chrome_test_base_scoped__channel__override__posix.cc b/devel/electron31/files/patch-chrome_test_base_scoped__channel__override__posix.cc
new file mode 100644
index 000000000000..163cb93e276a
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_test_base_scoped__channel__override__posix.cc
@@ -0,0 +1,11 @@
+--- chrome/test/base/scoped_channel_override_posix.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/test/base/scoped_channel_override_posix.cc
+@@ -45,7 +45,7 @@ std::string GetVersionExtra(ScopedChannelOverride::Cha
+ return "beta";
+ case ScopedChannelOverride::Channel::kDev:
+ return "unstable";
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ case ScopedChannelOverride::Channel::kCanary:
+ return "canary";
+ #endif // BUILDFLAG(IS_LINUX)
diff --git a/devel/electron31/files/patch-chrome_test_chromedriver_chrome__launcher.cc b/devel/electron31/files/patch-chrome_test_chromedriver_chrome__launcher.cc
new file mode 100644
index 000000000000..4f8af7b9f114
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_test_chromedriver_chrome__launcher.cc
@@ -0,0 +1,10 @@
+--- chrome/test/chromedriver/chrome_launcher.cc.orig 2023-11-29 21:39:54 UTC
++++ chrome/test/chromedriver/chrome_launcher.cc
+@@ -73,6 +73,7 @@
+ #include <fcntl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/wait.h>
+ #include <unistd.h>
+ #elif BUILDFLAG(IS_WIN)
+ #include <windows.h>
diff --git a/devel/electron31/files/patch-chrome_test_chromedriver_chrome_chrome__finder.cc b/devel/electron31/files/patch-chrome_test_chromedriver_chrome_chrome__finder.cc
new file mode 100644
index 000000000000..10e112a6408f
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_test_chromedriver_chrome_chrome__finder.cc
@@ -0,0 +1,29 @@
+--- chrome/test/chromedriver/chrome/chrome_finder.cc.orig 2023-11-29 21:39:54 UTC
++++ chrome/test/chromedriver/chrome/chrome_finder.cc
+@@ -58,7 +58,7 @@ void GetApplicationDirs(std::vector<base::FilePath>* l
+ installation_locations[i].Append(L"Chromium\\Application"));
+ }
+ }
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void GetApplicationDirs(std::vector<base::FilePath>* locations) {
+ // TODO: Respect users' PATH variables.
+ // Until then, we use an approximation of the most common defaults.
+@@ -125,7 +125,7 @@ std::vector<base::FilePath> GetChromeProgramNames() {
+ chrome::kGoogleChromeForTestingBrowserProcessExecutablePath),
+ base::FilePath(chrome::kGoogleChromeBrowserProcessExecutablePath),
+ base::FilePath(chrome::kChromiumBrowserProcessExecutablePath),
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::FilePath(chrome::kBrowserProcessExecutablePath),
+ base::FilePath("chrome"), // Chrome for Testing or Google Chrome
+ base::FilePath("google-chrome"), base::FilePath("chromium"),
+@@ -141,7 +141,7 @@ std::vector<base::FilePath> GetHeadlessShellProgramNam
+ return {
+ #if BUILDFLAG(IS_WIN)
+ base::FilePath(FILE_PATH_LITERAL("chrome-headless-shell.exe")),
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::FilePath("chrome-headless-shell"),
+ #else
+ // it will compile but won't work on other OSes
diff --git a/devel/electron31/files/patch-chrome_test_chromedriver_key__converter__unittest.cc b/devel/electron31/files/patch-chrome_test_chromedriver_key__converter__unittest.cc
new file mode 100644
index 000000000000..656e8e79e233
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_test_chromedriver_key__converter__unittest.cc
@@ -0,0 +1,20 @@
+--- chrome/test/chromedriver/key_converter_unittest.cc.orig 2022-03-25 21:59:56 UTC
++++ chrome/test/chromedriver/key_converter_unittest.cc
+@@ -246,7 +246,7 @@ TEST(KeyConverter, ToggleModifiers) {
+ CheckEventsReleaseModifiers(keys, key_events);
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Fails on bots: crbug.com/174962
+ #define MAYBE_AllEnglishKeyboardSymbols DISABLED_AllEnglishKeyboardSymbols
+ #else
+@@ -303,7 +303,7 @@ TEST(KeyConverter, AllEnglishKeyboardTextChars) {
+ TEST(KeyConverter, AllSpecialWebDriverKeysOnEnglishKeyboard) {
+ ui::ScopedKeyboardLayout keyboard_layout(ui::KEYBOARD_LAYOUT_ENGLISH_US);
+ const char kTextForKeys[] = {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ 0, 0, 0, 0, '\t', 0, '\r', '\r', 0, 0, 0, 0, 0,
+ #else
+ 0, 0, 0, 0, 0, 0, '\r', '\r', 0, 0, 0, 0, 0,
diff --git a/devel/electron31/files/patch-chrome_test_chromedriver_keycode__text__conversion__unittest.cc b/devel/electron31/files/patch-chrome_test_chromedriver_keycode__text__conversion__unittest.cc
new file mode 100644
index 000000000000..4b8b1206329b
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_test_chromedriver_keycode__text__conversion__unittest.cc
@@ -0,0 +1,20 @@
+--- chrome/test/chromedriver/keycode_text_conversion_unittest.cc.orig 2024-06-18 21:43:25 UTC
++++ chrome/test/chromedriver/keycode_text_conversion_unittest.cc
+@@ -67,7 +67,7 @@ std::string ConvertKeyCodeToTextNoError(ui::KeyboardCo
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Fails on bots: crbug.com/174962
+ #define MAYBE_KeyCodeToText DISABLED_KeyCodeToText
+ #else
+@@ -104,7 +104,7 @@ TEST(KeycodeTextConversionTest, MAYBE_KeyCodeToText) {
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Fails on bots: crbug.com/174962
+ #define MAYBE_CharToKeyCode DISABLED_CharToKeyCode
+ #else
diff --git a/devel/electron31/files/patch-chrome_updater_configurator.cc b/devel/electron31/files/patch-chrome_updater_configurator.cc
new file mode 100644
index 000000000000..7321c1c001d7
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_updater_configurator.cc
@@ -0,0 +1,11 @@
+--- chrome/updater/configurator.cc.orig 2024-02-21 00:20:39 UTC
++++ chrome/updater/configurator.cc
+@@ -67,7 +67,7 @@ Configurator::Configurator(scoped_refptr<UpdaterPrefs>
+ return std::nullopt;
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
+ }()) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On Linux creating the NetworkFetcherFactory requires performing blocking IO
+ // to load an external library. This should be done when the configurator is
+ // created.
diff --git a/devel/electron31/files/patch-chrome_updater_util_posix__util.cc b/devel/electron31/files/patch-chrome_updater_util_posix__util.cc
new file mode 100644
index 000000000000..6cd7f05b8cb6
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_updater_util_posix__util.cc
@@ -0,0 +1,11 @@
+--- chrome/updater/util/posix_util.cc.orig 2024-04-15 20:33:52 UTC
++++ chrome/updater/util/posix_util.cc
+@@ -20,7 +20,7 @@
+ #include "chrome/updater/updater_branding.h"
+ #include "chrome/updater/util/util.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/updater/util/linux_util.h"
+ #endif
+
diff --git a/devel/electron31/files/patch-chrome_utility_services.cc b/devel/electron31/files/patch-chrome_utility_services.cc
new file mode 100644
index 000000000000..bb0ba7b2df56
--- /dev/null
+++ b/devel/electron31/files/patch-chrome_utility_services.cc
@@ -0,0 +1,65 @@
+--- chrome/utility/services.cc.orig 2024-06-18 21:43:27 UTC
++++ chrome/utility/services.cc
+@@ -38,7 +38,7 @@
+ #include "services/screen_ai/screen_ai_service_impl.h" // nogncheck
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "services/passage_embeddings/passage_embeddings_service.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(LINUX)
+
+@@ -61,7 +61,7 @@
+ #include "chrome/services/system_signals/mac/mac_system_signals_service.h"
+ #endif // BUILDFLAG(IS_MAC)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/services/system_signals/linux/linux_system_signals_service.h"
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -82,7 +82,7 @@
+ #include "chrome/services/file_util/file_util_service.h" // nogncheck
+ #endif
+
+-#if BUILDFLAG(FULL_SAFE_BROWSING) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN))
++#if BUILDFLAG(FULL_SAFE_BROWSING) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)) || BUILDFLAG(IS_BSD)
+ #include "chrome/services/file_util/document_analysis_service.h" // nogncheck
+ #endif
+
+@@ -221,7 +221,7 @@ auto RunMacNotificationService(
+ }
+ #endif // BUILDFLAG(IS_MAC)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto RunPassageEmbeddingsService(
+ mojo::PendingReceiver<passage_embeddings::mojom::PassageEmbeddingsService>
+ receiver) {
+@@ -288,7 +288,7 @@ auto RunCupsIppParser(
+ }
+ #endif
+
+-#if BUILDFLAG(FULL_SAFE_BROWSING) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN))
++#if BUILDFLAG(FULL_SAFE_BROWSING) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)) || BUILDFLAG(IS_BSD)
+ auto RunDocumentAnalysis(
+ mojo::PendingReceiver<chrome::mojom::DocumentAnalysisService> receiver) {
+ return std::make_unique<DocumentAnalysisService>(std::move(receiver));
+@@ -494,7 +494,7 @@ void RegisterMainThreadServices(mojo::ServiceFactory&
+ services.Add(RunWindowsIconReader);
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ services.Add(RunPassageEmbeddingsService);
+ services.Add(RunSystemSignalsService);
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+@@ -511,7 +511,7 @@ void RegisterMainThreadServices(mojo::ServiceFactory&
+ services.Add(RunFileUtil);
+ #endif
+
+-#if BUILDFLAG(FULL_SAFE_BROWSING) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN))
++#if BUILDFLAG(FULL_SAFE_BROWSING) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)) || BUILDFLAG(IS_BSD)
+ services.Add(RunDocumentAnalysis);
+ #endif
+
diff --git a/devel/electron31/files/patch-chromecast_browser_cast__browser__main__parts.cc b/devel/electron31/files/patch-chromecast_browser_cast__browser__main__parts.cc
new file mode 100644
index 000000000000..562e01394acd
--- /dev/null
+++ b/devel/electron31/files/patch-chromecast_browser_cast__browser__main__parts.cc
@@ -0,0 +1,38 @@
+--- chromecast/browser/cast_browser_main_parts.cc.orig 2024-06-18 21:43:27 UTC
++++ chromecast/browser/cast_browser_main_parts.cc
+@@ -94,7 +94,7 @@
+ #include "ui/ozone/public/ozone_platform.h"
+ #endif // BUILDFLAG(IS_OZONE)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <fontconfig/fontconfig.h>
+ #include <signal.h>
+ #include <sys/prctl.h>
+@@ -267,7 +267,7 @@ class CastViewsDelegate : public views::ViewsDelegate
+
+ #endif // defined(USE_AURA)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ base::FilePath GetApplicationFontsDir() {
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
+@@ -313,7 +313,7 @@ const DefaultCommandLineSwitch kDefaultSwitches[] = {
+ {cc::switches::kDisableThreadedAnimation, ""},
+ #endif // BUILDFLAG(IS_ANDROID)
+ #endif // BUILDFLAG(IS_CAST_AUDIO_ONLY)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #if defined(ARCH_CPU_X86_FAMILY)
+ // This is needed for now to enable the x11 Ozone platform to work with
+ // current Linux/NVidia OpenGL drivers.
+@@ -490,7 +490,7 @@ void CastBrowserMainParts::ToolkitInitialized() {
+ views_delegate_ = std::make_unique<CastViewsDelegate>();
+ #endif // defined(USE_AURA)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::FilePath dir_font = GetApplicationFontsDir();
+ const FcChar8* dir_font_char8 =
+ reinterpret_cast<const FcChar8*>(dir_font.value().data());
diff --git a/devel/electron31/files/patch-chromecast_browser_cast__content__browser__client.cc b/devel/electron31/files/patch-chromecast_browser_cast__content__browser__client.cc
new file mode 100644
index 000000000000..32b429faafab
--- /dev/null
+++ b/devel/electron31/files/patch-chromecast_browser_cast__content__browser__client.cc
@@ -0,0 +1,11 @@
+--- chromecast/browser/cast_content_browser_client.cc.orig 2024-06-18 21:43:27 UTC
++++ chromecast/browser/cast_content_browser_client.cc
+@@ -431,7 +431,7 @@ void CastContentBrowserClient::AppendExtraCommandLineS
+ switches::kAudioOutputChannels));
+ }
+ } else if (process_type == switches::kGpuProcess) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Necessary for accelerated 2d canvas. By default on Linux, Chromium
+ // assumes GLES2 contexts can be lost to a power-save mode, which breaks GPU
+ // canvas apps.
diff --git a/devel/electron31/files/patch-chromecast_cast__core_runtime_browser_runtime__application__service__impl.cc b/devel/electron31/files/patch-chromecast_cast__core_runtime_browser_runtime__application__service__impl.cc
new file mode 100644
index 000000000000..bd8f0c7dda1c
--- /dev/null
+++ b/devel/electron31/files/patch-chromecast_cast__core_runtime_browser_runtime__application__service__impl.cc
@@ -0,0 +1,11 @@
+--- chromecast/cast_core/runtime/browser/runtime_application_service_impl.cc.orig 2024-06-18 21:43:27 UTC
++++ chromecast/cast_core/runtime/browser/runtime_application_service_impl.cc
+@@ -335,7 +335,7 @@ CastWebView::Scoped RuntimeApplicationServiceImpl::Cre
+ GetFlagEntry(feature::kCastCoreIsRemoteControlMode,
+ config_.extra_features(), /*default_value=*/false);
+ params->enabled_for_dev = IsEnabledForDev();
+-#if BUILDFLAG(ENABLE_CAST_RECEIVER) && BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(ENABLE_CAST_RECEIVER) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))
+ // cast_receiver::ApplicationControlsImpl constructs an instance of
+ // url_rewrite::UrlRequestRewriteRulesManager. CastWebContentsImpl should NOT
+ // construct its own instance, or UrlRequestRulesReceiver will crash when a
diff --git a/devel/electron31/files/patch-chromecast_media_base_default__monotonic__clock.cc b/devel/electron31/files/patch-chromecast_media_base_default__monotonic__clock.cc
new file mode 100644
index 000000000000..effe33ff128d
--- /dev/null
+++ b/devel/electron31/files/patch-chromecast_media_base_default__monotonic__clock.cc
@@ -0,0 +1,20 @@
+--- chromecast/media/base/default_monotonic_clock.cc.orig 2022-02-28 16:54:41 UTC
++++ chromecast/media/base/default_monotonic_clock.cc
+@@ -11,7 +11,7 @@
+ #include "base/time/time.h"
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chromecast/media/base/buildflags.h"
+ #endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS)
+@@ -28,7 +28,7 @@ std::unique_ptr<MonotonicClock> MonotonicClock::Create
+ return std::make_unique<DefaultMonotonicClock>();
+ }
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ int64_t MonotonicClockNow() {
+ timespec now = {0, 0};
+ #if BUILDFLAG(MEDIA_CLOCK_MONOTONIC_RAW)
diff --git a/devel/electron31/files/patch-components_autofill_core_browser_payments__data__manager.cc b/devel/electron31/files/patch-components_autofill_core_browser_payments__data__manager.cc
new file mode 100644
index 000000000000..0966645b2c3b
--- /dev/null
+++ b/devel/electron31/files/patch-components_autofill_core_browser_payments__data__manager.cc
@@ -0,0 +1,11 @@
+--- components/autofill/core/browser/payments_data_manager.cc.orig 2024-06-18 21:43:28 UTC
++++ components/autofill/core/browser/payments_data_manager.cc
+@@ -1064,7 +1064,7 @@ bool PaymentsDataManager::ShouldShowCardsFromAccountOp
+ // The feature is only for Linux, Windows, Mac, and Fuchsia.
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || \
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) || \
+ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FUCHSIA)
+ // This option should only be shown for users that have not enabled the Sync
+ // Feature and that have server credit cards available.
diff --git a/devel/electron31/files/patch-components_autofill_core_common_autofill__payments__features.cc b/devel/electron31/files/patch-components_autofill_core_common_autofill__payments__features.cc
new file mode 100644
index 000000000000..859346e9cfdc
--- /dev/null
+++ b/devel/electron31/files/patch-components_autofill_core_common_autofill__payments__features.cc
@@ -0,0 +1,11 @@
+--- components/autofill/core/common/autofill_payments_features.cc.orig 2024-06-18 21:43:28 UTC
++++ components/autofill/core/common/autofill_payments_features.cc
+@@ -257,7 +257,7 @@ bool ShouldShowImprovedUserConsentForCreditCardSave()
+ bool ShouldShowImprovedUserConsentForCreditCardSave() {
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || \
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
+ // The new user consent UI is fully launched on MacOS, Windows and Linux.
+ return true;
diff --git a/devel/electron31/files/patch-components_autofill_core_common_autofill__util.cc b/devel/electron31/files/patch-components_autofill_core_common_autofill__util.cc
new file mode 100644
index 000000000000..c9b681988681
--- /dev/null
+++ b/devel/electron31/files/patch-components_autofill_core_common_autofill__util.cc
@@ -0,0 +1,11 @@
+--- components/autofill/core/common/autofill_util.cc.orig 2024-06-18 21:43:28 UTC
++++ components/autofill/core/common/autofill_util.cc
+@@ -132,7 +132,7 @@ bool ShouldAutoselectFirstSuggestionOnArrowDown() {
+
+ bool ShouldAutoselectFirstSuggestionOnArrowDown() {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return true;
+ #else
+ return false;
diff --git a/devel/electron31/files/patch-components_commerce_core_commerce__feature__list.cc b/devel/electron31/files/patch-components_commerce_core_commerce__feature__list.cc
new file mode 100644
index 000000000000..395cd3706e2a
--- /dev/null
+++ b/devel/electron31/files/patch-components_commerce_core_commerce__feature__list.cc
@@ -0,0 +1,20 @@
+--- components/commerce/core/commerce_feature_list.cc.orig 2024-06-18 21:43:28 UTC
++++ components/commerce/core/commerce_feature_list.cc
+@@ -168,7 +168,7 @@ BASE_FEATURE(kPriceInsights,
+ "PriceInsights",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kPriceInsightsRegionLaunched,
+ "PriceInsightsRegionLaunched",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+@@ -248,7 +248,7 @@ BASE_FEATURE(kShoppingList, "ShoppingList", base::FEAT
+
+ BASE_FEATURE(kShoppingList, "ShoppingList", base::FEATURE_DISABLED_BY_DEFAULT);
+ #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_IOS)
++ BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kShoppingListRegionLaunched,
+ "ShoppingListRegionLaunched",
+ base::FEATURE_ENABLED_BY_DEFAULT);
diff --git a/devel/electron31/files/patch-components_constrained__window_constrained__window__views.cc b/devel/electron31/files/patch-components_constrained__window_constrained__window__views.cc
new file mode 100644
index 000000000000..d8ca3a3655f6
--- /dev/null
+++ b/devel/electron31/files/patch-components_constrained__window_constrained__window__views.cc
@@ -0,0 +1,11 @@
+--- components/constrained_window/constrained_window_views.cc.orig 2024-06-18 21:43:28 UTC
++++ components/constrained_window/constrained_window_views.cc
+@@ -350,7 +350,7 @@ bool PlatformClipsChildrenToViewport() {
+ }
+
+ bool PlatformClipsChildrenToViewport() {
+-#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return true;
+ #else
+ return false;
diff --git a/devel/electron31/files/patch-components_content__settings_core_browser_website__settings__registry.cc b/devel/electron31/files/patch-components_content__settings_core_browser_website__settings__registry.cc
new file mode 100644
index 000000000000..315e0e461243
--- /dev/null
+++ b/devel/electron31/files/patch-components_content__settings_core_browser_website__settings__registry.cc
@@ -0,0 +1,11 @@
+--- components/content_settings/core/browser/website_settings_registry.cc.orig 2024-02-21 00:20:40 UTC
++++ components/content_settings/core/browser/website_settings_registry.cc
+@@ -67,7 +67,7 @@ const WebsiteSettingsInfo* WebsiteSettingsRegistry::Re
+ #if BUILDFLAG(IS_WIN)
+ if (!(platform & PLATFORM_WINDOWS))
+ return nullptr;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!(platform & PLATFORM_LINUX))
+ return nullptr;
+ #elif BUILDFLAG(IS_MAC)
diff --git a/devel/electron31/files/patch-components_cookie__config_cookie__store__util.cc b/devel/electron31/files/patch-components_cookie__config_cookie__store__util.cc
new file mode 100644
index 000000000000..6cb3d6e291e0
--- /dev/null
+++ b/devel/electron31/files/patch-components_cookie__config_cookie__store__util.cc
@@ -0,0 +1,11 @@
+--- components/cookie_config/cookie_store_util.cc.orig 2024-02-21 00:20:40 UTC
++++ components/cookie_config/cookie_store_util.cc
+@@ -12,7 +12,7 @@ namespace cookie_config {
+ namespace cookie_config {
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ namespace {
+
+ // Use the operating system's mechanisms to encrypt cookies before writing
diff --git a/devel/electron31/files/patch-components_crash_core_app_BUILD.gn b/devel/electron31/files/patch-components_crash_core_app_BUILD.gn
new file mode 100644
index 000000000000..e0cd9494fc62
--- /dev/null
+++ b/devel/electron31/files/patch-components_crash_core_app_BUILD.gn
@@ -0,0 +1,43 @@
+--- components/crash/core/app/BUILD.gn.orig 2024-06-18 21:43:28 UTC
++++ components/crash/core/app/BUILD.gn
+@@ -82,6 +82,10 @@ static_library("app") {
+ ]
+ }
+
++ if (is_bsd) {
++ sources -= [ "crashpad.cc" ]
++ }
++
+ defines = [ "CRASH_IMPLEMENTATION" ]
+
+ public_deps = [ ":lib" ]
+@@ -95,7 +99,7 @@ static_library("app") {
+ "//third_party/crashpad/crashpad/util",
+ ]
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ sources += [ "crashpad_linux.cc" ]
+ data_deps = [ ":chrome_crashpad_handler" ]
+ }
+@@ -115,7 +119,7 @@ static_library("app") {
+ libs = [ "log" ]
+ }
+
+- if (is_android || is_linux || is_chromeos) {
++ if ((is_android || is_linux || is_chromeos) && !is_bsd) {
+ deps += [
+ "//base:base_static",
+ "//components/crash/core/common",
+@@ -245,11 +249,6 @@ if (is_mac || is_android || is_linux || is_chromeos) {
+ # define custom UserStreamDataSources.
+ executable("chrome_crashpad_handler") {
+ sources = [ "chrome_crashpad_handler.cc" ]
+-
+- deps = [
+- ":crashpad_handler_main",
+- "//third_party/crashpad/crashpad/handler",
+- ]
+
+ if (is_mac && (is_component_build || is_asan)) {
+ ldflags = [
diff --git a/devel/electron31/files/patch-components_crash_core_app_chrome__crashpad__handler.cc b/devel/electron31/files/patch-components_crash_core_app_chrome__crashpad__handler.cc
new file mode 100644
index 000000000000..a9adae723bc6
--- /dev/null
+++ b/devel/electron31/files/patch-components_crash_core_app_chrome__crashpad__handler.cc
@@ -0,0 +1,12 @@
+--- components/crash/core/app/chrome_crashpad_handler.cc.orig 2022-02-07 13:39:41 UTC
++++ components/crash/core/app/chrome_crashpad_handler.cc
+@@ -6,5 +6,9 @@
+ extern "C" int CrashpadHandlerMain(int argc, char* argv[]);
+
+ int main(int argc, char* argv[]) {
++#if defined(__OpenBSD__) || defined(__FreeBSD__)
++ return -1;
++#else
+ return CrashpadHandlerMain(argc, argv);
++#endif
+ }
diff --git a/devel/electron31/files/patch-components_crash_core_app_crashpad__handler__main.cc b/devel/electron31/files/patch-components_crash_core_app_crashpad__handler__main.cc
new file mode 100644
index 000000000000..219d1e41410c
--- /dev/null
+++ b/devel/electron31/files/patch-components_crash_core_app_crashpad__handler__main.cc
@@ -0,0 +1,20 @@
+--- components/crash/core/app/crashpad_handler_main.cc.orig 2024-02-21 00:20:40 UTC
++++ components/crash/core/app/crashpad_handler_main.cc
+@@ -10,7 +10,7 @@
+ #include "third_party/crashpad/crashpad/handler/handler_main.h"
+ #include "third_party/crashpad/crashpad/handler/user_stream_data_source.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "components/stability_report/user_stream_data_source_posix.h"
+ #endif
+
+@@ -31,7 +31,7 @@ __attribute__((visibility("default"), used)) int Crash
+ char* argv[]) {
+ crashpad::UserStreamDataSources user_stream_data_sources;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ user_stream_data_sources.push_back(
+ std::make_unique<stability_report::UserStreamDataSourcePosix>());
+ #endif
diff --git a/devel/electron31/files/patch-components_crash_core_browser_crash__upload__list__crashpad.cc b/devel/electron31/files/patch-components_crash_core_browser_crash__upload__list__crashpad.cc
new file mode 100644
index 000000000000..d4a1ed1d7daf
--- /dev/null
+++ b/devel/electron31/files/patch-components_crash_core_browser_crash__upload__list__crashpad.cc
@@ -0,0 +1,26 @@
+--- components/crash/core/browser/crash_upload_list_crashpad.cc.orig 2023-10-19 19:58:18 UTC
++++ components/crash/core/browser/crash_upload_list_crashpad.cc
+@@ -38,7 +38,9 @@ CrashUploadListCrashpad::~CrashUploadListCrashpad() =
+ std::vector<std::unique_ptr<UploadList::UploadInfo>>
+ CrashUploadListCrashpad::LoadUploadList() {
+ std::vector<crash_reporter::Report> reports;
++#if !BUILDFLAG(IS_BSD)
+ crash_reporter::GetReports(&reports);
++#endif
+
+ std::vector<std::unique_ptr<UploadInfo>> uploads;
+ for (const crash_reporter::Report& report : reports) {
+@@ -52,9 +54,13 @@ CrashUploadListCrashpad::LoadUploadList() {
+
+ void CrashUploadListCrashpad::ClearUploadList(const base::Time& begin,
+ const base::Time& end) {
++#if !BUILDFLAG(IS_BSD)
+ crash_reporter::ClearReportsBetween(begin, end);
++#endif
+ }
+
+ void CrashUploadListCrashpad::RequestSingleUpload(const std::string& local_id) {
++#if !BUILDFLAG(IS_BSD)
+ crash_reporter::RequestSingleCrashUpload(local_id);
++#endif
+ }
diff --git a/devel/electron31/files/patch-components_crash_core_common_BUILD.gn b/devel/electron31/files/patch-components_crash_core_common_BUILD.gn
new file mode 100644
index 000000000000..e10540b90e26
--- /dev/null
+++ b/devel/electron31/files/patch-components_crash_core_common_BUILD.gn
@@ -0,0 +1,11 @@
+--- components/crash/core/common/BUILD.gn.orig 2023-05-25 00:41:50 UTC
++++ components/crash/core/common/BUILD.gn
+@@ -9,7 +9,7 @@ import("//components/gwp_asan/buildflags/buildflags.gn
+
+ declare_args() {
+ # If set to true, this will stub out and disable the entire crash key system.
+- use_crash_key_stubs = is_fuchsia
++ use_crash_key_stubs = is_fuchsia || is_bsd
+ }
+
+ group("common") {
diff --git a/devel/electron31/files/patch-components_device__signals_core_browser_mock__signals__aggregator.h b/devel/electron31/files/patch-components_device__signals_core_browser_mock__signals__aggregator.h
new file mode 100644
index 000000000000..f9e075904ee8
--- /dev/null
+++ b/devel/electron31/files/patch-components_device__signals_core_browser_mock__signals__aggregator.h
@@ -0,0 +1,11 @@
+--- components/device_signals/core/browser/mock_signals_aggregator.h.orig 2023-08-10 01:48:40 UTC
++++ components/device_signals/core/browser/mock_signals_aggregator.h
+@@ -17,7 +17,7 @@ class MockSignalsAggregator : public SignalsAggregator
+ MockSignalsAggregator();
+ ~MockSignalsAggregator() override;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ MOCK_METHOD(void,
+ GetSignalsForUser,
+ (const UserContext&,
diff --git a/devel/electron31/files/patch-components_device__signals_core_browser_signals__aggregator.h b/devel/electron31/files/patch-components_device__signals_core_browser_signals__aggregator.h
new file mode 100644
index 000000000000..290cc0f1df04
--- /dev/null
+++ b/devel/electron31/files/patch-components_device__signals_core_browser_signals__aggregator.h
@@ -0,0 +1,11 @@
+--- components/device_signals/core/browser/signals_aggregator.h.orig 2023-08-10 01:48:40 UTC
++++ components/device_signals/core/browser/signals_aggregator.h
+@@ -22,7 +22,7 @@ class SignalsAggregator : public KeyedService {
+
+ ~SignalsAggregator() override = default;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Will asynchronously collect signals whose names are specified in the
+ // `request` object, and will also use a `user_context` to validate that the
+ // user has permissions to the device's signals. Invokes `callback` with the
diff --git a/devel/electron31/files/patch-components_device__signals_core_browser_signals__aggregator__impl.cc b/devel/electron31/files/patch-components_device__signals_core_browser_signals__aggregator__impl.cc
new file mode 100644
index 000000000000..093426c3376e
--- /dev/null
+++ b/devel/electron31/files/patch-components_device__signals_core_browser_signals__aggregator__impl.cc
@@ -0,0 +1,11 @@
+--- components/device_signals/core/browser/signals_aggregator_impl.cc.orig 2023-08-10 01:48:40 UTC
++++ components/device_signals/core/browser/signals_aggregator_impl.cc
+@@ -65,7 +65,7 @@ SignalsAggregatorImpl::SignalsAggregatorImpl(
+
+ SignalsAggregatorImpl::~SignalsAggregatorImpl() = default;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SignalsAggregatorImpl::GetSignalsForUser(
+ const UserContext& user_context,
+ const SignalsAggregationRequest& request,
diff --git a/devel/electron31/files/patch-components_device__signals_core_browser_signals__aggregator__impl.h b/devel/electron31/files/patch-components_device__signals_core_browser_signals__aggregator__impl.h
new file mode 100644
index 000000000000..52958644ed30
--- /dev/null
+++ b/devel/electron31/files/patch-components_device__signals_core_browser_signals__aggregator__impl.h
@@ -0,0 +1,11 @@
+--- components/device_signals/core/browser/signals_aggregator_impl.h.orig 2023-08-10 01:48:40 UTC
++++ components/device_signals/core/browser/signals_aggregator_impl.h
+@@ -29,7 +29,7 @@ class SignalsAggregatorImpl : public SignalsAggregator
+ ~SignalsAggregatorImpl() override;
+
+ // SignalsAggregator:
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void GetSignalsForUser(const UserContext& user_context,
+ const SignalsAggregationRequest& request,
+ GetSignalsCallback callback) override;
diff --git a/devel/electron31/files/patch-components_device__signals_core_browser_user__permission__service.h b/devel/electron31/files/patch-components_device__signals_core_browser_user__permission__service.h
new file mode 100644
index 000000000000..f97fd34746cc
--- /dev/null
+++ b/devel/electron31/files/patch-components_device__signals_core_browser_user__permission__service.h
@@ -0,0 +1,11 @@
+--- components/device_signals/core/browser/user_permission_service.h.orig 2023-08-10 01:48:40 UTC
++++ components/device_signals/core/browser/user_permission_service.h
+@@ -57,7 +57,7 @@ class UserPermissionService : public KeyedService {
+ // missing.
+ virtual bool ShouldCollectConsent() const = 0;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Will verify whether context-aware signals can be collected
+ // on behalf of the user represented by `user_context`. Returns `kGranted` if
+ // collection is allowed.
diff --git a/devel/electron31/files/patch-components_device__signals_core_browser_user__permission__service__impl.cc b/devel/electron31/files/patch-components_device__signals_core_browser_user__permission__service__impl.cc
new file mode 100644
index 000000000000..5d14830282aa
--- /dev/null
+++ b/devel/electron31/files/patch-components_device__signals_core_browser_user__permission__service__impl.cc
@@ -0,0 +1,11 @@
+--- components/device_signals/core/browser/user_permission_service_impl.cc.orig 2024-06-18 21:43:28 UTC
++++ components/device_signals/core/browser/user_permission_service_impl.cc
+@@ -93,7 +93,7 @@ bool UserPermissionServiceImpl::ShouldCollectConsent()
+ consent_required_by_dependent_policy;
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ UserPermission UserPermissionServiceImpl::CanUserCollectSignals(
+ const UserContext& user_context) const {
+ // Return "unknown user" if no user ID was given.
diff --git a/devel/electron31/files/patch-components_device__signals_core_browser_user__permission__service__impl.h b/devel/electron31/files/patch-components_device__signals_core_browser_user__permission__service__impl.h
new file mode 100644
index 000000000000..dd9f409ab719
--- /dev/null
+++ b/devel/electron31/files/patch-components_device__signals_core_browser_user__permission__service__impl.h
@@ -0,0 +1,11 @@
+--- components/device_signals/core/browser/user_permission_service_impl.h.orig 2023-08-10 01:48:40 UTC
++++ components/device_signals/core/browser/user_permission_service_impl.h
+@@ -39,7 +39,7 @@ class UserPermissionServiceImpl : public UserPermissio
+
+ // UserPermissionService:
+ bool ShouldCollectConsent() const override;
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ UserPermission CanUserCollectSignals(
+ const UserContext& user_context) const override;
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX
diff --git a/devel/electron31/files/patch-components_device__signals_core_common_signals__features.cc b/devel/electron31/files/patch-components_device__signals_core_common_signals__features.cc
new file mode 100644
index 000000000000..382881995b65
--- /dev/null
+++ b/devel/electron31/files/patch-components_device__signals_core_common_signals__features.cc
@@ -0,0 +1,11 @@
+--- components/device_signals/core/common/signals_features.cc.orig 2023-08-10 01:48:40 UTC
++++ components/device_signals/core/common/signals_features.cc
+@@ -46,7 +46,7 @@ bool IsNewFunctionEnabled(NewEvFunction new_ev_functio
+ }
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ // Enables the triggering of device signals consent dialog when conditions met
+ // This feature also requires UnmanagedDeviceSignalsConsentFlowEnabled policy to
+ // be enabled
diff --git a/devel/electron31/files/patch-components_device__signals_core_common_signals__features.h b/devel/electron31/files/patch-components_device__signals_core_common_signals__features.h
new file mode 100644
index 000000000000..17c6b8eba372
--- /dev/null
+++ b/devel/electron31/files/patch-components_device__signals_core_common_signals__features.h
@@ -0,0 +1,11 @@
+--- components/device_signals/core/common/signals_features.h.orig 2023-08-10 01:48:40 UTC
++++ components/device_signals/core/common/signals_features.h
+@@ -28,7 +28,7 @@ enum class NewEvFunction { kFileSystemInfo, kSettings,
+ bool IsNewFunctionEnabled(NewEvFunction new_ev_function);
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ BASE_DECLARE_FEATURE(kDeviceSignalsConsentDialog);
+
+ // Returns true if device signals consent dialog has been enabled for
diff --git a/devel/electron31/files/patch-components_device__signals_core_system__signals_platform__delegate.cc b/devel/electron31/files/patch-components_device__signals_core_system__signals_platform__delegate.cc
new file mode 100644
index 000000000000..c5dea15ace97
--- /dev/null
+++ b/devel/electron31/files/patch-components_device__signals_core_system__signals_platform__delegate.cc
@@ -0,0 +1,11 @@
+--- components/device_signals/core/system_signals/platform_delegate.cc.orig 2022-09-24 10:57:32 UTC
++++ components/device_signals/core/system_signals/platform_delegate.cc
+@@ -11,7 +11,7 @@ namespace device_signals {
+
+ bool CustomFilePathComparator::operator()(const base::FilePath& a,
+ const base::FilePath& b) const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On Linux, the file system is case sensitive.
+ return a < b;
+ #else
diff --git a/devel/electron31/files/patch-components_device__signals_test_signals__contract.cc b/devel/electron31/files/patch-components_device__signals_test_signals__contract.cc
new file mode 100644
index 000000000000..d28129cda700
--- /dev/null
+++ b/devel/electron31/files/patch-components_device__signals_test_signals__contract.cc
@@ -0,0 +1,11 @@
+--- components/device_signals/test/signals_contract.cc.orig 2023-10-19 19:58:18 UTC
++++ components/device_signals/test/signals_contract.cc
+@@ -212,7 +212,7 @@ GetSignalsContract() {
+ base::BindRepeating(VerifyUnset, names::kCrowdStrike);
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUIDLFLAG(IS_BSD)
+ contract[names::kAllowScreenLock] =
+ base::BindRepeating(VerifyUnset, names::kAllowScreenLock);
+ contract[names::kImei] = base::BindRepeating(VerifyUnset, names::kImei);
diff --git a/devel/electron31/files/patch-components_discardable__memory_service_discardable__shared__memory__manager.cc b/devel/electron31/files/patch-components_discardable__memory_service_discardable__shared__memory__manager.cc
new file mode 100644
index 000000000000..0abc29444955
--- /dev/null
+++ b/devel/electron31/files/patch-components_discardable__memory_service_discardable__shared__memory__manager.cc
@@ -0,0 +1,11 @@
+--- components/discardable_memory/service/discardable_shared_memory_manager.cc.orig 2024-06-18 21:43:28 UTC
++++ components/discardable_memory/service/discardable_shared_memory_manager.cc
+@@ -176,7 +176,7 @@ uint64_t GetDefaultMemoryLimit() {
+ // Limits the number of FDs used to 32, assuming a 4MB allocation size.
+ uint64_t max_default_memory_limit = 128 * kMegabyte;
+ #else
+- uint64_t max_default_memory_limit = 512 * kMegabyte;
++ uint64_t max_default_memory_limit = 128 * kMegabyte;
+ #endif
+
+ // Use 1/8th of discardable memory on low-end devices.
diff --git a/devel/electron31/files/patch-components_embedder__support_user__agent__utils.cc b/devel/electron31/files/patch-components_embedder__support_user__agent__utils.cc
new file mode 100644
index 000000000000..4bb338743254
--- /dev/null
+++ b/devel/electron31/files/patch-components_embedder__support_user__agent__utils.cc
@@ -0,0 +1,12 @@
+--- components/embedder_support/user_agent_utils.cc.orig 2024-02-21 00:20:41 UTC
++++ components/embedder_support/user_agent_utils.cc
+@@ -445,6 +445,9 @@ std::string GetPlatformForUAMetadata() {
+ # else
+ return "Chromium OS";
+ # endif
++#elif BUILDFLAG(IS_BSD)
++ // The internet is weird...
++ return "Linux";
+ #else
+ return std::string(version_info::GetOSType());
+ #endif
diff --git a/devel/electron31/files/patch-components_embedder__support_user__agent__utils__unittest.cc b/devel/electron31/files/patch-components_embedder__support_user__agent__utils__unittest.cc
new file mode 100644
index 000000000000..ab0c76ebb922
--- /dev/null
+++ b/devel/electron31/files/patch-components_embedder__support_user__agent__utils__unittest.cc
@@ -0,0 +1,29 @@
+--- components/embedder_support/user_agent_utils_unittest.cc.orig 2024-06-18 21:43:28 UTC
++++ components/embedder_support/user_agent_utils_unittest.cc
+@@ -71,7 +71,7 @@ const char kDesktop[] =
+ "X11; CrOS x86_64 14541.0.0"
+ #elif BUILDFLAG(IS_FUCHSIA)
+ "Fuchsia"
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ "X11; Linux x86_64"
+ #elif BUILDFLAG(IS_MAC)
+ "Macintosh; Intel Mac OS X 10_15_7"
+@@ -171,7 +171,7 @@ void CheckUserAgentStringOrdering(bool mobile_device)
+ ASSERT_EQ("CrOS", pieces[0]);
+ ASSERT_EQ("x86_64", pieces[1]);
+ ASSERT_EQ("14541.0.0", pieces[2]);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Post-UA Reduction there is a single <unifiedPlatform> value for Linux:
+ // X11; Linux x86_64
+ ASSERT_EQ(2u, pieces.size());
+@@ -727,7 +727,7 @@ TEST_F(UserAgentUtilsTest, UserAgentMetadata) {
+ #endif
+ #elif BUILDFLAG(IS_ANDROID)
+ EXPECT_EQ(metadata.platform, "Android");
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ EXPECT_EQ(metadata.platform, "Linux");
+ #elif BUILDFLAG(IS_FREEBSD)
+ EXPECT_EQ(metadata.platform, "FreeBSD");
diff --git a/devel/electron31/files/patch-components_eye__dropper_eye__dropper__view.cc b/devel/electron31/files/patch-components_eye__dropper_eye__dropper__view.cc
new file mode 100644
index 000000000000..06fd821bb69d
--- /dev/null
+++ b/devel/electron31/files/patch-components_eye__dropper_eye__dropper__view.cc
@@ -0,0 +1,11 @@
+--- components/eye_dropper/eye_dropper_view.cc.orig 2024-06-18 21:43:28 UTC
++++ components/eye_dropper/eye_dropper_view.cc
+@@ -202,7 +202,7 @@ EyeDropperView::EyeDropperView(gfx::NativeView parent,
+ // EyeDropper/WidgetDelegate.
+ set_owned_by_client();
+ SetPreferredSize(GetSize());
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Use TYPE_MENU for Linux to ensure that the eye dropper view is displayed
+ // above the color picker.
+ views::Widget::InitParams params(views::Widget::InitParams::TYPE_MENU);
diff --git a/devel/electron31/files/patch-components_feature__engagement_public_event__constants.cc b/devel/electron31/files/patch-components_feature__engagement_public_event__constants.cc
new file mode 100644
index 000000000000..e2eaf62b7d02
--- /dev/null
+++ b/devel/electron31/files/patch-components_feature__engagement_public_event__constants.cc
@@ -0,0 +1,11 @@
+--- components/feature_engagement/public/event_constants.cc.orig 2022-02-28 16:54:41 UTC
++++ components/feature_engagement/public/event_constants.cc
+@@ -11,7 +11,7 @@ namespace feature_engagement {
+ namespace events {
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ const char kNewTabOpened[] = "new_tab_opened";
+ const char kSixthTabOpened[] = "sixth_tab_opened";
+ const char kTabGroupCreated[] = "tab_group_created";
diff --git a/devel/electron31/files/patch-components_feature__engagement_public_event__constants.h b/devel/electron31/files/patch-components_feature__engagement_public_event__constants.h
new file mode 100644
index 000000000000..2308fc5d4293
--- /dev/null
+++ b/devel/electron31/files/patch-components_feature__engagement_public_event__constants.h
@@ -0,0 +1,11 @@
+--- components/feature_engagement/public/event_constants.h.orig 2023-10-19 19:58:18 UTC
++++ components/feature_engagement/public/event_constants.h
+@@ -14,7 +14,7 @@ namespace events {
+
+ // Desktop
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // The user has explicitly opened a new tab via an entry point from inside of
+ // Chrome.
+ extern const char kNewTabOpened[];
diff --git a/devel/electron31/files/patch-components_feature__engagement_public_feature__configurations.cc b/devel/electron31/files/patch-components_feature__engagement_public_feature__configurations.cc
new file mode 100644
index 000000000000..a0569943000d
--- /dev/null
+++ b/devel/electron31/files/patch-components_feature__engagement_public_feature__configurations.cc
@@ -0,0 +1,29 @@
+--- components/feature_engagement/public/feature_configurations.cc.orig 2024-06-18 21:43:28 UTC
++++ components/feature_engagement/public/feature_configurations.cc
+@@ -94,7 +94,7 @@ std::optional<FeatureConfig> GetClientSideFeatureConfi
+
+ std::optional<FeatureConfig> GetClientSideFeatureConfig(
+ const base::Feature* feature) {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+
+ // The IPH bubble for link capturing has a trigger set to ANY so that it
+ // always shows up. The per app specific guardrails are independently stored
+@@ -113,7 +113,7 @@ std::optional<FeatureConfig> GetClientSideFeatureConfi
+
+ #endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (kIPHPasswordsAccountStorageFeature.name == feature->name) {
+ std::optional<FeatureConfig> config = FeatureConfig();
+ config->valid = true;
+@@ -1498,7 +1498,7 @@ std::optional<FeatureConfig> GetClientSideFeatureConfi
+
+ #endif // BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) || \
+ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
+
+ if (kIPHAutofillCreditCardBenefitFeature.name == feature->name) {
diff --git a/devel/electron31/files/patch-components_feature__engagement_public_feature__constants.cc b/devel/electron31/files/patch-components_feature__engagement_public_feature__constants.cc
new file mode 100644
index 000000000000..0fe19bd97f5e
--- /dev/null
+++ b/devel/electron31/files/patch-components_feature__engagement_public_feature__constants.cc
@@ -0,0 +1,30 @@
+--- components/feature_engagement/public/feature_constants.cc.orig 2024-06-18 21:43:28 UTC
++++ components/feature_engagement/public/feature_constants.cc
+@@ -18,7 +18,7 @@ BASE_FEATURE(kIPHDummyFeature, "IPH_Dummy", base::FEAT
+ BASE_FEATURE(kIPHDummyFeature, "IPH_Dummy", base::FEATURE_DISABLED_BY_DEFAULT);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kEsbDownloadRowPromoFeature,
+ "EsbDownloadRowPromo",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+@@ -605,7 +605,8 @@ BASE_FEATURE(kDefaultBrowserTriggerCriteriaExperiment,
+ #endif // BUILDFLAG(IS_IOS)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || \
++ BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kIPHAutofillCreditCardBenefitFeature,
+ "IPH_AutofillCreditCardBenefit",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+@@ -736,7 +737,7 @@ BASE_FEATURE(kIPHScalableIphGamingFeature,
+ base::FEATURE_DISABLED_BY_DEFAULT);
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // This can be enabled by default, as the DesktopPWAsLinkCapturing
+ // flag is needed for the IPH linked to this feature to work, and
+ // use-cases to show the IPH are guarded by that flag.
diff --git a/devel/electron31/files/patch-components_feature__engagement_public_feature__constants.h b/devel/electron31/files/patch-components_feature__engagement_public_feature__constants.h
new file mode 100644
index 000000000000..d5f7b84a0a13
--- /dev/null
+++ b/devel/electron31/files/patch-components_feature__engagement_public_feature__constants.h
@@ -0,0 +1,30 @@
+--- components/feature_engagement/public/feature_constants.h.orig 2024-06-18 21:43:28 UTC
++++ components/feature_engagement/public/feature_constants.h
+@@ -20,7 +20,7 @@ BASE_DECLARE_FEATURE(kIPHDummyFeature);
+ BASE_DECLARE_FEATURE(kIPHDummyFeature);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ BASE_DECLARE_FEATURE(kEsbDownloadRowPromoFeature);
+ BASE_DECLARE_FEATURE(kIPHBatterySaverModeFeature);
+ BASE_DECLARE_FEATURE(kIPHCompanionSidePanelFeature);
+@@ -252,7 +252,8 @@ BASE_DECLARE_FEATURE(kDefaultBrowserTriggerCriteriaExp
+ #endif // BUILDFLAG(IS_IOS)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || \
++ BUILDFLAG(IS_BSD)
+ BASE_DECLARE_FEATURE(kIPHAutofillCreditCardBenefitFeature);
+ BASE_DECLARE_FEATURE(kIPHAutofillExternalAccountProfileSuggestionFeature);
+ BASE_DECLARE_FEATURE(kIPHAutofillManualFallbackFeature);
+@@ -301,7 +302,7 @@ BASE_DECLARE_FEATURE(kIPHScalableIphGamingFeature);
+ BASE_DECLARE_FEATURE(kIPHScalableIphGamingFeature);
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ BASE_DECLARE_FEATURE(kIPHDesktopPWAsLinkCapturingLaunch);
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
diff --git a/devel/electron31/files/patch-components_feature__engagement_public_feature__list.cc b/devel/electron31/files/patch-components_feature__engagement_public_feature__list.cc
new file mode 100644
index 000000000000..28523540ad62
--- /dev/null
+++ b/devel/electron31/files/patch-components_feature__engagement_public_feature__list.cc
@@ -0,0 +1,30 @@
+--- components/feature_engagement/public/feature_list.cc.orig 2024-06-18 21:43:28 UTC
++++ components/feature_engagement/public/feature_list.cc
+@@ -148,7 +148,7 @@ const base::Feature* const kAllFeatures[] = {
+ &kIPHiOSInlineEnhancedSafeBrowsingPromoFeature,
+ #endif // BUILDFLAG(IS_IOS)
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ &kEsbDownloadRowPromoFeature,
+ &kIPHBatterySaverModeFeature,
+ &kIPHCompanionSidePanelFeature,
+@@ -211,7 +211,8 @@ const base::Feature* const kAllFeatures[] = {
+ // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || \
++ BUILDFLAG(IS_BSD)
+ &kIPHAutofillCreditCardBenefitFeature,
+ &kIPHAutofillExternalAccountProfileSuggestionFeature,
+ &kIPHAutofillManualFallbackFeature,
+@@ -260,7 +261,7 @@ const base::Feature* const kAllFeatures[] = {
+ &kIPHScalableIphGamingFeature,
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ &kIPHDesktopPWAsLinkCapturingLaunch,
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
diff --git a/devel/electron31/files/patch-components_feature__engagement_public_feature__list.h b/devel/electron31/files/patch-components_feature__engagement_public_feature__list.h
new file mode 100644
index 000000000000..769e1be90e68
--- /dev/null
+++ b/devel/electron31/files/patch-components_feature__engagement_public_feature__list.h
@@ -0,0 +1,58 @@
+--- components/feature_engagement/public/feature_list.h.orig 2024-06-18 21:43:28 UTC
++++ components/feature_engagement/public/feature_list.h
+@@ -266,7 +266,7 @@ DEFINE_VARIATION_PARAM(kIPHiOSInlineEnhancedSafeBrowsi
+ #endif // BUILDFLAG(IS_IOS)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ DEFINE_VARIATION_PARAM(kEsbDownloadRowPromoFeature, "EsbDownloadRowPromo");
+ DEFINE_VARIATION_PARAM(kIPHBatterySaverModeFeature, "IPH_BatterySaverMode");
+ DEFINE_VARIATION_PARAM(kIPHCompanionSidePanelFeature, "IPH_CompanionSidePanel");
+@@ -370,7 +370,8 @@ DEFINE_VARIATION_PARAM(kIPHBackNavigationMenuFeature,
+ // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || \
++ BUILDFLAG(IS_BSD)
+ DEFINE_VARIATION_PARAM(kIPHAutofillCreditCardBenefitFeature,
+ "IPH_AutofillCreditCardBenefit");
+ DEFINE_VARIATION_PARAM(kIPHAutofillExternalAccountProfileSuggestionFeature,
+@@ -457,7 +458,7 @@ DEFINE_VARIATION_PARAM(kIPHScalableIphGamingFeature, "
+ DEFINE_VARIATION_PARAM(kIPHScalableIphGamingFeature, "IPH_ScalableIphGaming");
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ DEFINE_VARIATION_PARAM(kIPHDesktopPWAsLinkCapturingLaunch,
+ "IPH_DesktopPWAsLinkCapturingLaunch");
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+@@ -606,7 +607,7 @@ constexpr flags_ui::FeatureEntry::FeatureVariation
+ VARIATION_ENTRY(kIPHiOSPromoGenericDefaultBrowserFeature),
+ VARIATION_ENTRY(kIPHiOSOverflowMenuCustomizationFeature),
+ #elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ VARIATION_ENTRY(kIPHBatterySaverModeFeature),
+ VARIATION_ENTRY(kIPHCompanionSidePanelFeature),
+ VARIATION_ENTRY(kIPHCompanionSidePanelRegionSearchFeature),
+@@ -665,7 +666,8 @@ constexpr flags_ui::FeatureEntry::FeatureVariation
+ // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || \
++ BUILDFLAG(IS_BSD)
+ VARIATION_ENTRY(kIPHAutofillCreditCardBenefitFeature),
+ VARIATION_ENTRY(kIPHAutofillExternalAccountProfileSuggestionFeature),
+ VARIATION_ENTRY(kIPHAutofillManualFallbackFeature),
+@@ -714,7 +716,7 @@ constexpr flags_ui::FeatureEntry::FeatureVariation
+ VARIATION_ENTRY(kIPHScalableIphGamingFeature),
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ VARIATION_ENTRY(kIPHDesktopPWAsLinkCapturingLaunch),
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
diff --git a/devel/electron31/files/patch-components_feed_core_proto_v2_wire_version.proto b/devel/electron31/files/patch-components_feed_core_proto_v2_wire_version.proto
new file mode 100644
index 000000000000..96224d006191
--- /dev/null
+++ b/devel/electron31/files/patch-components_feed_core_proto_v2_wire_version.proto
@@ -0,0 +1,13 @@
+--- components/feed/core/proto/v2/wire/version.proto.orig 2021-05-12 22:05:49 UTC
++++ components/feed/core/proto/v2/wire/version.proto
+@@ -25,8 +25,8 @@ message Version {
+ BETA = 3;
+ RELEASE = 4;
+ }
+- optional int32 major = 1;
+- optional int32 minor = 2;
++ optional int32 gmajor = 1;
++ optional int32 gminor = 2;
+ optional int32 build = 3;
+ optional int32 revision = 4;
+ optional Architecture architecture = 5;
diff --git a/devel/electron31/files/patch-components_feed_core_v2_feed__network__impl__unittest.cc b/devel/electron31/files/patch-components_feed_core_v2_feed__network__impl__unittest.cc
new file mode 100644
index 000000000000..e2305413e239
--- /dev/null
+++ b/devel/electron31/files/patch-components_feed_core_v2_feed__network__impl__unittest.cc
@@ -0,0 +1,13 @@
+--- components/feed/core/v2/feed_network_impl_unittest.cc.orig 2024-06-18 21:43:28 UTC
++++ components/feed/core/v2/feed_network_impl_unittest.cc
+@@ -753,8 +753,8 @@ TEST_F(FeedNetworkTest, SendApiRequest_DecodesClientIn
+
+ EXPECT_EQ(feedwire::ClientInfo::CHROME_ANDROID, client_info.app_type());
+ EXPECT_EQ(feedwire::Version::RELEASE, client_info.app_version().build_type());
+- EXPECT_EQ(1, client_info.app_version().major());
+- EXPECT_EQ(2, client_info.app_version().minor());
++ EXPECT_EQ(1, client_info.app_version().gmajor());
++ EXPECT_EQ(2, client_info.app_version().gminor());
+ EXPECT_EQ(3, client_info.app_version().build());
+ EXPECT_EQ(4, client_info.app_version().revision());
+ EXPECT_FALSE(client_info.chrome_client_info().start_surface());
diff --git a/devel/electron31/files/patch-components_feed_core_v2_proto__util.cc b/devel/electron31/files/patch-components_feed_core_v2_proto__util.cc
new file mode 100644
index 000000000000..feec3240231a
--- /dev/null
+++ b/devel/electron31/files/patch-components_feed_core_v2_proto__util.cc
@@ -0,0 +1,24 @@
+--- components/feed/core/v2/proto_util.cc.orig 2023-08-10 01:48:40 UTC
++++ components/feed/core/v2/proto_util.cc
+@@ -93,8 +93,8 @@ feedwire::Version GetPlatformVersionMessage() {
+
+ int32_t major, minor, revision;
+ base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &revision);
+- result.set_major(major);
+- result.set_minor(minor);
++ result.set_gmajor(major);
++ result.set_gminor(minor);
+ result.set_revision(revision);
+ #if BUILDFLAG(IS_ANDROID)
+ result.set_api_version(base::android::BuildInfo::GetInstance()->sdk_int());
+@@ -109,8 +109,8 @@ feedwire::Version GetAppVersionMessage(const ChromeInf
+ // Chrome's version is in the format: MAJOR,MINOR,BUILD,PATCH.
+ const std::vector<uint32_t>& numbers = chrome_info.version.components();
+ if (numbers.size() > 3) {
+- result.set_major(static_cast<int32_t>(numbers[0]));
+- result.set_minor(static_cast<int32_t>(numbers[1]));
++ result.set_gmajor(static_cast<int32_t>(numbers[0]));
++ result.set_gminor(static_cast<int32_t>(numbers[1]));
+ result.set_build(static_cast<int32_t>(numbers[2]));
+ result.set_revision(static_cast<int32_t>(numbers[3]));
+ }
diff --git a/devel/electron31/files/patch-components_feed_core_v2_proto__util__unittest.cc b/devel/electron31/files/patch-components_feed_core_v2_proto__util__unittest.cc
new file mode 100644
index 000000000000..3447ab3e638b
--- /dev/null
+++ b/devel/electron31/files/patch-components_feed_core_v2_proto__util__unittest.cc
@@ -0,0 +1,13 @@
+--- components/feed/core/v2/proto_util_unittest.cc.orig 2023-10-19 19:58:18 UTC
++++ components/feed/core/v2/proto_util_unittest.cc
+@@ -44,8 +44,8 @@ TEST(ProtoUtilTest, CreateClientInfo) {
+ feedwire::ClientInfo result = CreateClientInfo(request_metadata);
+ EXPECT_EQ(feedwire::ClientInfo::CHROME_ANDROID, result.app_type());
+ EXPECT_EQ(feedwire::Version::RELEASE, result.app_version().build_type());
+- EXPECT_EQ(1, result.app_version().major());
+- EXPECT_EQ(2, result.app_version().minor());
++ EXPECT_EQ(1, result.app_version().gmajor());
++ EXPECT_EQ(2, result.app_version().gminor());
+ EXPECT_EQ(3, result.app_version().build());
+ EXPECT_EQ(4, result.app_version().revision());
+ EXPECT_FALSE(result.chrome_client_info().start_surface());
diff --git a/devel/electron31/files/patch-components_feed_core_v2_test_proto__printer.cc b/devel/electron31/files/patch-components_feed_core_v2_test_proto__printer.cc
new file mode 100644
index 000000000000..693a8da91003
--- /dev/null
+++ b/devel/electron31/files/patch-components_feed_core_v2_test_proto__printer.cc
@@ -0,0 +1,13 @@
+--- components/feed/core/v2/test/proto_printer.cc.orig 2023-08-10 01:48:40 UTC
++++ components/feed/core/v2/test/proto_printer.cc
+@@ -158,8 +158,8 @@ class TextProtoPrinter {
+ }
+ TextProtoPrinter& operator<<(const feedwire::Version& v) {
+ BeginMessage();
+- PRINT_FIELD(major);
+- PRINT_FIELD(minor);
++ PRINT_FIELD(gmajor);
++ PRINT_FIELD(gminor);
+ PRINT_FIELD(build);
+ PRINT_FIELD(revision);
+ PRINT_FIELD(architecture);
diff --git a/devel/electron31/files/patch-components_flags__ui_flags__state.cc b/devel/electron31/files/patch-components_flags__ui_flags__state.cc
new file mode 100644
index 000000000000..812aeaa73b9f
--- /dev/null
+++ b/devel/electron31/files/patch-components_flags__ui_flags__state.cc
@@ -0,0 +1,11 @@
+--- components/flags_ui/flags_state.cc.orig 2023-10-19 19:58:18 UTC
++++ components/flags_ui/flags_state.cc
+@@ -741,7 +741,7 @@ unsigned short FlagsState::GetCurrentPlatform() {
+ return kOsCrOS;
+ #elif BUILDFLAG(IS_CHROMEOS_LACROS)
+ return kOsLacros;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_OPENBSD)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return kOsLinux;
+ #elif BUILDFLAG(IS_ANDROID)
+ return kOsAndroid;
diff --git a/devel/electron31/files/patch-components_gwp__asan_BUILD.gn b/devel/electron31/files/patch-components_gwp__asan_BUILD.gn
new file mode 100644
index 000000000000..416067b4053b
--- /dev/null
+++ b/devel/electron31/files/patch-components_gwp__asan_BUILD.gn
@@ -0,0 +1,11 @@
+--- components/gwp_asan/BUILD.gn.orig 2022-11-30 08:12:58 UTC
++++ components/gwp_asan/BUILD.gn
+@@ -15,7 +15,7 @@ test("gwp_asan_unittests") {
+ "//testing/gtest",
+ "//third_party/boringssl",
+ ]
+- if (is_win || is_mac || is_linux || is_chromeos || is_android) {
++ if ((is_win || is_mac || is_linux || is_chromeos || is_android) && !is_bsd) {
+ deps += [
+ "//components/gwp_asan/client:unit_tests",
+ "//components/gwp_asan/crash_handler:unit_tests",
diff --git a/devel/electron31/files/patch-components_gwp__asan_client_guarded__page__allocator__posix.cc b/devel/electron31/files/patch-components_gwp__asan_client_guarded__page__allocator__posix.cc
new file mode 100644
index 000000000000..357eb0881122
--- /dev/null
+++ b/devel/electron31/files/patch-components_gwp__asan_client_guarded__page__allocator__posix.cc
@@ -0,0 +1,13 @@
+--- components/gwp_asan/client/guarded_page_allocator_posix.cc.orig 2023-10-19 19:58:18 UTC
++++ components/gwp_asan/client/guarded_page_allocator_posix.cc
+@@ -35,8 +35,9 @@ void GuardedPageAllocator::MarkPageInaccessible(void*
+ // mmap() a PROT_NONE page over the address to release it to the system, if
+ // we used mprotect() here the system would count pages in the quarantine
+ // against the RSS.
++ // MAP_ANONYMOUS requires the fd to be -1 on !linux
+ void* err = mmap(ptr, state_.page_size, PROT_NONE,
+- MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
++ MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ PCHECK(err == ptr) << "mmap";
+ }
+
diff --git a/devel/electron31/files/patch-components_gwp__asan_client_gwp__asan.cc b/devel/electron31/files/patch-components_gwp__asan_client_gwp__asan.cc
new file mode 100644
index 000000000000..98f6650782c8
--- /dev/null
+++ b/devel/electron31/files/patch-components_gwp__asan_client_gwp__asan.cc
@@ -0,0 +1,11 @@
+--- components/gwp_asan/client/gwp_asan.cc.orig 2024-06-18 21:43:29 UTC
++++ components/gwp_asan/client/gwp_asan.cc
+@@ -75,7 +75,7 @@ namespace {
+ // ProcessSamplingBoost is the multiplier to increase the
+ // ProcessSamplingProbability in scenarios where we want to perform additional
+ // testing (e.g., on canary/dev builds).
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ constexpr int kDefaultMaxAllocations = 50;
+ constexpr int kDefaultMaxMetadata = 210;
+ constexpr int kDefaultTotalPages = kCpuIs64Bit ? 2048 : kDefaultMaxMetadata * 2;
diff --git a/devel/electron31/files/patch-components_gwp__asan_client_gwp__asan__features.cc b/devel/electron31/files/patch-components_gwp__asan_client_gwp__asan__features.cc
new file mode 100644
index 000000000000..daf97426f192
--- /dev/null
+++ b/devel/electron31/files/patch-components_gwp__asan_client_gwp__asan__features.cc
@@ -0,0 +1,11 @@
+--- components/gwp_asan/client/gwp_asan_features.cc.orig 2024-02-21 00:20:41 UTC
++++ components/gwp_asan/client/gwp_asan_features.cc
+@@ -9,7 +9,7 @@ namespace gwp_asan::internal {
+ namespace gwp_asan::internal {
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || \
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_ANDROID) && defined(ARCH_CPU_64_BITS))
+ constexpr base::FeatureState kDefaultEnabled = base::FEATURE_ENABLED_BY_DEFAULT;
+ #else
diff --git a/devel/electron31/files/patch-components_gwp__asan_crash__handler_crash__analyzer.cc b/devel/electron31/files/patch-components_gwp__asan_crash__handler_crash__analyzer.cc
new file mode 100644
index 000000000000..189e9222f0a4
--- /dev/null
+++ b/devel/electron31/files/patch-components_gwp__asan_crash__handler_crash__analyzer.cc
@@ -0,0 +1,20 @@
+--- components/gwp_asan/crash_handler/crash_analyzer.cc.orig 2023-05-25 00:41:50 UTC
++++ components/gwp_asan/crash_handler/crash_analyzer.cc
+@@ -30,7 +30,7 @@
+ #include "third_party/crashpad/crashpad/snapshot/process_snapshot.h"
+ #include "third_party/crashpad/crashpad/util/process/process_memory.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include <signal.h>
+ #elif BUILDFLAG(IS_APPLE)
+ #include <mach/exception_types.h>
+@@ -90,7 +90,7 @@ bool CrashAnalyzer::GetExceptionInfo(
+
+ crashpad::VMAddress CrashAnalyzer::GetAccessAddress(
+ const crashpad::ExceptionSnapshot& exception) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ if (exception.Exception() == SIGSEGV || exception.Exception() == SIGBUS)
+ return exception.ExceptionAddress();
+ #elif BUILDFLAG(IS_APPLE)
diff --git a/devel/electron31/files/patch-components_live__caption_caption__util.cc b/devel/electron31/files/patch-components_live__caption_caption__util.cc
new file mode 100644
index 000000000000..2eefc76c7326
--- /dev/null
+++ b/devel/electron31/files/patch-components_live__caption_caption__util.cc
@@ -0,0 +1,11 @@
+--- components/live_caption/caption_util.cc.orig 2024-06-18 21:43:29 UTC
++++ components/live_caption/caption_util.cc
+@@ -144,7 +144,7 @@ std::string GetCaptionSettingsUrl() {
+ return "chrome://os-settings/audioAndCaptions";
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return "chrome://settings/captions";
+ #endif // BUILDFLAG(IS_LINUX)
+
diff --git a/devel/electron31/files/patch-components_live__caption_caption__util.h b/devel/electron31/files/patch-components_live__caption_caption__util.h
new file mode 100644
index 000000000000..9edcdaf8c824
--- /dev/null
+++ b/devel/electron31/files/patch-components_live__caption_caption__util.h
@@ -0,0 +1,11 @@
+--- components/live_caption/caption_util.h.orig 2024-04-15 20:33:54 UTC
++++ components/live_caption/caption_util.h
+@@ -15,7 +15,7 @@ namespace captions {
+ namespace captions {
+
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ extern const char kCaptionSettingsUrl[];
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) ||
+ // BUILDFLAG(IS_MAC)
diff --git a/devel/electron31/files/patch-components_media__router_common_media__source.cc b/devel/electron31/files/patch-components_media__router_common_media__source.cc
new file mode 100644
index 000000000000..4c92707942e2
--- /dev/null
+++ b/devel/electron31/files/patch-components_media__router_common_media__source.cc
@@ -0,0 +1,11 @@
+--- components/media_router/common/media_source.cc.orig 2024-06-18 21:43:29 UTC
++++ components/media_router/common/media_source.cc
+@@ -57,7 +57,7 @@ bool IsSystemAudioCaptureSupported() {
+ if (!media::IsSystemLoopbackCaptureSupported()) {
+ return false;
+ }
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return base::FeatureList::IsEnabled(media::kPulseaudioLoopbackForCast);
+ #else
+ return true;
diff --git a/devel/electron31/files/patch-components_media__router_common_providers_cast_channel_cast__message__util.cc b/devel/electron31/files/patch-components_media__router_common_providers_cast_channel_cast__message__util.cc
new file mode 100644
index 000000000000..6fb1b7a94e22
--- /dev/null
+++ b/devel/electron31/files/patch-components_media__router_common_providers_cast_channel_cast__message__util.cc
@@ -0,0 +1,11 @@
+--- components/media_router/common/providers/cast/channel/cast_message_util.cc.orig 2023-11-29 21:39:58 UTC
++++ components/media_router/common/providers/cast/channel/cast_message_util.cc
+@@ -169,7 +169,7 @@ int GetVirtualConnectPlatformValue() {
+ return 4;
+ #elif BUILDFLAG(IS_CHROMEOS_ASH)
+ return 5;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ return 6;
+ #else
+ return 0;
diff --git a/devel/electron31/files/patch-components_metrics_drive__metrics__provider__linux.cc b/devel/electron31/files/patch-components_metrics_drive__metrics__provider__linux.cc
new file mode 100644
index 000000000000..105b380f89b9
--- /dev/null
+++ b/devel/electron31/files/patch-components_metrics_drive__metrics__provider__linux.cc
@@ -0,0 +1,16 @@
+--- components/metrics/drive_metrics_provider_linux.cc.orig 2023-10-19 19:58:18 UTC
++++ components/metrics/drive_metrics_provider_linux.cc
+@@ -4,7 +4,13 @@
+
+ #include "components/metrics/drive_metrics_provider.h"
+
++#if BUILDFLAG(IS_BSD)
++#include <sys/types.h>
++#define MAJOR(dev) major(dev)
++#define MINOR(dev) minor(dev)
++#else
+ #include <linux/kdev_t.h> // For MAJOR()/MINOR().
++#endif
+ #include <sys/stat.h>
+ #include <string>
+
diff --git a/devel/electron31/files/patch-components_metrics_metrics__log.cc b/devel/electron31/files/patch-components_metrics_metrics__log.cc
new file mode 100644
index 000000000000..0b67d36e94f8
--- /dev/null
+++ b/devel/electron31/files/patch-components_metrics_metrics__log.cc
@@ -0,0 +1,38 @@
+--- components/metrics/metrics_log.cc.orig 2024-06-18 21:43:29 UTC
++++ components/metrics/metrics_log.cc
+@@ -56,7 +56,7 @@
+ #include "base/win/current_module.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/environment.h"
+ #include "base/nix/xdg_util.h"
+ #endif
+@@ -146,7 +146,7 @@ void RecordCurrentTime(
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ metrics::SystemProfileProto::OS::XdgSessionType ToProtoSessionType(
+ base::nix::SessionType session_type) {
+ switch (session_type) {
+@@ -415,7 +415,7 @@ void MetricsLog::RecordCoreSystemProfile(
+ // OperatingSystemVersion refers to the ChromeOS release version.
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ os->set_kernel_version(base::SysInfo::KernelVersion());
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Linux operating system version is copied over into kernel version to be
+ // consistent.
+ os->set_kernel_version(base::SysInfo::OperatingSystemVersion());
+@@ -432,7 +432,7 @@ void MetricsLog::RecordCoreSystemProfile(
+ os->set_build_number(base::SysInfo::GetIOSBuildNumber());
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<base::Environment> env = base::Environment::Create();
+ os->set_xdg_session_type(ToProtoSessionType(base::nix::GetSessionType(*env)));
+ os->set_xdg_current_desktop(
diff --git a/devel/electron31/files/patch-components_metrics_motherboard.cc b/devel/electron31/files/patch-components_metrics_motherboard.cc
new file mode 100644
index 000000000000..a639aaec5b72
--- /dev/null
+++ b/devel/electron31/files/patch-components_metrics_motherboard.cc
@@ -0,0 +1,10 @@
+--- components/metrics/motherboard.cc.orig 2022-10-24 13:33:33 UTC
++++ components/metrics/motherboard.cc
+@@ -1,6 +1,7 @@
+ // Copyright 2022 The Chromium Authors
+ // Use of this source code is governed by a BSD-style license that can be
+ // found in the LICENSE file.
++// CHECK
+
+ #include "components/metrics/motherboard.h"
+
diff --git a/devel/electron31/files/patch-components_named__mojo__ipc__server_connection__info.h b/devel/electron31/files/patch-components_named__mojo__ipc__server_connection__info.h
new file mode 100644
index 000000000000..2ef4425572e4
--- /dev/null
+++ b/devel/electron31/files/patch-components_named__mojo__ipc__server_connection__info.h
@@ -0,0 +1,20 @@
+--- components/named_mojo_ipc_server/connection_info.h.orig 2024-04-15 20:33:54 UTC
++++ components/named_mojo_ipc_server/connection_info.h
+@@ -14,7 +14,7 @@
+ #include "base/win/scoped_handle.h"
+ #elif BUILDFLAG(IS_MAC)
+ #include <bsm/libbsm.h>
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include <sys/socket.h>
+ #endif
+
+@@ -33,7 +33,7 @@ struct ConnectionInfo {
+ std::optional<base::win::ScopedHandle> impersonation_token{};
+ #elif BUILDFLAG(IS_MAC)
+ audit_token_t audit_token{};
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ucred credentials{};
+ #endif
+ };
diff --git a/devel/electron31/files/patch-components_named__mojo__ipc__server_named__mojo__ipc__server__client__util.cc b/devel/electron31/files/patch-components_named__mojo__ipc__server_named__mojo__ipc__server__client__util.cc
new file mode 100644
index 000000000000..c10005cda29a
--- /dev/null
+++ b/devel/electron31/files/patch-components_named__mojo__ipc__server_named__mojo__ipc__server__client__util.cc
@@ -0,0 +1,11 @@
+--- components/named_mojo_ipc_server/named_mojo_ipc_server_client_util.cc.orig 2023-02-01 18:43:16 UTC
++++ components/named_mojo_ipc_server/named_mojo_ipc_server_client_util.cc
+@@ -22,7 +22,7 @@ namespace named_mojo_ipc_server {
+ // static
+ mojo::PlatformChannelEndpoint ConnectToServer(
+ const mojo::NamedPlatformChannel::ServerName& server_name) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ return mojo::NamedPlatformChannel::ConnectToServer(server_name);
+ #elif BUILDFLAG(IS_MAC)
+ mojo::PlatformChannelEndpoint endpoint =
diff --git a/devel/electron31/files/patch-components_neterror_resources_neterror.js b/devel/electron31/files/patch-components_neterror_resources_neterror.js
new file mode 100644
index 000000000000..8c3b1ffe504a
--- /dev/null
+++ b/devel/electron31/files/patch-components_neterror_resources_neterror.js
@@ -0,0 +1,11 @@
+--- components/neterror/resources/neterror.js.orig 2024-02-21 00:20:41 UTC
++++ components/neterror/resources/neterror.js
+@@ -142,7 +142,7 @@ let primaryControlOnLeft = true;
+
+ let primaryControlOnLeft = true;
+ // clang-format off
+-// <if expr="is_macosx or is_ios or is_linux or is_chromeos or is_android">
++// <if expr="is_macosx or is_ios or is_posix or is_chromeos or is_android">
+ // clang-format on
+ primaryControlOnLeft = false;
+ // </if>
diff --git a/devel/electron31/files/patch-components_network__session__configurator_browser_network__session__configurator.cc b/devel/electron31/files/patch-components_network__session__configurator_browser_network__session__configurator.cc
new file mode 100644
index 000000000000..8f1183bc25dd
--- /dev/null
+++ b/devel/electron31/files/patch-components_network__session__configurator_browser_network__session__configurator.cc
@@ -0,0 +1,11 @@
+--- components/network_session_configurator/browser/network_session_configurator.cc.orig 2024-06-18 21:43:29 UTC
++++ components/network_session_configurator/browser/network_session_configurator.cc
+@@ -825,7 +825,7 @@ net::URLRequestContextBuilder::HttpCacheParams::Type C
+ // backport, having it behave differently than in stable would be a bigger
+ // problem. TODO: Does this work in later macOS releases?
+ #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ return net::URLRequestContextBuilder::HttpCacheParams::DISK_SIMPLE;
+ #else
+ return net::URLRequestContextBuilder::HttpCacheParams::DISK_BLOCKFILE;
diff --git a/devel/electron31/files/patch-components_network__session__configurator_browser_network__session__configurator__unittest.cc b/devel/electron31/files/patch-components_network__session__configurator_browser_network__session__configurator__unittest.cc
new file mode 100644
index 000000000000..efb88b363b94
--- /dev/null
+++ b/devel/electron31/files/patch-components_network__session__configurator_browser_network__session__configurator__unittest.cc
@@ -0,0 +1,11 @@
+--- components/network_session_configurator/browser/network_session_configurator_unittest.cc.orig 2024-06-18 21:43:29 UTC
++++ components/network_session_configurator/browser/network_session_configurator_unittest.cc
+@@ -782,7 +782,7 @@ TEST_F(NetworkSessionConfiguratorTest, DefaultCacheBac
+
+ TEST_F(NetworkSessionConfiguratorTest, DefaultCacheBackend) {
+ #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ EXPECT_EQ(net::URLRequestContextBuilder::HttpCacheParams::DISK_SIMPLE,
+ ChooseCacheType());
+ #else
diff --git a/devel/electron31/files/patch-components_optimization__guide_core_optimization__guide__util.cc b/devel/electron31/files/patch-components_optimization__guide_core_optimization__guide__util.cc
new file mode 100644
index 000000000000..adf6499bf5b4
--- /dev/null
+++ b/devel/electron31/files/patch-components_optimization__guide_core_optimization__guide__util.cc
@@ -0,0 +1,11 @@
+--- components/optimization_guide/core/optimization_guide_util.cc.orig 2024-06-18 21:43:29 UTC
++++ components/optimization_guide/core/optimization_guide_util.cc
+@@ -40,7 +40,7 @@ optimization_guide::proto::Platform GetPlatform() {
+ return optimization_guide::proto::PLATFORM_CHROMEOS;
+ #elif BUILDFLAG(IS_ANDROID)
+ return optimization_guide::proto::PLATFORM_ANDROID;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return optimization_guide::proto::PLATFORM_LINUX;
+ #else
+ return optimization_guide::proto::PLATFORM_UNDEFINED;
diff --git a/devel/electron31/files/patch-components_os__crypt_sync_libsecret__util__linux.cc b/devel/electron31/files/patch-components_os__crypt_sync_libsecret__util__linux.cc
new file mode 100644
index 000000000000..91204a64ddbe
--- /dev/null
+++ b/devel/electron31/files/patch-components_os__crypt_sync_libsecret__util__linux.cc
@@ -0,0 +1,27 @@
+--- components/os_crypt/sync/libsecret_util_linux.cc.orig 2024-06-18 21:43:29 UTC
++++ components/os_crypt/sync/libsecret_util_linux.cc
+@@ -99,16 +99,22 @@ bool LibsecretLoader::LoadLibsecret() {
+
+ // static
+ bool LibsecretLoader::LoadLibsecret() {
++#if BUILDFLAG(IS_BSD)
++ const char* kSecretLib = "libsecret-1.so";
++#else
++ const char* kSecretLib = "libsecret-1.so.0";
++#endif
++
+ if (libsecret_loaded_)
+ return true;
+
+- static void* handle = dlopen("libsecret-1.so.0", RTLD_NOW | RTLD_GLOBAL);
++ static void* handle = dlopen(kSecretLib, RTLD_NOW | RTLD_GLOBAL);
+ if (!handle) {
+ // We wanted to use libsecret, but we couldn't load it. Warn, because
+ // either the user asked for this, or we autodetected it incorrectly. (Or
+ // the system has broken libraries, which is also good to warn about.)
+ // TODO(crbug.com/40467093): Channel this message to the user-facing log
+- VLOG(1) << "Could not load libsecret-1.so.0: " << dlerror();
++ VLOG(1) << "Could not load " << kSecretLib << ": " << dlerror();
+ return false;
+ }
+
diff --git a/devel/electron31/files/patch-components_os__crypt_sync_os__crypt.h b/devel/electron31/files/patch-components_os__crypt_sync_os__crypt.h
new file mode 100644
index 000000000000..3b80b3d2dbfa
--- /dev/null
+++ b/devel/electron31/files/patch-components_os__crypt_sync_os__crypt.h
@@ -0,0 +1,72 @@
+--- components/os_crypt/sync/os_crypt.h.orig 2023-05-25 00:41:51 UTC
++++ components/os_crypt/sync/os_crypt.h
+@@ -14,7 +14,7 @@
+ #include "build/build_config.h"
+ #include "build/chromecast_buildflags.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ class KeyStorageLinux;
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -23,7 +23,7 @@ class PrefRegistrySimple;
+ class PrefService;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ namespace crypto {
+ class SymmetricKey;
+ }
+@@ -36,7 +36,7 @@ struct Config;
+ // Temporary interface due to OSCrypt refactor. See OSCryptImpl for descriptions
+ // of what each function does.
+ namespace OSCrypt {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(OS_CRYPT)
+ void SetConfig(std::unique_ptr<os_crypt::Config> config);
+ #endif // BUILDFLAG(IS_LINUX)
+@@ -81,7 +81,7 @@ COMPONENT_EXPORT(OS_CRYPT) void UseMockKeyForTesting(b
+ COMPONENT_EXPORT(OS_CRYPT) void SetLegacyEncryptionForTesting(bool legacy);
+ COMPONENT_EXPORT(OS_CRYPT) void ResetStateForTesting();
+ #endif // BUILDFLAG(IS_WIN)
+-#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS))
++#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS)) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(OS_CRYPT)
+ void UseMockKeyStorageForTesting(
+ base::OnceCallback<std::unique_ptr<KeyStorageLinux>()>
+@@ -108,7 +108,7 @@ class COMPONENT_EXPORT(OS_CRYPT) OSCryptImpl {
+ // Returns singleton instance of OSCryptImpl.
+ static OSCryptImpl* GetInstance();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Set the configuration of OSCryptImpl.
+ // This method, or SetRawEncryptionKey(), must be called before using
+ // EncryptString() and DecryptString().
+@@ -200,7 +200,7 @@ class COMPONENT_EXPORT(OS_CRYPT) OSCryptImpl {
+ void ResetStateForTesting();
+ #endif
+
+-#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS))
++#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS)) || BUILDFLAG(IS_BSD)
+ // For unit testing purposes, inject methods to be used.
+ // |storage_provider_factory| provides the desired |KeyStorage|
+ // implementation. If the provider returns |nullptr|, a hardcoded password
+@@ -225,13 +225,13 @@ class COMPONENT_EXPORT(OS_CRYPT) OSCryptImpl {
+ crypto::SymmetricKey* GetEncryptionKey();
+ #endif // BUILDFLAG(IS_APPLE)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ // This lock is used to make the GetEncryptionKey and
+ // GetRawEncryptionKey methods thread-safe.
+ static base::Lock& GetLock();
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_APPLE)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Create the KeyStorage. Will be null if no service is found. A Config must
+ // be set before every call to this method.
+ std::unique_ptr<KeyStorageLinux> CreateKeyStorage();
diff --git a/devel/electron31/files/patch-components_paint__preview_browser_paint__preview__client.cc b/devel/electron31/files/patch-components_paint__preview_browser_paint__preview__client.cc
new file mode 100644
index 000000000000..7b30a6888c43
--- /dev/null
+++ b/devel/electron31/files/patch-components_paint__preview_browser_paint__preview__client.cc
@@ -0,0 +1,13 @@
+--- components/paint_preview/browser/paint_preview_client.cc.orig 2024-02-21 00:20:41 UTC
++++ components/paint_preview/browser/paint_preview_client.cc
+@@ -313,8 +313,8 @@ void PaintPreviewClient::CapturePaintPreview(
+ metadata->set_version(kPaintPreviewVersion);
+ auto* chromeVersion = metadata->mutable_chrome_version();
+ const auto& current_chrome_version = version_info::GetVersion();
+- chromeVersion->set_major(current_chrome_version.components()[0]);
+- chromeVersion->set_minor(current_chrome_version.components()[1]);
++ chromeVersion->set_gmajor(current_chrome_version.components()[0]);
++ chromeVersion->set_gminor(current_chrome_version.components()[1]);
+ chromeVersion->set_build(current_chrome_version.components()[2]);
+ chromeVersion->set_patch(current_chrome_version.components()[3]);
+ document_data.callback = std::move(callback);
diff --git a/devel/electron31/files/patch-components_paint__preview_browser_paint__preview__client__unittest.cc b/devel/electron31/files/patch-components_paint__preview_browser_paint__preview__client__unittest.cc
new file mode 100644
index 000000000000..7a82ebce22f2
--- /dev/null
+++ b/devel/electron31/files/patch-components_paint__preview_browser_paint__preview__client__unittest.cc
@@ -0,0 +1,13 @@
+--- components/paint_preview/browser/paint_preview_client_unittest.cc.orig 2024-02-21 00:20:41 UTC
++++ components/paint_preview/browser/paint_preview_client_unittest.cc
+@@ -174,8 +174,8 @@ TEST_P(PaintPreviewClientRenderViewHostTest, CaptureMa
+ metadata->set_version(kPaintPreviewVersion);
+ auto* chromeVersion = metadata->mutable_chrome_version();
+ const auto& current_chrome_version = version_info::GetVersion();
+- chromeVersion->set_major(current_chrome_version.components()[0]);
+- chromeVersion->set_minor(current_chrome_version.components()[1]);
++ chromeVersion->set_gmajor(current_chrome_version.components()[0]);
++ chromeVersion->set_gminor(current_chrome_version.components()[1]);
+ chromeVersion->set_build(current_chrome_version.components()[2]);
+ chromeVersion->set_patch(current_chrome_version.components()[3]);
+ PaintPreviewFrameProto* main_frame = expected_proto.mutable_root_frame();
diff --git a/devel/electron31/files/patch-components_paint__preview_common_proto_paint__preview.proto b/devel/electron31/files/patch-components_paint__preview_common_proto_paint__preview.proto
new file mode 100644
index 000000000000..7c3f6367e147
--- /dev/null
+++ b/devel/electron31/files/patch-components_paint__preview_common_proto_paint__preview.proto
@@ -0,0 +1,13 @@
+--- components/paint_preview/common/proto/paint_preview.proto.orig 2021-12-14 11:45:03 UTC
++++ components/paint_preview/common/proto/paint_preview.proto
+@@ -82,8 +82,8 @@ message PaintPreviewFrameProto {
+ // Stores Chrome version.
+ // NEXT_TAG = 5
+ message ChromeVersionProto {
+- optional uint64 major = 1;
+- optional uint64 minor = 2;
++ optional uint64 gmajor = 1;
++ optional uint64 gminor = 2;
+ optional uint64 build = 3;
+ optional uint64 patch = 4;
+ }
diff --git a/devel/electron31/files/patch-components_paint__preview_player_player__compositor__delegate.cc b/devel/electron31/files/patch-components_paint__preview_player_player__compositor__delegate.cc
new file mode 100644
index 000000000000..62f0f3d28ac2
--- /dev/null
+++ b/devel/electron31/files/patch-components_paint__preview_player_player__compositor__delegate.cc
@@ -0,0 +1,13 @@
+--- components/paint_preview/player/player_compositor_delegate.cc.orig 2024-06-18 21:43:29 UTC
++++ components/paint_preview/player/player_compositor_delegate.cc
+@@ -435,8 +435,8 @@ void PlayerCompositorDelegate::ValidateProtoAndLoadAXT
+ auto chrome_version = capture_result_->proto.metadata().chrome_version();
+ const auto& current_chrome_version = version_info::GetVersion();
+ if (capture_result_->proto.metadata().has_chrome_version() &&
+- chrome_version.major() == current_chrome_version.components()[0] &&
+- chrome_version.minor() == current_chrome_version.components()[1] &&
++ chrome_version.gmajor() == current_chrome_version.components()[0] &&
++ chrome_version.gminor() == current_chrome_version.components()[1] &&
+ chrome_version.build() == current_chrome_version.components()[2] &&
+ chrome_version.patch() == current_chrome_version.components()[3]) {
+ paint_preview_service_->GetFileMixin()->GetAXTreeUpdate(
diff --git a/devel/electron31/files/patch-components_password__manager_core_browser_features_password__features.cc b/devel/electron31/files/patch-components_password__manager_core_browser_features_password__features.cc
new file mode 100644
index 000000000000..0676ec4132bb
--- /dev/null
+++ b/devel/electron31/files/patch-components_password__manager_core_browser_features_password__features.cc
@@ -0,0 +1,20 @@
+--- components/password_manager/core/browser/features/password_features.cc.orig 2024-06-18 21:43:29 UTC
++++ components/password_manager/core/browser/features/password_features.cc
+@@ -36,7 +36,7 @@ BASE_FEATURE(kClearUndecryptablePasswordsOnSync,
+
+ BASE_FEATURE(kClearUndecryptablePasswordsOnSync,
+ "ClearUndecryptablePasswordsInSync",
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_IOS)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -98,7 +98,7 @@ BASE_FEATURE(kPasswordManualFallbackAvailable,
+ "PasswordManualFallbackAvailable",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kRestartToGainAccessToKeychain,
+ "RestartToGainAccessToKeychain",
+ #if BUILDFLAG(IS_MAC)
diff --git a/devel/electron31/files/patch-components_password__manager_core_browser_features_password__features.h b/devel/electron31/files/patch-components_password__manager_core_browser_features_password__features.h
new file mode 100644
index 000000000000..0c82978ed741
--- /dev/null
+++ b/devel/electron31/files/patch-components_password__manager_core_browser_features_password__features.h
@@ -0,0 +1,11 @@
+--- components/password_manager/core/browser/features/password_features.h.orig 2024-06-18 21:43:29 UTC
++++ components/password_manager/core/browser/features/password_features.h
+@@ -82,7 +82,7 @@ BASE_DECLARE_FEATURE(kPasswordManualFallbackAvailable)
+ // Enables triggering password suggestions through the context menu.
+ BASE_DECLARE_FEATURE(kPasswordManualFallbackAvailable);
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Enables "Needs access to keychain, restart chrome" bubble and banner.
+ BASE_DECLARE_FEATURE(kRestartToGainAccessToKeychain);
+ #endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
diff --git a/devel/electron31/files/patch-components_password__manager_core_browser_password__form__manager.cc b/devel/electron31/files/patch-components_password__manager_core_browser_password__form__manager.cc
new file mode 100644
index 000000000000..7a2451c032dc
--- /dev/null
+++ b/devel/electron31/files/patch-components_password__manager_core_browser_password__form__manager.cc
@@ -0,0 +1,29 @@
+--- components/password_manager/core/browser/password_form_manager.cc.orig 2024-06-18 21:43:29 UTC
++++ components/password_manager/core/browser/password_form_manager.cc
+@@ -58,7 +58,7 @@
+ #include "components/webauthn/android/webauthn_cred_man_delegate.h"
+ #endif // BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "components/os_crypt/sync/os_crypt.h"
+ #endif
+
+@@ -227,7 +227,7 @@ bool ShouldUploadCrowdsourcingVotes(const FormOrDigest
+ return false;
+ }
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool ShouldShowKeychainErrorBubble(
+ std::optional<PasswordStoreBackendError> backend_error) {
+ if (!backend_error.has_value()) {
+@@ -869,7 +869,7 @@ void PasswordFormManager::OnFetchCompleted() {
+ error.value().type);
+ }
+
+-#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (ShouldShowKeychainErrorBubble(
+ form_fetcher_->GetProfileStoreBackendError())) {
+ client_->NotifyKeychainError();
diff --git a/devel/electron31/files/patch-components_password__manager_core_browser_password__manager.cc b/devel/electron31/files/patch-components_password__manager_core_browser_password__manager.cc
new file mode 100644
index 000000000000..5b10c8dd10b2
--- /dev/null
+++ b/devel/electron31/files/patch-components_password__manager_core_browser_password__manager.cc
@@ -0,0 +1,11 @@
+--- components/password_manager/core/browser/password_manager.cc.orig 2024-06-18 21:43:29 UTC
++++ components/password_manager/core/browser/password_manager.cc
+@@ -373,7 +373,7 @@ void PasswordManager::RegisterProfilePrefs(
+ registry->RegisterListPref(prefs::kPasswordManagerPromoCardsList);
+ #endif // BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
+ registry->RegisterBooleanPref(prefs::kPasswordSharingEnabled, true);
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ registry->RegisterIntegerPref(prefs::kRelaunchChromeBubbleDismissedCounter,
+ 0);
+ #endif
diff --git a/devel/electron31/files/patch-components_password__manager_core_browser_password__manager__client.h b/devel/electron31/files/patch-components_password__manager_core_browser_password__manager__client.h
new file mode 100644
index 000000000000..780d67ea15e2
--- /dev/null
+++ b/devel/electron31/files/patch-components_password__manager_core_browser_password__manager__client.h
@@ -0,0 +1,20 @@
+--- components/password_manager/core/browser/password_manager_client.h.orig 2024-06-18 21:43:29 UTC
++++ components/password_manager/core/browser/password_manager_client.h
+@@ -30,7 +30,7 @@
+ #include "net/cert/cert_status_flags.h"
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/i18n/rtl.h"
+ #include "components/password_manager/core/browser/password_cross_domain_confirmation_popup_controller.h"
+ #include "ui/gfx/geometry/rect_f.h"
+@@ -505,7 +505,7 @@ class PasswordManagerClient {
+ virtual void RefreshPasswordManagerSettingsIfNeeded() const;
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Creates and show the cross domain confirmation popup.
+ virtual std::unique_ptr<PasswordCrossDomainConfirmationPopupController>
+ ShowCrossDomainConfirmationPopup(const gfx::RectF& element_bounds,
diff --git a/devel/electron31/files/patch-components_password__manager_core_browser_password__manager__switches.cc b/devel/electron31/files/patch-components_password__manager_core_browser_password__manager__switches.cc
new file mode 100644
index 000000000000..7824d2983de3
--- /dev/null
+++ b/devel/electron31/files/patch-components_password__manager_core_browser_password__manager__switches.cc
@@ -0,0 +1,11 @@
+--- components/password_manager/core/browser/password_manager_switches.cc.orig 2024-06-18 21:43:29 UTC
++++ components/password_manager/core/browser/password_manager_switches.cc
+@@ -6,7 +6,7 @@ namespace password_manager {
+
+ namespace password_manager {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Specifies which encryption storage backend to use. Possible values are
+ // kwallet, kwallet5, kwallet6, gnome-libsecret, basic.
+ // Any other value will lead to Chrome detecting the best backend automatically.
diff --git a/devel/electron31/files/patch-components_password__manager_core_browser_password__manager__switches.h b/devel/electron31/files/patch-components_password__manager_core_browser_password__manager__switches.h
new file mode 100644
index 000000000000..a88a89218dd2
--- /dev/null
+++ b/devel/electron31/files/patch-components_password__manager_core_browser_password__manager__switches.h
@@ -0,0 +1,11 @@
+--- components/password_manager/core/browser/password_manager_switches.h.orig 2024-06-18 21:43:29 UTC
++++ components/password_manager/core/browser/password_manager_switches.h
+@@ -10,7 +10,7 @@ namespace password_manager {
+
+ namespace password_manager {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ extern const char kPasswordStore[];
+ extern const char kEnableEncryptionSelection[];
+ #endif
diff --git a/devel/electron31/files/patch-components_password__manager_core_browser_password__manual__fallback__flow.cc b/devel/electron31/files/patch-components_password__manager_core_browser_password__manual__fallback__flow.cc
new file mode 100644
index 000000000000..754fb223ba71
--- /dev/null
+++ b/devel/electron31/files/patch-components_password__manager_core_browser_password__manual__fallback__flow.cc
@@ -0,0 +1,11 @@
+--- components/password_manager/core/browser/password_manual_fallback_flow.cc.orig 2024-06-18 21:43:29 UTC
++++ components/password_manager/core/browser/password_manual_fallback_flow.cc
+@@ -192,7 +192,7 @@ void PasswordManualFallbackFlow::DidAcceptSuggestion(
+ payload.password));
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (payload.is_cross_domain) {
+ cross_domain_confirmation_popup_controller_ =
+ password_client_->ShowCrossDomainConfirmationPopup(
diff --git a/devel/electron31/files/patch-components_password__manager_core_browser_password__manual__fallback__flow.h b/devel/electron31/files/patch-components_password__manager_core_browser_password__manual__fallback__flow.h
new file mode 100644
index 000000000000..a95332874413
--- /dev/null
+++ b/devel/electron31/files/patch-components_password__manager_core_browser_password__manual__fallback__flow.h
@@ -0,0 +1,20 @@
+--- components/password_manager/core/browser/password_manual_fallback_flow.h.orig 2024-06-18 21:43:29 UTC
++++ components/password_manager/core/browser/password_manual_fallback_flow.h
+@@ -18,7 +18,7 @@
+ #include "components/password_manager/core/browser/ui/saved_passwords_presenter.h"
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "components/password_manager/core/browser/password_cross_domain_confirmation_popup_controller.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) ||
+ // BUILDFLAG(IS_CHROMEOS)
+@@ -159,7 +159,7 @@ class PasswordManualFallbackFlow : public autofill::Au
+ std::unique_ptr<device_reauth::DeviceAuthenticator> authenticator_;
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<PasswordCrossDomainConfirmationPopupController>
+ cross_domain_confirmation_popup_controller_;
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) ||
diff --git a/devel/electron31/files/patch-components_password__manager_core_browser_password__store_login__database__async__helper.cc b/devel/electron31/files/patch-components_password__manager_core_browser_password__store_login__database__async__helper.cc
new file mode 100644
index 000000000000..ccd7dad8a5fd
--- /dev/null
+++ b/devel/electron31/files/patch-components_password__manager_core_browser_password__store_login__database__async__helper.cc
@@ -0,0 +1,11 @@
+--- components/password_manager/core/browser/password_store/login_database_async_helper.cc.orig 2024-06-18 21:43:29 UTC
++++ components/password_manager/core/browser/password_store/login_database_async_helper.cc
+@@ -149,7 +149,7 @@ LoginsResultOrError LoginDatabaseAsyncHelper::FillMatc
+ std::vector<PasswordForm> matched_forms;
+ if (!login_db_ ||
+ !login_db_->GetLogins(form, include_psl, &matched_forms)) {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return PasswordStoreBackendError(
+ OSCrypt::IsEncryptionAvailable()
+ ? PasswordStoreBackendErrorType::kUncategorized
diff --git a/devel/electron31/files/patch-components_password__manager_core_browser_password__store_login__database__unittest.cc b/devel/electron31/files/patch-components_password__manager_core_browser_password__store_login__database__unittest.cc
new file mode 100644
index 000000000000..3519e5d1687e
--- /dev/null
+++ b/devel/electron31/files/patch-components_password__manager_core_browser_password__store_login__database__unittest.cc
@@ -0,0 +1,11 @@
+--- components/password_manager/core/browser/password_store/login_database_unittest.cc.orig 2024-06-18 21:43:29 UTC
++++ components/password_manager/core/browser/password_store/login_database_unittest.cc
+@@ -2132,7 +2132,7 @@ INSTANTIATE_TEST_SUITE_P(MigrationToVCurrent,
+ LoginDatabaseMigrationTestBroken,
+ testing::Values(1, 2, 3, 24));
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_IOS)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD)
+ class LoginDatabaseUndecryptableLoginsTest : public testing::Test {
+ protected:
+ LoginDatabaseUndecryptableLoginsTest() = default;
diff --git a/devel/electron31/files/patch-components_password__manager_core_browser_stub__password__manager__client.cc b/devel/electron31/files/patch-components_password__manager_core_browser_stub__password__manager__client.cc
new file mode 100644
index 000000000000..d32b148cd751
--- /dev/null
+++ b/devel/electron31/files/patch-components_password__manager_core_browser_stub__password__manager__client.cc
@@ -0,0 +1,11 @@
+--- components/password_manager/core/browser/stub_password_manager_client.cc.orig 2024-06-18 21:43:29 UTC
++++ components/password_manager/core/browser/stub_password_manager_client.cc
+@@ -175,7 +175,7 @@ version_info::Channel StubPasswordManagerClient::GetCh
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<
+ password_manager::PasswordCrossDomainConfirmationPopupController>
+ StubPasswordManagerClient::ShowCrossDomainConfirmationPopup(
diff --git a/devel/electron31/files/patch-components_password__manager_core_browser_stub__password__manager__client.h b/devel/electron31/files/patch-components_password__manager_core_browser_stub__password__manager__client.h
new file mode 100644
index 000000000000..7804f489449d
--- /dev/null
+++ b/devel/electron31/files/patch-components_password__manager_core_browser_stub__password__manager__client.h
@@ -0,0 +1,11 @@
+--- components/password_manager/core/browser/stub_password_manager_client.h.orig 2024-06-18 21:43:29 UTC
++++ components/password_manager/core/browser/stub_password_manager_client.h
+@@ -74,7 +74,7 @@ class StubPasswordManagerClient : public PasswordManag
+ MockPasswordFeatureManager* GetPasswordFeatureManager();
+ version_info::Channel GetChannel() const override;
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<
+ password_manager::PasswordCrossDomainConfirmationPopupController>
+ ShowCrossDomainConfirmationPopup(
diff --git a/devel/electron31/files/patch-components_password__manager_core_browser_sync_password__sync__bridge.cc b/devel/electron31/files/patch-components_password__manager_core_browser_sync_password__sync__bridge.cc
new file mode 100644
index 000000000000..22cd53353a4b
--- /dev/null
+++ b/devel/electron31/files/patch-components_password__manager_core_browser_sync_password__sync__bridge.cc
@@ -0,0 +1,11 @@
+--- components/password_manager/core/browser/sync/password_sync_bridge.cc.orig 2024-06-18 21:43:29 UTC
++++ components/password_manager/core/browser/sync/password_sync_bridge.cc
+@@ -196,7 +196,7 @@ bool ShouldCleanSyncMetadataDuringStartupWhenDecryptio
+ }
+
+ bool ShouldCleanSyncMetadataDuringStartupWhenDecryptionFails() {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return ShouldRecoverPasswordsDuringMerge() &&
+ base::FeatureList::IsEnabled(
+ features::kForceInitialSyncWhenDecryptionFails);
diff --git a/devel/electron31/files/patch-components_password__manager_core_common_password__manager__features.cc b/devel/electron31/files/patch-components_password__manager_core_common_password__manager__features.cc
new file mode 100644
index 000000000000..ec78d5802b60
--- /dev/null
+++ b/devel/electron31/files/patch-components_password__manager_core_common_password__manager__features.cc
@@ -0,0 +1,11 @@
+--- components/password_manager/core/common/password_manager_features.cc.orig 2023-11-01 19:29:05 UTC
++++ components/password_manager/core/common/password_manager_features.cc
+@@ -18,7 +18,7 @@ BASE_FEATURE(kEnableOverwritingPlaceholderUsernames,
+ "EnableOverwritingPlaceholderUsernames",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // When enabled, initial sync will be forced during startup if the password
+ // store has encryption service failures.
+ BASE_FEATURE(kForceInitialSyncWhenDecryptionFails,
diff --git a/devel/electron31/files/patch-components_password__manager_core_common_password__manager__features.h b/devel/electron31/files/patch-components_password__manager_core_common_password__manager__features.h
new file mode 100644
index 000000000000..57e222050de8
--- /dev/null
+++ b/devel/electron31/files/patch-components_password__manager_core_common_password__manager__features.h
@@ -0,0 +1,11 @@
+--- components/password_manager/core/common/password_manager_features.h.orig 2023-11-29 21:39:58 UTC
++++ components/password_manager/core/common/password_manager_features.h
+@@ -19,7 +19,7 @@ BASE_DECLARE_FEATURE(kEnableOverwritingPlaceholderUser
+ // alongside the definition of their values in the .cc file.
+ BASE_DECLARE_FEATURE(kEnableOverwritingPlaceholderUsernames);
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ BASE_DECLARE_FEATURE(kForceInitialSyncWhenDecryptionFails);
+ #endif
+ BASE_DECLARE_FEATURE(kForgotPasswordFormSupport);
diff --git a/devel/electron31/files/patch-components_password__manager_core_common_password__manager__pref__names.h b/devel/electron31/files/patch-components_password__manager_core_common_password__manager__pref__names.h
new file mode 100644
index 000000000000..92a90001e9e3
--- /dev/null
+++ b/devel/electron31/files/patch-components_password__manager_core_common_password__manager__pref__names.h
@@ -0,0 +1,11 @@
+--- components/password_manager/core/common/password_manager_pref_names.h.orig 2024-06-18 21:43:29 UTC
++++ components/password_manager/core/common/password_manager_pref_names.h
+@@ -327,7 +327,7 @@ inline constexpr char kPasswordSharingEnabled[] =
+ inline constexpr char kPasswordSharingEnabled[] =
+ "password_manager.password_sharing_enabled";
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Integer pref indicating how many times relaunch Chrome bubble was dismissed.
+ inline constexpr char kRelaunchChromeBubbleDismissedCounter[] =
+ "password_manager.relaunch_chrome_bubble_dismissed_counter";
diff --git a/devel/electron31/files/patch-components_performance__manager_public_features.h b/devel/electron31/files/patch-components_performance__manager_public_features.h
new file mode 100644
index 000000000000..66c470b3852f
--- /dev/null
+++ b/devel/electron31/files/patch-components_performance__manager_public_features.h
@@ -0,0 +1,11 @@
+--- components/performance_manager/public/features.h.orig 2023-11-29 21:39:58 UTC
++++ components/performance_manager/public/features.h
+@@ -28,7 +28,7 @@ BASE_DECLARE_FEATURE(kRunOnDedicatedThreadPoolThread);
+
+ #if !BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #define URGENT_DISCARDING_FROM_PERFORMANCE_MANAGER() false
+ #else
+ #define URGENT_DISCARDING_FROM_PERFORMANCE_MANAGER() true
diff --git a/devel/electron31/files/patch-components_permissions_prediction__service_prediction__common.cc b/devel/electron31/files/patch-components_permissions_prediction__service_prediction__common.cc
new file mode 100644
index 000000000000..049516814c6a
--- /dev/null
+++ b/devel/electron31/files/patch-components_permissions_prediction__service_prediction__common.cc
@@ -0,0 +1,20 @@
+--- components/permissions/prediction_service/prediction_common.cc.orig 2022-08-31 12:19:35 UTC
++++ components/permissions/prediction_service/prediction_common.cc
+@@ -33,7 +33,7 @@ int BucketizeValue(int count) {
+
+ ClientFeatures_Platform GetCurrentPlatformProto() {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ return permissions::ClientFeatures_Platform_PLATFORM_DESKTOP;
+ #elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
+ return permissions::ClientFeatures_Platform_PLATFORM_MOBILE;
+@@ -44,7 +44,7 @@ ClientFeatures_Platform GetCurrentPlatformProto() {
+
+ ClientFeatures_PlatformEnum GetCurrentPlatformEnumProto() {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ return permissions::ClientFeatures_PlatformEnum_PLATFORM_DESKTOP_V2;
+ #elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
+ return permissions::ClientFeatures_PlatformEnum_PLATFORM_MOBILE_V2;
diff --git a/devel/electron31/files/patch-components_policy_core_browser_policy__pref__mapping__test.cc b/devel/electron31/files/patch-components_policy_core_browser_policy__pref__mapping__test.cc
new file mode 100644
index 000000000000..aed2fcd7e689
--- /dev/null
+++ b/devel/electron31/files/patch-components_policy_core_browser_policy__pref__mapping__test.cc
@@ -0,0 +1,11 @@
+--- components/policy/core/browser/policy_pref_mapping_test.cc.orig 2024-06-18 21:43:29 UTC
++++ components/policy/core/browser/policy_pref_mapping_test.cc
+@@ -411,7 +411,7 @@ class PolicyTestCase {
+ const std::string os("chromeos_lacros");
+ #elif BUILDFLAG(IS_IOS)
+ const std::string os("ios");
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const std::string os("linux");
+ #elif BUILDFLAG(IS_MAC)
+ const std::string os("mac");
diff --git a/devel/electron31/files/patch-components_policy_core_common_cloud_cloud__policy__client.cc b/devel/electron31/files/patch-components_policy_core_common_cloud_cloud__policy__client.cc
new file mode 100644
index 000000000000..c17ae1d02d6b
--- /dev/null
+++ b/devel/electron31/files/patch-components_policy_core_common_cloud_cloud__policy__client.cc
@@ -0,0 +1,11 @@
+--- components/policy/core/common/cloud/cloud_policy_client.cc.orig 2024-06-18 21:43:29 UTC
++++ components/policy/core/common/cloud/cloud_policy_client.cc
+@@ -647,7 +647,7 @@ void CloudPolicyClient::FetchPolicy(PolicyFetchReason
+ fetch_request->set_invalidation_payload(invalidation_payload_);
+ }
+ }
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Only set browser device identifier for CBCM Chrome cloud policy on
+ // desktop.
+ if (type_to_fetch.first ==
diff --git a/devel/electron31/files/patch-components_policy_core_common_cloud_cloud__policy__util.cc b/devel/electron31/files/patch-components_policy_core_common_cloud_cloud__policy__util.cc
new file mode 100644
index 000000000000..5d39634e2d79
--- /dev/null
+++ b/devel/electron31/files/patch-components_policy_core_common_cloud_cloud__policy__util.cc
@@ -0,0 +1,55 @@
+--- components/policy/core/common/cloud/cloud_policy_util.cc.orig 2024-04-15 20:33:55 UTC
++++ components/policy/core/common/cloud/cloud_policy_util.cc
+@@ -20,7 +20,7 @@
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || \
+- BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ #include <pwd.h>
+ #include <sys/types.h>
+ #include <unistd.h>
+@@ -35,10 +35,15 @@
+ #import <SystemConfiguration/SCDynamicStoreCopySpecific.h>
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #include <limits.h> // For HOST_NAME_MAX
+ #endif
+
++#if BUILDFLAG(IS_FREEBSD)
++#include <sys/param.h>
++#define HOST_NAME_MAX MAXHOSTNAMELEN
++#endif
++
+ #include <algorithm>
+ #include <utility>
+
+@@ -88,7 +93,7 @@ std::string GetMachineName() {
+
+ std::string GetMachineName() {
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ char hostname[HOST_NAME_MAX];
+ if (gethostname(hostname, HOST_NAME_MAX) == 0) // Success.
+ return hostname;
+@@ -145,7 +150,7 @@ std::string GetOSVersion() {
+
+ std::string GetOSVersion() {
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_APPLE) || \
+- BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ return base::SysInfo::OperatingSystemVersion();
+ #elif BUILDFLAG(IS_WIN)
+ base::win::OSInfo::VersionNumber version_number =
+@@ -168,7 +173,7 @@ std::string GetOSUsername() {
+ }
+
+ std::string GetOSUsername() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ struct passwd* creds = getpwuid(getuid());
+ if (!creds || !creds->pw_name)
+ return std::string();
diff --git a/devel/electron31/files/patch-components_policy_core_common_policy__loader__common.cc b/devel/electron31/files/patch-components_policy_core_common_policy__loader__common.cc
new file mode 100644
index 000000000000..45361d6caaf8
--- /dev/null
+++ b/devel/electron31/files/patch-components_policy_core_common_policy__loader__common.cc
@@ -0,0 +1,20 @@
+--- components/policy/core/common/policy_loader_common.cc.orig 2024-02-21 00:20:42 UTC
++++ components/policy/core/common/policy_loader_common.cc
+@@ -46,7 +46,7 @@ const char* kSensitivePolicies[] = {
+ key::kDefaultSearchProviderEnabled,
+ key::kSafeBrowsingEnabled,
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ key::kAutoOpenFileTypes,
+ key::kHomepageIsNewTabPage,
+ key::kPasswordProtectionChangePasswordURL,
+@@ -56,7 +56,7 @@ const char* kSensitivePolicies[] = {
+ key::kSafeBrowsingAllowlistDomains,
+ key::kSiteSearchSettings,
+ #endif
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ key::kCommandLineFlagSecurityWarningsEnabled,
+ #endif
+ #if !BUILDFLAG(IS_IOS)
diff --git a/devel/electron31/files/patch-components_policy_core_common_policy__paths.cc b/devel/electron31/files/patch-components_policy_core_common_policy__paths.cc
new file mode 100644
index 000000000000..1ebd68c8efb1
--- /dev/null
+++ b/devel/electron31/files/patch-components_policy_core_common_policy__paths.cc
@@ -0,0 +1,11 @@
+--- components/policy/core/common/policy_paths.cc.orig 2024-02-21 00:20:42 UTC
++++ components/policy/core/common/policy_paths.cc
+@@ -17,6 +17,8 @@ const char kPolicyPath[] = "/etc/opt/chrome_for_testin
+ const char kPolicyPath[] = "/etc/opt/chrome/policies";
+ #elif BUILDFLAG(GOOGLE_CHROME_FOR_TESTING_BRANDING)
+ const char kPolicyPath[] = "/etc/opt/chrome_for_testing/policies";
++#elif BUILDFLAG(IS_FREEBSD)
++const char kPolicyPath[] = "/usr/local/etc/chromium/policies";
+ #else
+ const char kPolicyPath[] = "/etc/chromium/policies";
+ #endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
diff --git a/devel/electron31/files/patch-components_policy_core_common_policy__utils.cc b/devel/electron31/files/patch-components_policy_core_common_policy__utils.cc
new file mode 100644
index 000000000000..bba3d4a1505f
--- /dev/null
+++ b/devel/electron31/files/patch-components_policy_core_common_policy__utils.cc
@@ -0,0 +1,11 @@
+--- components/policy/core/common/policy_utils.cc.orig 2024-02-21 00:20:42 UTC
++++ components/policy/core/common/policy_utils.cc
+@@ -28,7 +28,7 @@ bool IsPolicyTestingEnabled(PrefService* pref_service,
+ return true;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (channel == version_info::Channel::DEV) {
+ return true;
+ }
diff --git a/devel/electron31/files/patch-components_policy_tools_generate__policy__source.py b/devel/electron31/files/patch-components_policy_tools_generate__policy__source.py
new file mode 100644
index 000000000000..0394fe5f6220
--- /dev/null
+++ b/devel/electron31/files/patch-components_policy_tools_generate__policy__source.py
@@ -0,0 +1,14 @@
+--- components/policy/tools/generate_policy_source.py.orig 2024-04-15 20:33:55 UTC
++++ components/policy/tools/generate_policy_source.py
+@@ -38,9 +38,9 @@ PLATFORM_STRINGS = {
+ 'ios': ['ios'],
+ 'fuchsia': ['fuchsia'],
+ 'chrome.win': ['win'],
+- 'chrome.linux': ['linux'],
++ 'chrome.linux': ['linux', 'openbsd', 'freebsd'],
+ 'chrome.mac': ['mac'],
+- 'chrome.*': ['win', 'mac', 'linux'],
++ 'chrome.*': ['win', 'mac', 'linux', 'openbsd', 'freebsd'],
+ 'chrome.win7': ['win'],
+ }
+
diff --git a/devel/electron31/files/patch-components_power__metrics_BUILD.gn b/devel/electron31/files/patch-components_power__metrics_BUILD.gn
new file mode 100644
index 000000000000..5faa0a4e5e0c
--- /dev/null
+++ b/devel/electron31/files/patch-components_power__metrics_BUILD.gn
@@ -0,0 +1,11 @@
+--- components/power_metrics/BUILD.gn.orig 2023-10-19 19:58:19 UTC
++++ components/power_metrics/BUILD.gn
+@@ -41,7 +41,7 @@ static_library("power_metrics") {
+ ldflags = [ "/DELAYLOAD:setupapi.dll" ]
+ }
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux && !is_bsd) || is_chromeos) {
+ sources += [
+ "energy_metrics_provider_linux.cc",
+ "energy_metrics_provider_linux.h",
diff --git a/devel/electron31/files/patch-components_power__metrics_energy__metrics__provider.cc b/devel/electron31/files/patch-components_power__metrics_energy__metrics__provider.cc
new file mode 100644
index 000000000000..41e8a386d76f
--- /dev/null
+++ b/devel/electron31/files/patch-components_power__metrics_energy__metrics__provider.cc
@@ -0,0 +1,21 @@
+--- components/power_metrics/energy_metrics_provider.cc.orig 2023-08-10 01:48:41 UTC
++++ components/power_metrics/energy_metrics_provider.cc
+@@ -9,6 +9,8 @@
+ #include "components/power_metrics/energy_metrics_provider_win.h"
+ #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ #include "components/power_metrics/energy_metrics_provider_linux.h"
++#elif BUILDFLAG(IS_BSD)
++#include "base/notreached.h"
+ #endif // BUILDFLAG(IS_WIN)
+
+ namespace power_metrics {
+@@ -22,6 +24,9 @@ std::unique_ptr<EnergyMetricsProvider> EnergyMetricsPr
+ return EnergyMetricsProviderWin::Create();
+ #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ return EnergyMetricsProviderLinux::Create();
++#elif BUILDFLAG(IS_BSD)
++ NOTIMPLEMENTED();
++ return nullptr;
+ #else
+ return nullptr;
+ #endif // BUILDFLAG(IS_WIN)
diff --git a/devel/electron31/files/patch-components_safe__browsing_content_common_file__type__policies__unittest.cc b/devel/electron31/files/patch-components_safe__browsing_content_common_file__type__policies__unittest.cc
new file mode 100644
index 000000000000..85118f53a6f1
--- /dev/null
+++ b/devel/electron31/files/patch-components_safe__browsing_content_common_file__type__policies__unittest.cc
@@ -0,0 +1,11 @@
+--- components/safe_browsing/content/common/file_type_policies_unittest.cc.orig 2024-06-18 21:43:30 UTC
++++ components/safe_browsing/content/common/file_type_policies_unittest.cc
+@@ -139,7 +139,7 @@ TEST_F(FileTypePoliciesTest, UnpackResourceBundle) {
+ EXPECT_EQ(DownloadFileType::FULL_PING, file_type.ping_setting());
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ EXPECT_EQ(DownloadFileType::ALLOW_ON_USER_GESTURE,
+ file_type.platform_settings(0).danger_level());
+ EXPECT_EQ(DownloadFileType::DISALLOW_AUTO_OPEN,
diff --git a/devel/electron31/files/patch-components_safe__browsing_content_resources_gen__file__type__proto.py b/devel/electron31/files/patch-components_safe__browsing_content_resources_gen__file__type__proto.py
new file mode 100644
index 000000000000..a02717059420
--- /dev/null
+++ b/devel/electron31/files/patch-components_safe__browsing_content_resources_gen__file__type__proto.py
@@ -0,0 +1,20 @@
+--- components/safe_browsing/content/resources/gen_file_type_proto.py.orig 2023-02-01 18:43:17 UTC
++++ components/safe_browsing/content/resources/gen_file_type_proto.py
+@@ -38,6 +38,8 @@ def PlatformTypes():
+ "fuchsia":
+ download_file_types_pb2.DownloadFileType.PLATFORM_TYPE_FUCHSIA,
+ "linux": download_file_types_pb2.DownloadFileType.PLATFORM_TYPE_LINUX,
++ "openbsd": download_file_types_pb2.DownloadFileType.PLATFORM_TYPE_LINUX,
++ "freebsd": download_file_types_pb2.DownloadFileType.PLATFORM_TYPE_LINUX,
+ "mac": download_file_types_pb2.DownloadFileType.PLATFORM_TYPE_MAC,
+ "win": download_file_types_pb2.DownloadFileType.PLATFORM_TYPE_WINDOWS,
+ }
+@@ -181,7 +183,7 @@ class DownloadFileTypeProtoGenerator(BinaryProtoGenera
+ '-t',
+ '--type',
+ help='The platform type. One of android, chromeos, ' +
+- 'linux, mac, win')
++ 'linux, mac, win, openbsd, freebsd')
+
+ def AddExtraCommandLineArgsForVirtualEnvRun(self, opts, command):
+ if opts.type is not None:
diff --git a/devel/electron31/files/patch-components_safe__browsing_core_browser_db_v4__protocol__manager__util.cc b/devel/electron31/files/patch-components_safe__browsing_core_browser_db_v4__protocol__manager__util.cc
new file mode 100644
index 000000000000..ad5114b3eca9
--- /dev/null
+++ b/devel/electron31/files/patch-components_safe__browsing_core_browser_db_v4__protocol__manager__util.cc
@@ -0,0 +1,11 @@
+--- components/safe_browsing/core/browser/db/v4_protocol_manager_util.cc.orig 2024-06-18 21:43:30 UTC
++++ components/safe_browsing/core/browser/db/v4_protocol_manager_util.cc
+@@ -118,7 +118,7 @@ PlatformType GetCurrentPlatformType() {
+ PlatformType GetCurrentPlatformType() {
+ #if BUILDFLAG(IS_WIN)
+ return WINDOWS_PLATFORM;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return LINUX_PLATFORM;
+ #elif BUILDFLAG(IS_IOS)
+ return IOS_PLATFORM;
diff --git a/devel/electron31/files/patch-components_safe__browsing_core_browser_realtime_url__lookup__service__base.cc b/devel/electron31/files/patch-components_safe__browsing_core_browser_realtime_url__lookup__service__base.cc
new file mode 100644
index 000000000000..93c14e64b7f7
--- /dev/null
+++ b/devel/electron31/files/patch-components_safe__browsing_core_browser_realtime_url__lookup__service__base.cc
@@ -0,0 +1,11 @@
+--- components/safe_browsing/core/browser/realtime/url_lookup_service_base.cc.orig 2022-02-28 16:54:41 UTC
++++ components/safe_browsing/core/browser/realtime/url_lookup_service_base.cc
+@@ -109,7 +109,7 @@ RTLookupRequest::OSType GetRTLookupRequestOSType() {
+ return RTLookupRequest::OS_TYPE_FUCHSIA;
+ #elif BUILDFLAG(IS_IOS)
+ return RTLookupRequest::OS_TYPE_IOS;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return RTLookupRequest::OS_TYPE_LINUX;
+ #elif BUILDFLAG(IS_MAC)
+ return RTLookupRequest::OS_TYPE_MAC;
diff --git a/devel/electron31/files/patch-components_safe__browsing_core_common_features.cc b/devel/electron31/files/patch-components_safe__browsing_core_common_features.cc
new file mode 100644
index 000000000000..24a6d70b6e8d
--- /dev/null
+++ b/devel/electron31/files/patch-components_safe__browsing_core_common_features.cc
@@ -0,0 +1,11 @@
+--- components/safe_browsing/core/common/features.cc.orig 2024-06-18 21:43:30 UTC
++++ components/safe_browsing/core/common/features.cc
+@@ -160,7 +160,7 @@ BASE_FEATURE(kHashPrefixRealTimeLookups,
+ BASE_FEATURE(kHashPrefixRealTimeLookups,
+ "SafeBrowsingHashPrefixRealTimeLookups",
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_IOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
diff --git a/devel/electron31/files/patch-components_search__engines_search__engine__choice_search__engine__choice__service.cc b/devel/electron31/files/patch-components_search__engines_search__engine__choice_search__engine__choice__service.cc
new file mode 100644
index 000000000000..60cbe1f4fa4e
--- /dev/null
+++ b/devel/electron31/files/patch-components_search__engines_search__engine__choice_search__engine__choice__service.cc
@@ -0,0 +1,11 @@
+--- components/search_engines/search_engine_choice/search_engine_choice_service.cc.orig 2024-06-18 21:43:30 UTC
++++ components/search_engines/search_engine_choice/search_engine_choice_service.cc
+@@ -539,7 +539,7 @@ int SearchEngineChoiceService::GetCountryIdInternal()
+
+ int SearchEngineChoiceService::GetCountryIdInternal() {
+ // `country_codes::kCountryIDAtInstall` may not be set yet.
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On Android, ChromeOS and Linux, `country_codes::kCountryIDAtInstall` is
+ // computed asynchronously using platform-specific signals, and may not be
+ // available yet.
diff --git a/devel/electron31/files/patch-components_search__engines_template__url__service.cc b/devel/electron31/files/patch-components_search__engines_template__url__service.cc
new file mode 100644
index 000000000000..c043b133ce31
--- /dev/null
+++ b/devel/electron31/files/patch-components_search__engines_template__url__service.cc
@@ -0,0 +1,11 @@
+--- components/search_engines/template_url_service.cc.orig 2024-06-18 21:43:30 UTC
++++ components/search_engines/template_url_service.cc
+@@ -3096,7 +3096,7 @@ TemplateURLService::GetEnterpriseSiteSearchManager(Pre
+ std::unique_ptr<EnterpriseSiteSearchManager>
+ TemplateURLService::GetEnterpriseSiteSearchManager(PrefService* prefs) {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return base::FeatureList::IsEnabled(omnibox::kSiteSearchSettingsPolicy)
+ ? std::make_unique<EnterpriseSiteSearchManager>(
+ prefs, base::BindRepeating(
diff --git a/devel/electron31/files/patch-components_security__interstitials_content_utils.cc b/devel/electron31/files/patch-components_security__interstitials_content_utils.cc
new file mode 100644
index 000000000000..ce119e003a26
--- /dev/null
+++ b/devel/electron31/files/patch-components_security__interstitials_content_utils.cc
@@ -0,0 +1,11 @@
+--- components/security_interstitials/content/utils.cc.orig 2023-02-01 18:43:17 UTC
++++ components/security_interstitials/content/utils.cc
+@@ -38,7 +38,7 @@ void LaunchDateAndTimeSettings() {
+ #if BUILDFLAG(IS_ANDROID)
+ JNIEnv* env = base::android::AttachCurrentThread();
+ Java_DateAndTimeSettingsHelper_openDateAndTimeSettings(env);
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ struct ClockCommand {
+ const char* const pathname;
+ const char* const argument;
diff --git a/devel/electron31/files/patch-components_segmentation__platform_embedder_default__model_cross__device__user__segment.cc b/devel/electron31/files/patch-components_segmentation__platform_embedder_default__model_cross__device__user__segment.cc
new file mode 100644
index 000000000000..b288a715d454
--- /dev/null
+++ b/devel/electron31/files/patch-components_segmentation__platform_embedder_default__model_cross__device__user__segment.cc
@@ -0,0 +1,11 @@
+--- components/segmentation_platform/embedder/default_model/cross_device_user_segment.cc.orig 2023-11-29 21:39:59 UTC
++++ components/segmentation_platform/embedder/default_model/cross_device_user_segment.cc
+@@ -148,7 +148,7 @@ void CrossDeviceUserSegment::ExecuteModelWithInput(
+ // Check for current device type and subtract it from the device count
+ // calculation.
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ desktop_count -= 1;
+ #elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
+ if (ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET) {
diff --git a/devel/electron31/files/patch-components_services_paint__preview__compositor_paint__preview__compositor__collection__impl.cc b/devel/electron31/files/patch-components_services_paint__preview__compositor_paint__preview__compositor__collection__impl.cc
new file mode 100644
index 000000000000..a60ebb6e47d1
--- /dev/null
+++ b/devel/electron31/files/patch-components_services_paint__preview__compositor_paint__preview__compositor__collection__impl.cc
@@ -0,0 +1,29 @@
+--- components/services/paint_preview_compositor/paint_preview_compositor_collection_impl.cc.orig 2024-02-21 00:20:42 UTC
++++ components/services/paint_preview_compositor/paint_preview_compositor_collection_impl.cc
+@@ -22,7 +22,7 @@
+
+ #if BUILDFLAG(IS_WIN)
+ #include "content/public/child/dwrite_font_proxy_init_win.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "components/services/font/public/cpp/font_loader.h"
+ #endif
+
+@@ -79,7 +79,7 @@ PaintPreviewCompositorCollectionImpl::PaintPreviewComp
+ // Initialize font access for Skia.
+ #if BUILDFLAG(IS_WIN)
+ content::InitializeDWriteFontProxy();
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ mojo::PendingRemote<font_service::mojom::FontService> font_service;
+ content::UtilityThread::Get()->BindHostReceiver(
+ font_service.InitWithNewPipeAndPassReceiver());
+@@ -102,7 +102,7 @@ PaintPreviewCompositorCollectionImpl::PaintPreviewComp
+ base::BindOnce([] { skia::DefaultFontMgr(); }));
+
+ // Sanity check that fonts are working.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // No WebSandbox is provided on Linux so the local fonts aren't accessible.
+ // This is fine since since the subsetted fonts are provided in the SkPicture.
+ // However, we still need to check that the SkFontMgr starts as it is used by
diff --git a/devel/electron31/files/patch-components_signin_public_base_signin__switches.cc b/devel/electron31/files/patch-components_signin_public_base_signin__switches.cc
new file mode 100644
index 000000000000..ffa28124dd8f
--- /dev/null
+++ b/devel/electron31/files/patch-components_signin_public_base_signin__switches.cc
@@ -0,0 +1,20 @@
+--- components/signin/public/base/signin_switches.cc.orig 2024-06-18 21:43:30 UTC
++++ components/signin/public/base/signin_switches.cc
+@@ -135,7 +135,7 @@ bool IsExplicitBrowserSigninUIOnDesktopEnabled() {
+ }
+
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kMinorModeRestrictionsForHistorySyncOptIn,
+ "MinorModeRestrictionsForHistorySyncOptIn",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+@@ -144,7 +144,7 @@ constexpr int kMinorModeRestrictionsFetchDeadlineDefau
+ #if BUILDFLAG(IS_ANDROID)
+ // Based on Signin.AccountCapabilities.UserVisibleLatency
+ 400;
+-#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Based on Signin.SyncOptIn.PreSyncConfirmationLatency
+ 900;
+ #elif BUILDFLAG(IS_IOS)
diff --git a/devel/electron31/files/patch-components_signin_public_base_signin__switches.h b/devel/electron31/files/patch-components_signin_public_base_signin__switches.h
new file mode 100644
index 000000000000..afdb4604e593
--- /dev/null
+++ b/devel/electron31/files/patch-components_signin_public_base_signin__switches.h
@@ -0,0 +1,11 @@
+--- components/signin/public/base/signin_switches.h.orig 2024-06-18 21:43:30 UTC
++++ components/signin/public/base/signin_switches.h
+@@ -115,7 +115,7 @@ bool IsExplicitBrowserSigninUIOnDesktopEnabled();
+
+ // Controls the view mode for (history) sync screen.
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(SIGNIN_SWITCHES)
+ BASE_DECLARE_FEATURE(kMinorModeRestrictionsForHistorySyncOptIn);
+
diff --git a/devel/electron31/files/patch-components_soda_soda__util.cc b/devel/electron31/files/patch-components_soda_soda__util.cc
new file mode 100644
index 000000000000..340ca368fca2
--- /dev/null
+++ b/devel/electron31/files/patch-components_soda_soda__util.cc
@@ -0,0 +1,29 @@
+--- components/soda/soda_util.cc.orig 2024-06-18 21:43:30 UTC
++++ components/soda/soda_util.cc
+@@ -20,7 +20,7 @@
+ #include "base/win/windows_version.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_X86_FAMILY)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_X86_FAMILY)
+ #include "base/cpu.h"
+ #endif
+
+@@ -45,7 +45,7 @@ bool IsSupportedChromeOS() {
+ }
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool IsSupportedLinux() {
+ #if defined(ARCH_CPU_X86_FAMILY)
+ // Check if the CPU has the required instruction set to run the Speech
+@@ -76,7 +76,7 @@ bool IsOnDeviceSpeechRecognitionSupported() {
+ bool IsOnDeviceSpeechRecognitionSupported() {
+ #if BUILDFLAG(IS_CHROMEOS)
+ return IsSupportedChromeOS();
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return IsSupportedLinux();
+ #elif BUILDFLAG(IS_WIN)
+ return IsSupportedWin();
diff --git a/devel/electron31/files/patch-components_startup__metric__utils_common_startup__metric__utils.cc b/devel/electron31/files/patch-components_startup__metric__utils_common_startup__metric__utils.cc
new file mode 100644
index 000000000000..456c654c5a66
--- /dev/null
+++ b/devel/electron31/files/patch-components_startup__metric__utils_common_startup__metric__utils.cc
@@ -0,0 +1,11 @@
+--- components/startup_metric_utils/common/startup_metric_utils.cc.orig 2024-06-18 21:43:30 UTC
++++ components/startup_metric_utils/common/startup_metric_utils.cc
+@@ -85,7 +85,7 @@ base::TimeTicks CommonStartupMetricRecorder::StartupTi
+ // Enabling this logic on OS X causes a significant performance regression.
+ // TODO(crbug.com/40464036): Remove IS_APPLE ifdef once priority changes are
+ // ignored on Mac main thread.
+-#if !BUILDFLAG(IS_APPLE)
++#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD)
+ static bool statics_initialized = false;
+ if (!statics_initialized) {
+ statics_initialized = true;
diff --git a/devel/electron31/files/patch-components_storage__monitor_BUILD.gn b/devel/electron31/files/patch-components_storage__monitor_BUILD.gn
new file mode 100644
index 000000000000..36f7159c56fc
--- /dev/null
+++ b/devel/electron31/files/patch-components_storage__monitor_BUILD.gn
@@ -0,0 +1,20 @@
+--- components/storage_monitor/BUILD.gn.orig 2023-11-29 21:39:59 UTC
++++ components/storage_monitor/BUILD.gn
+@@ -77,7 +77,7 @@ static_library("storage_monitor") {
+ deps += [ "//services/device/public/mojom" ]
+ }
+ } else if (is_linux || is_chromeos_lacros) {
+- if (use_udev) {
++ if (use_udev && !is_bsd) {
+ sources += [
+ "mtab_watcher_linux.cc",
+ "mtab_watcher_linux.h",
+@@ -184,7 +184,7 @@ source_set("unit_tests") {
+ "storage_monitor_chromeos_unittest.cc",
+ ]
+ }
+- } else if (is_linux || is_chromeos_lacros) {
++ } else if ((is_linux || is_chromeos_lacros) && !is_bsd) {
+ if (use_udev) {
+ sources += [ "storage_monitor_linux_unittest.cc" ]
+ }
diff --git a/devel/electron31/files/patch-components_storage__monitor_removable__device__constants.cc b/devel/electron31/files/patch-components_storage__monitor_removable__device__constants.cc
new file mode 100644
index 000000000000..b5f275ed96b3
--- /dev/null
+++ b/devel/electron31/files/patch-components_storage__monitor_removable__device__constants.cc
@@ -0,0 +1,11 @@
+--- components/storage_monitor/removable_device_constants.cc.orig 2022-02-28 16:54:41 UTC
++++ components/storage_monitor/removable_device_constants.cc
+@@ -10,7 +10,7 @@ namespace storage_monitor {
+ const char kFSUniqueIdPrefix[] = "UUID:";
+ const char kVendorModelSerialPrefix[] = "VendorModelSerial:";
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kVendorModelVolumeStoragePrefix[] = "VendorModelVolumeStorage:";
+ #endif
+
diff --git a/devel/electron31/files/patch-components_storage__monitor_removable__device__constants.h b/devel/electron31/files/patch-components_storage__monitor_removable__device__constants.h
new file mode 100644
index 000000000000..71ac1f80d945
--- /dev/null
+++ b/devel/electron31/files/patch-components_storage__monitor_removable__device__constants.h
@@ -0,0 +1,11 @@
+--- components/storage_monitor/removable_device_constants.h.orig 2022-02-28 16:54:41 UTC
++++ components/storage_monitor/removable_device_constants.h
+@@ -14,7 +14,7 @@ namespace storage_monitor {
+ extern const char kFSUniqueIdPrefix[];
+ extern const char kVendorModelSerialPrefix[];
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ extern const char kVendorModelVolumeStoragePrefix[];
+ #endif
+
diff --git a/devel/electron31/files/patch-components_supervised__user_core_browser_supervised__user__preferences.cc b/devel/electron31/files/patch-components_supervised__user_core_browser_supervised__user__preferences.cc
new file mode 100644
index 000000000000..d736a84e2961
--- /dev/null
+++ b/devel/electron31/files/patch-components_supervised__user_core_browser_supervised__user__preferences.cc
@@ -0,0 +1,11 @@
+--- components/supervised_user/core/browser/supervised_user_preferences.cc.orig 2024-06-18 21:43:30 UTC
++++ components/supervised_user/core/browser/supervised_user_preferences.cc
+@@ -153,7 +153,7 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry
+ static_cast<int>(FirstTimeInterstitialBannerState::kUnknown));
+ registry->RegisterBooleanPref(prefs::kChildAccountStatusKnown, false);
+ #if BUILDFLAG(ENABLE_EXTENSIONS) && \
+- (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX))
++ (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))
+ registry->RegisterIntegerPref(
+ prefs::kLocallyParentApprovedExtensionsMigrationState,
+ static_cast<int>(
diff --git a/devel/electron31/files/patch-components_supervised__user_core_browser_supervised__user__service.cc b/devel/electron31/files/patch-components_supervised__user_core_browser_supervised__user__service.cc
new file mode 100644
index 000000000000..b27fbc7110bd
--- /dev/null
+++ b/devel/electron31/files/patch-components_supervised__user_core_browser_supervised__user__service.cc
@@ -0,0 +1,11 @@
+--- components/supervised_user/core/browser/supervised_user_service.cc.orig 2024-06-18 21:43:30 UTC
++++ components/supervised_user/core/browser/supervised_user_service.cc
+@@ -175,7 +175,7 @@ FirstTimeInterstitialBannerState SupervisedUserService
+ const FirstTimeInterstitialBannerState original_state) {
+ FirstTimeInterstitialBannerState target_state = original_state;
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_IOS)
++ BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD)
+ if (original_state != FirstTimeInterstitialBannerState::kSetupComplete &&
+ can_show_first_time_interstitial_banner_) {
+ target_state = FirstTimeInterstitialBannerState::kNeedToShow;
diff --git a/devel/electron31/files/patch-components_supervised__user_core_common_features.cc b/devel/electron31/files/patch-components_supervised__user_core_common_features.cc
new file mode 100644
index 000000000000..e924a02c500f
--- /dev/null
+++ b/devel/electron31/files/patch-components_supervised__user_core_common_features.cc
@@ -0,0 +1,20 @@
+--- components/supervised_user/core/common/features.cc.orig 2024-06-18 21:43:30 UTC
++++ components/supervised_user/core/common/features.cc
+@@ -59,7 +59,7 @@ BASE_FEATURE(kUpdatedSupervisedUserExtensionApprovalSt
+ "UpdatedSupervisedUserExtensionApprovalStrings",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kEnableExtensionsPermissionsForSupervisedUsersOnDesktop,
+ "EnableExtensionsPermissionsForSupervisedUsersOnDesktop",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+@@ -70,7 +70,7 @@ bool IsSupervisedUserSkipParentApprovalToInstallExtens
+ #if BUILDFLAG(IS_CHROMEOS)
+ return base::FeatureList::IsEnabled(
+ kEnableSupervisedUserSkipParentApprovalToInstallExtensions);
+-#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ bool skipParentApprovalEnabled = base::FeatureList::IsEnabled(
+ kEnableSupervisedUserSkipParentApprovalToInstallExtensions);
+ bool permissionExtensionsForSupervisedUsersEnabled =
diff --git a/devel/electron31/files/patch-components_supervised__user_core_common_features.h b/devel/electron31/files/patch-components_supervised__user_core_common_features.h
new file mode 100644
index 000000000000..f09d81d739ce
--- /dev/null
+++ b/devel/electron31/files/patch-components_supervised__user_core_common_features.h
@@ -0,0 +1,11 @@
+--- components/supervised_user/core/common/features.h.orig 2024-06-18 21:43:30 UTC
++++ components/supervised_user/core/common/features.h
+@@ -25,7 +25,7 @@ BASE_DECLARE_FEATURE(kUpdatedSupervisedUserExtensionAp
+ // Applies new informative strings during the parental extension approval flow.
+ BASE_DECLARE_FEATURE(kUpdatedSupervisedUserExtensionApprovalStrings);
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ BASE_DECLARE_FEATURE(kEnableExtensionsPermissionsForSupervisedUsersOnDesktop);
+ #endif
+
diff --git a/devel/electron31/files/patch-components_supervised__user_core_common_pref__names.h b/devel/electron31/files/patch-components_supervised__user_core_common_pref__names.h
new file mode 100644
index 000000000000..951ee70fd6e9
--- /dev/null
+++ b/devel/electron31/files/patch-components_supervised__user_core_common_pref__names.h
@@ -0,0 +1,11 @@
+--- components/supervised_user/core/common/pref_names.h.orig 2024-06-18 21:43:30 UTC
++++ components/supervised_user/core/common/pref_names.h
+@@ -136,7 +136,7 @@ inline constexpr char kFirstTimeInterstitialBannerStat
+ "profile.managed.banner_state";
+
+ #if BUILDFLAG(ENABLE_EXTENSIONS)
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // An integer pref that stores the current state of the local extension
+ // parent approval migration when the feature
+ // `kEnableSupervisedUserSkipParentApprovalToInstallExtensions` becomes enabled.
diff --git a/devel/electron31/files/patch-components_sync__device__info_local__device__info__util.cc b/devel/electron31/files/patch-components_sync__device__info_local__device__info__util.cc
new file mode 100644
index 000000000000..cfbfe798d844
--- /dev/null
+++ b/devel/electron31/files/patch-components_sync__device__info_local__device__info__util.cc
@@ -0,0 +1,29 @@
+--- components/sync_device_info/local_device_info_util.cc.orig 2024-06-18 21:43:30 UTC
++++ components/sync_device_info/local_device_info_util.cc
+@@ -84,7 +84,7 @@ sync_pb::SyncEnums::DeviceType GetLocalDeviceType() {
+ sync_pb::SyncEnums::DeviceType GetLocalDeviceType() {
+ #if BUILDFLAG(IS_CHROMEOS)
+ return sync_pb::SyncEnums_DeviceType_TYPE_CROS;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return sync_pb::SyncEnums_DeviceType_TYPE_LINUX;
+ #elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
+ switch (ui::GetDeviceFormFactor()) {
+@@ -109,7 +109,7 @@ DeviceInfo::OsType GetLocalDeviceOSType() {
+ return DeviceInfo::OsType::kChromeOsAsh;
+ #elif BUILDFLAG(IS_CHROMEOS_LACROS)
+ return DeviceInfo::OsType::kChromeOsLacros;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return DeviceInfo::OsType::kLinux;
+ #elif BUILDFLAG(IS_ANDROID)
+ return DeviceInfo::OsType::kAndroid;
+@@ -128,7 +128,7 @@ DeviceInfo::FormFactor GetLocalDeviceFormFactor() {
+
+ DeviceInfo::FormFactor GetLocalDeviceFormFactor() {
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ return DeviceInfo::FormFactor::kDesktop;
+ #elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
+ return ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET
diff --git a/devel/electron31/files/patch-components_sync__device__info_local__device__info__util__linux.cc b/devel/electron31/files/patch-components_sync__device__info_local__device__info__util__linux.cc
new file mode 100644
index 000000000000..1edb88b39884
--- /dev/null
+++ b/devel/electron31/files/patch-components_sync__device__info_local__device__info__util__linux.cc
@@ -0,0 +1,14 @@
+--- components/sync_device_info/local_device_info_util_linux.cc.orig 2022-09-24 10:57:32 UTC
++++ components/sync_device_info/local_device_info_util_linux.cc
+@@ -9,6 +9,11 @@
+
+ #include "base/linux_util.h"
+
++#if defined(__FreeBSD__)
++#include <sys/param.h>
++#define HOST_NAME_MAX MAXHOSTNAMELEN
++#endif
++
+ namespace syncer {
+
+ std::string GetPersonalizableDeviceNameInternal() {
diff --git a/devel/electron31/files/patch-components_system__cpu_cpu__probe.cc b/devel/electron31/files/patch-components_system__cpu_cpu__probe.cc
new file mode 100644
index 000000000000..c942af31f03e
--- /dev/null
+++ b/devel/electron31/files/patch-components_system__cpu_cpu__probe.cc
@@ -0,0 +1,12 @@
+--- components/system_cpu/cpu_probe.cc.orig 2024-02-21 00:20:43 UTC
++++ components/system_cpu/cpu_probe.cc
+@@ -30,6 +30,9 @@ std::unique_ptr<CpuProbe> CpuProbe::Create() {
+ return CpuProbeWin::Create();
+ #elif BUILDFLAG(IS_MAC)
+ return CpuProbeMac::Create();
++#elif BUILDFLAG(IS_BSD)
++ NOTIMPLEMENTED();
++ return nullptr;
+ #else
+ return nullptr;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
diff --git a/devel/electron31/files/patch-components_translate_core_common_translate__util.cc b/devel/electron31/files/patch-components_translate_core_common_translate__util.cc
new file mode 100644
index 000000000000..6f53bd06ff6b
--- /dev/null
+++ b/devel/electron31/files/patch-components_translate_core_common_translate__util.cc
@@ -0,0 +1,11 @@
+--- components/translate/core/common/translate_util.cc.orig 2023-10-19 19:58:21 UTC
++++ components/translate/core/common/translate_util.cc
+@@ -21,7 +21,7 @@ const char kSecurityOrigin[] = "https://translate.goog
+ BASE_FEATURE(kTFLiteLanguageDetectionEnabled,
+ "TFLiteLanguageDetectionEnabled",
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_MAC) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
diff --git a/devel/electron31/files/patch-components_update__client_update__query__params.cc b/devel/electron31/files/patch-components_update__client_update__query__params.cc
new file mode 100644
index 000000000000..b9b184514eab
--- /dev/null
+++ b/devel/electron31/files/patch-components_update__client_update__query__params.cc
@@ -0,0 +1,11 @@
+--- components/update_client/update_query_params.cc.orig 2023-08-10 01:48:42 UTC
++++ components/update_client/update_query_params.cc
+@@ -42,6 +42,8 @@ const char kOs[] =
+ "fuchsia";
+ #elif BUILDFLAG(IS_OPENBSD)
+ "openbsd";
++#elif defined(OS_FREEBSD)
++ "freebsd";
+ #else
+ #error "unknown os"
+ #endif
diff --git a/devel/electron31/files/patch-components_url__formatter_spoof__checks_idn__spoof__checker.cc b/devel/electron31/files/patch-components_url__formatter_spoof__checks_idn__spoof__checker.cc
new file mode 100644
index 000000000000..3c0a4f04dc0d
--- /dev/null
+++ b/devel/electron31/files/patch-components_url__formatter_spoof__checks_idn__spoof__checker.cc
@@ -0,0 +1,11 @@
+--- components/url_formatter/spoof_checks/idn_spoof_checker.cc.orig 2024-02-21 00:20:44 UTC
++++ components/url_formatter/spoof_checks/idn_spoof_checker.cc
+@@ -294,7 +294,7 @@ IDNSpoofChecker::IDNSpoofChecker() {
+ // The ideal fix would be to change the omnibox font used for Thai. In
+ // that case, the Linux-only list should be revisited and potentially
+ // removed.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ "[ทนบพรหเแ๐ดลปฟม]",
+ #else
+ "[บพเแ๐]",
diff --git a/devel/electron31/files/patch-components_user__education_views_help__bubble__view.cc b/devel/electron31/files/patch-components_user__education_views_help__bubble__view.cc
new file mode 100644
index 000000000000..0f3d81210aa2
--- /dev/null
+++ b/devel/electron31/files/patch-components_user__education_views_help__bubble__view.cc
@@ -0,0 +1,11 @@
+--- components/user_education/views/help_bubble_view.cc.orig 2024-06-18 21:43:31 UTC
++++ components/user_education/views/help_bubble_view.cc
+@@ -997,7 +997,7 @@ void HelpBubbleView::OnBeforeBubbleWidgetInit(views::W
+ void HelpBubbleView::OnBeforeBubbleWidgetInit(views::Widget::InitParams* params,
+ views::Widget* widget) const {
+ BubbleDialogDelegateView::OnBeforeBubbleWidgetInit(params, widget);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Help bubbles anchored to menus may be clipped to their anchors' bounds,
+ // resulting in visual errors, unless they use accelerated rendering. See
+ // crbug.com/1445770 for details.
diff --git a/devel/electron31/files/patch-components_variations_service_variations__service.cc b/devel/electron31/files/patch-components_variations_service_variations__service.cc
new file mode 100644
index 000000000000..f03786d0db6f
--- /dev/null
+++ b/devel/electron31/files/patch-components_variations_service_variations__service.cc
@@ -0,0 +1,11 @@
+--- components/variations/service/variations_service.cc.orig 2024-04-15 20:33:56 UTC
++++ components/variations/service/variations_service.cc
+@@ -99,7 +99,7 @@ std::string GetPlatformString() {
+ return "android";
+ #elif BUILDFLAG(IS_FUCHSIA)
+ return "fuchsia";
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) || BUILDFLAG(IS_SOLARIS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) || BUILDFLAG(IS_SOLARIS) || BUILDFLAG(IS_BSD)
+ // Default BSD and SOLARIS to Linux to not break those builds, although these
+ // platforms are not officially supported by Chrome.
+ return "linux";
diff --git a/devel/electron31/files/patch-components_viz_common_features.cc b/devel/electron31/files/patch-components_viz_common_features.cc
new file mode 100644
index 000000000000..132812a71930
--- /dev/null
+++ b/devel/electron31/files/patch-components_viz_common_features.cc
@@ -0,0 +1,20 @@
+--- components/viz/common/features.cc.orig 2024-06-18 21:43:31 UTC
++++ components/viz/common/features.cc
+@@ -251,7 +251,7 @@ BASE_FEATURE(kBufferQueueImageSetPurgeable,
+ "BufferQueueImageSetPurgeable",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On platforms using SkiaOutputDeviceBufferQueue and not yet universally using
+ // SkiaRenderer-allocated images, when this is true SkiaRenderer will allocate
+ // and maintain a buffer queue of images for the root render pass, instead of
+@@ -535,7 +535,7 @@ bool ShouldOnBeginFrameThrottleVideo() {
+ return base::FeatureList::IsEnabled(features::kOnBeginFrameThrottleVideo);
+ }
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool ShouldRendererAllocateImages() {
+ return base::FeatureList::IsEnabled(kRendererAllocatesImages);
+ }
diff --git a/devel/electron31/files/patch-components_viz_common_features.h b/devel/electron31/files/patch-components_viz_common_features.h
new file mode 100644
index 000000000000..854bc6ba0f1d
--- /dev/null
+++ b/devel/electron31/files/patch-components_viz_common_features.h
@@ -0,0 +1,20 @@
+--- components/viz/common/features.h.orig 2024-06-18 21:43:31 UTC
++++ components/viz/common/features.h
+@@ -74,7 +74,7 @@ VIZ_COMMON_EXPORT BASE_DECLARE_FEATURE(
+ VIZ_COMMON_EXPORT BASE_DECLARE_FEATURE(kAllowUndamagedNonrootRenderPassToSkip);
+ VIZ_COMMON_EXPORT BASE_DECLARE_FEATURE(
+ kAllowForceMergeRenderPassWithRequireOverlayQuads);
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ VIZ_COMMON_EXPORT BASE_DECLARE_FEATURE(kRendererAllocatesImages);
+ #endif
+ VIZ_COMMON_EXPORT BASE_DECLARE_FEATURE(kBufferQueueImageSetPurgeable);
+@@ -134,7 +134,7 @@ VIZ_COMMON_EXPORT bool ShouldOnBeginFrameThrottleVideo
+ VIZ_COMMON_EXPORT std::optional<double> IsDynamicSchedulerEnabledForClients();
+ VIZ_COMMON_EXPORT int MaxOverlaysConsidered();
+ VIZ_COMMON_EXPORT bool ShouldOnBeginFrameThrottleVideo();
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ VIZ_COMMON_EXPORT bool ShouldRendererAllocateImages();
+ #endif
+ VIZ_COMMON_EXPORT bool IsOnBeginFrameAcksEnabled();
diff --git a/devel/electron31/files/patch-components_viz_host_host__display__client.cc b/devel/electron31/files/patch-components_viz_host_host__display__client.cc
new file mode 100644
index 000000000000..2f19d205f5db
--- /dev/null
+++ b/devel/electron31/files/patch-components_viz_host_host__display__client.cc
@@ -0,0 +1,11 @@
+--- components/viz/host/host_display_client.cc.orig 2024-06-30 11:48:28 UTC
++++ components/viz/host/host_display_client.cc
+@@ -73,7 +73,7 @@ void HostDisplayClient::AddChildWindowToBrowser(
+ }
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ void HostDisplayClient::DidCompleteSwapWithNewSize(const gfx::Size& size) {
+ NOTIMPLEMENTED();
+ }
diff --git a/devel/electron31/files/patch-components_viz_host_host__display__client.h b/devel/electron31/files/patch-components_viz_host_host__display__client.h
new file mode 100644
index 000000000000..1d69922e1f9c
--- /dev/null
+++ b/devel/electron31/files/patch-components_viz_host_host__display__client.h
@@ -0,0 +1,11 @@
+--- components/viz/host/host_display_client.h.orig 2024-02-27 21:36:00 UTC
++++ components/viz/host/host_display_client.h
+@@ -53,7 +53,7 @@ class VIZ_HOST_EXPORT HostDisplayClient : public mojom
+ void AddChildWindowToBrowser(gpu::SurfaceHandle child_window) override;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ void DidCompleteSwapWithNewSize(const gfx::Size& size) override;
+ #endif // BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
+
diff --git a/devel/electron31/files/patch-components_viz_service_display__embedder_skia__output__device__buffer__queue.cc b/devel/electron31/files/patch-components_viz_service_display__embedder_skia__output__device__buffer__queue.cc
new file mode 100644
index 000000000000..797eb2c4c3c9
--- /dev/null
+++ b/devel/electron31/files/patch-components_viz_service_display__embedder_skia__output__device__buffer__queue.cc
@@ -0,0 +1,11 @@
+--- components/viz/service/display_embedder/skia_output_device_buffer_queue.cc.orig 2024-06-18 21:43:31 UTC
++++ components/viz/service/display_embedder/skia_output_device_buffer_queue.cc
+@@ -197,7 +197,7 @@ SkiaOutputDeviceBufferQueue::SkiaOutputDeviceBufferQue
+ capabilities_.only_invalidates_damage_rect = false;
+ capabilities_.number_of_buffers = 3;
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ capabilities_.renderer_allocates_images =
+ ::features::ShouldRendererAllocateImages();
+ #else
diff --git a/devel/electron31/files/patch-components_viz_service_display__embedder_skia__output__surface__impl.cc b/devel/electron31/files/patch-components_viz_service_display__embedder_skia__output__surface__impl.cc
new file mode 100644
index 000000000000..9c2746d9763d
--- /dev/null
+++ b/devel/electron31/files/patch-components_viz_service_display__embedder_skia__output__surface__impl.cc
@@ -0,0 +1,11 @@
+--- components/viz/service/display_embedder/skia_output_surface_impl.cc.orig 2024-06-18 21:43:31 UTC
++++ components/viz/service/display_embedder/skia_output_surface_impl.cc
+@@ -1522,7 +1522,7 @@ GrBackendFormat SkiaOutputSurfaceImpl::GetGrBackendFor
+ ->GetVulkanPhysicalDevice(),
+ VK_IMAGE_TILING_OPTIMAL, vk_format,
+ si_format, yuv_color_space, ycbcr_info);
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Textures that were allocated _on linux_ with ycbcr info came from
+ // VaapiVideoDecoder, which exports using DRM format modifiers.
+ return GrBackendFormats::MakeVk(gr_ycbcr_info,
diff --git a/devel/electron31/files/patch-components_viz_service_display__embedder_software__output__surface.cc b/devel/electron31/files/patch-components_viz_service_display__embedder_software__output__surface.cc
new file mode 100644
index 000000000000..78d0a54ad450
--- /dev/null
+++ b/devel/electron31/files/patch-components_viz_service_display__embedder_software__output__surface.cc
@@ -0,0 +1,20 @@
+--- components/viz/service/display_embedder/software_output_surface.cc.orig 2024-06-18 21:43:31 UTC
++++ components/viz/service/display_embedder/software_output_surface.cc
+@@ -124,7 +124,7 @@ void SoftwareOutputSurface::SwapBuffersCallback(base::
+ now.SnappedToNextTick(refresh_timebase_, refresh_interval_) - now;
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ if (needs_swap_size_notifications_)
+ client_->DidSwapWithSize(pixel_size);
+ #endif
+@@ -153,7 +153,7 @@ gfx::OverlayTransform SoftwareOutputSurface::GetDispla
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ void SoftwareOutputSurface::SetNeedsSwapSizeNotifications(
+ bool needs_swap_size_notifications) {
+ needs_swap_size_notifications_ = needs_swap_size_notifications;
diff --git a/devel/electron31/files/patch-components_viz_service_display__embedder_software__output__surface.h b/devel/electron31/files/patch-components_viz_service_display__embedder_software__output__surface.h
new file mode 100644
index 000000000000..83fbafb22faa
--- /dev/null
+++ b/devel/electron31/files/patch-components_viz_service_display__embedder_software__output__surface.h
@@ -0,0 +1,20 @@
+--- components/viz/service/display_embedder/software_output_surface.h.orig 2024-06-18 21:43:31 UTC
++++ components/viz/service/display_embedder/software_output_surface.h
+@@ -47,7 +47,7 @@ class VIZ_SERVICE_EXPORT SoftwareOutputSurface : publi
+ gfx::OverlayTransform GetDisplayTransform() override;
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ void SetNeedsSwapSizeNotifications(
+ bool needs_swap_size_notifications) override;
+ #endif
+@@ -70,7 +70,7 @@ class VIZ_SERVICE_EXPORT SoftwareOutputSurface : publi
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ bool needs_swap_size_notifications_ = false;
+ #endif
+
diff --git a/devel/electron31/files/patch-components_viz_service_display_skia__renderer.cc b/devel/electron31/files/patch-components_viz_service_display_skia__renderer.cc
new file mode 100644
index 000000000000..3324c41074b3
--- /dev/null
+++ b/devel/electron31/files/patch-components_viz_service_display_skia__renderer.cc
@@ -0,0 +1,11 @@
+--- components/viz/service/display/skia_renderer.cc.orig 2024-06-18 21:43:31 UTC
++++ components/viz/service/display/skia_renderer.cc
+@@ -1442,7 +1442,7 @@ void SkiaRenderer::ClearFramebuffer() {
+ if (current_frame()->current_render_pass->has_transparent_background) {
+ ClearCanvas(SkColors::kTransparent);
+ } else {
+-#if DCHECK_IS_ON() && !BUILDFLAG(IS_LINUX)
++#if DCHECK_IS_ON() && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ // On DEBUG builds, opaque render passes are cleared to blue
+ // to easily see regions that were not drawn on the screen.
+ // ClearCavas() call causes slight pixel difference, so linux-ref and
diff --git a/devel/electron31/files/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.cc b/devel/electron31/files/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.cc
new file mode 100644
index 000000000000..0bc334c90570
--- /dev/null
+++ b/devel/electron31/files/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.cc
@@ -0,0 +1,20 @@
+--- components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc.orig 2024-06-30 11:48:28 UTC
++++ components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc
+@@ -112,7 +112,7 @@ RootCompositorFrameSinkImpl::Create(
+ output_surface->SetNeedsSwapSizeNotifications(
+ params->send_swap_size_notifications);
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ // For X11, we need notify client about swap completion after resizing, so the
+ // client can use it for synchronize with X11 WM.
+ output_surface->SetNeedsSwapSizeNotifications(true);
+@@ -657,7 +657,7 @@ void RootCompositorFrameSinkImpl::DisplayDidCompleteSw
+ if (display_client_ && enable_swap_completion_callback_) {
+ display_client_->DidCompleteSwapWithSize(pixel_size);
+ }
+-#elif BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ if (display_client_ && pixel_size != last_swap_pixel_size_) {
+ last_swap_pixel_size_ = pixel_size;
+ display_client_->DidCompleteSwapWithNewSize(last_swap_pixel_size_);
diff --git a/devel/electron31/files/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.h b/devel/electron31/files/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.h
new file mode 100644
index 000000000000..7fe34b4ababe
--- /dev/null
+++ b/devel/electron31/files/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.h
@@ -0,0 +1,11 @@
+--- components/viz/service/frame_sinks/root_compositor_frame_sink_impl.h.orig 2024-04-15 20:33:57 UTC
++++ components/viz/service/frame_sinks/root_compositor_frame_sink_impl.h
+@@ -209,7 +209,7 @@ class VIZ_SERVICE_EXPORT RootCompositorFrameSinkImpl
+ // See comments on `EvictionHandler`.
+ EvictionHandler eviction_handler_;
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ gfx::Size last_swap_pixel_size_;
+ #endif // BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
+
diff --git a/devel/electron31/files/patch-components_viz_test_fake__display__client.cc b/devel/electron31/files/patch-components_viz_test_fake__display__client.cc
new file mode 100644
index 000000000000..5b3eeef68ad3
--- /dev/null
+++ b/devel/electron31/files/patch-components_viz_test_fake__display__client.cc
@@ -0,0 +1,11 @@
+--- components/viz/test/fake_display_client.cc.orig 2024-02-21 00:20:44 UTC
++++ components/viz/test/fake_display_client.cc
+@@ -27,7 +27,7 @@ void FakeDisplayClient::AddChildWindowToBrowser(
+ gpu::SurfaceHandle child_window) {}
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ void FakeDisplayClient::DidCompleteSwapWithNewSize(const gfx::Size& size) {}
+ #endif // BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
+
diff --git a/devel/electron31/files/patch-components_viz_test_fake__display__client.h b/devel/electron31/files/patch-components_viz_test_fake__display__client.h
new file mode 100644
index 000000000000..decdc418ca85
--- /dev/null
+++ b/devel/electron31/files/patch-components_viz_test_fake__display__client.h
@@ -0,0 +1,11 @@
+--- components/viz/test/fake_display_client.h.orig 2024-02-21 00:20:44 UTC
++++ components/viz/test/fake_display_client.h
+@@ -36,7 +36,7 @@ class FakeDisplayClient : public mojom::DisplayClient
+ void AddChildWindowToBrowser(gpu::SurfaceHandle child_window) override;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ void DidCompleteSwapWithNewSize(const gfx::Size& size) override;
+ #endif // BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
+
diff --git a/devel/electron31/files/patch-components_viz_test_mock__display__client.h b/devel/electron31/files/patch-components_viz_test_mock__display__client.h
new file mode 100644
index 000000000000..6f676641d0b5
--- /dev/null
+++ b/devel/electron31/files/patch-components_viz_test_mock__display__client.h
@@ -0,0 +1,11 @@
+--- components/viz/test/mock_display_client.h.orig 2024-02-21 00:20:44 UTC
++++ components/viz/test/mock_display_client.h
+@@ -43,7 +43,7 @@ class MockDisplayClient : public mojom::DisplayClient
+ MOCK_METHOD1(SetWideColorEnabled, void(bool enabled));
+ MOCK_METHOD1(SetPreferredRefreshRate, void(float refresh_rate));
+ #endif
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ MOCK_METHOD1(DidCompleteSwapWithNewSize, void(const gfx::Size&));
+ #endif // BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
+
diff --git a/devel/electron31/files/patch-content_app_content__main.cc b/devel/electron31/files/patch-content_app_content__main.cc
new file mode 100644
index 000000000000..36c31884be7c
--- /dev/null
+++ b/devel/electron31/files/patch-content_app_content__main.cc
@@ -0,0 +1,11 @@
+--- content/app/content_main.cc.orig 2024-06-30 11:48:29 UTC
++++ content/app/content_main.cc
+@@ -206,7 +206,7 @@ RunContentProcess(ContentMainParams params,
+ #endif
+ base::EnableTerminationOnOutOfMemory();
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // The various desktop environments set this environment variable that
+ // allows the dbus client library to connect directly to the bus. When this
+ // variable is not set (test environments like xvfb-run), the dbus client
diff --git a/devel/electron31/files/patch-content_app_content__main__runner__impl.cc b/devel/electron31/files/patch-content_app_content__main__runner__impl.cc
new file mode 100644
index 000000000000..33d5b6e6c73d
--- /dev/null
+++ b/devel/electron31/files/patch-content_app_content__main__runner__impl.cc
@@ -0,0 +1,129 @@
+--- content/app/content_main_runner_impl.cc.orig 2024-06-30 11:48:30 UTC
++++ content/app/content_main_runner_impl.cc
+@@ -145,18 +145,20 @@
+ #include "content/browser/posix_file_descriptor_info_impl.h"
+ #include "content/public/common/content_descriptors.h"
+
+-#if !BUILDFLAG(IS_MAC)
++#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD)
+ #include "content/public/common/zygote/zygote_fork_delegate_linux.h"
+ #endif
+
+ #endif // BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/files/file_path_watcher_inotify.h"
+ #include "base/native_library.h"
+ #include "base/rand_util.h"
+ #include "content/public/common/zygote/sandbox_support_linux.h"
++#if !BUILDFLAG(IS_BSD)
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+ #include "third_party/boringssl/src/include/openssl/crypto.h"
+ #include "third_party/webrtc_overrides/init_webrtc.h" // nogncheck
+
+@@ -190,6 +192,10 @@
+ #include "media/base/media_switches.h"
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include "base/system/sys_info.h"
++#endif
++
+ #if BUILDFLAG(IS_ANDROID)
+ #include "base/system/sys_info.h"
+ #include "content/browser/android/battery_metrics.h"
+@@ -388,7 +394,7 @@ void InitializeZygoteSandboxForBrowserProcess(
+ }
+ #endif // BUILDFLAG(USE_ZYGOTE)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ #if BUILDFLAG(ENABLE_PPAPI)
+ // Loads the (native) libraries but does not initialize them (i.e., does not
+@@ -426,7 +432,10 @@ void PreSandboxInit() {
+
+ void PreSandboxInit() {
+ // Ensure the /dev/urandom is opened.
++ // we use arc4random
++#if !BUILDFLAG(IS_BSD)
+ base::GetUrandomFD();
++#endif
+
+ // May use sysinfo(), sched_getaffinity(), and open various /sys/ and /proc/
+ // files.
+@@ -438,9 +447,16 @@ void PreSandboxInit() {
+ // https://boringssl.googlesource.com/boringssl/+/HEAD/SANDBOXING.md
+ CRYPTO_pre_sandbox_init();
+
++#if BUILDFLAG(IS_BSD)
++ // "cache" the amount of physical memory before pledge(2)
++ base::SysInfo::AmountOfPhysicalMemoryMB();
++#endif
++
++#if !BUILDFLAG(IS_BSD)
+ // Pre-read /proc/sys/fs/inotify/max_user_watches so it doesn't have to be
+ // allowed by the sandbox.
+ base::GetMaxNumberOfInotifyWatches();
++#endif
+
+ #if BUILDFLAG(ENABLE_PPAPI)
+ // Ensure access to the Pepper plugins before the sandbox is turned on.
+@@ -851,11 +867,10 @@ int ContentMainRunnerImpl::Initialize(ContentMainParam
+ base::GlobalDescriptors::kBaseDescriptor);
+ #endif // !BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OPENBSD)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ g_fds->Set(kCrashDumpSignal,
+ kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor);
+-#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ||
+- // BUILDFLAG(IS_OPENBSD)
++#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+ #endif // !BUILDFLAG(IS_WIN)
+
+@@ -1042,8 +1057,20 @@ int ContentMainRunnerImpl::Initialize(ContentMainParam
+ process_type == switches::kZygoteProcess) {
+ PreSandboxInit();
+ }
++#elif BUILDFLAG(IS_BSD)
++ PreSandboxInit();
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++ if (process_type.empty()) {
++ sandbox::policy::SandboxLinux::Options sandbox_options;
++ sandbox::policy::SandboxLinux::GetInstance()->InitializeSandbox(
++ sandbox::policy::SandboxTypeFromCommandLine(
++ *base::CommandLine::ForCurrentProcess()),
++ sandbox::policy::SandboxLinux::PreSandboxHook(), sandbox_options);
++ }
++#endif
++
+ delegate_->SandboxInitialized(process_type);
+
+ #if BUILDFLAG(USE_ZYGOTE)
+@@ -1118,7 +1145,7 @@ int NO_STACK_PROTECTOR ContentMainRunnerImpl::Run() {
+ ->ReconfigureAfterFeatureListInit(process_type);
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // If dynamic Mojo Core is being used, ensure that it's loaded very early in
+ // the child/zygote process, before any sandbox is initialized. The library
+ // is not fully initialized with IPC support until a ChildProcess is later
+@@ -1153,6 +1180,11 @@ int NO_STACK_PROTECTOR ContentMainRunnerImpl::Run() {
+ content_main_params_.reset();
+
+ RegisterMainThreadFactories();
++
++#if BUILDFLAG(IS_BSD)
++ if (!process_type.empty())
++ PreSandboxInit();
++#endif
+
+ if (process_type.empty())
+ return RunBrowser(std::move(main_params), start_minimal_browser);
diff --git a/devel/electron31/files/patch-content_browser_BUILD.gn b/devel/electron31/files/patch-content_browser_BUILD.gn
new file mode 100644
index 000000000000..581c28a3c00d
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_BUILD.gn
@@ -0,0 +1,16 @@
+--- content/browser/BUILD.gn.orig 2024-06-30 11:48:28 UTC
++++ content/browser/BUILD.gn
+@@ -2409,6 +2409,13 @@ source_set("browser") {
+ deps += [ "//media/mojo/mojom/stable:stable_video_decoder" ]
+ }
+
++ if (is_bsd) {
++ sources -= [
++ "sandbox_ipc_linux.cc",
++ "sandbox_ipc_linux.h",
++ ]
++ }
++
+ if (is_chromeos) {
+ sources += [
+ "handwriting/handwriting_recognition_service_impl_cros.cc",
diff --git a/devel/electron31/files/patch-content_browser_audio_audio__service.cc b/devel/electron31/files/patch-content_browser_audio_audio__service.cc
new file mode 100644
index 000000000000..2fa79f446dde
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_audio_audio__service.cc
@@ -0,0 +1,20 @@
+--- content/browser/audio/audio_service.cc.orig 2024-06-18 21:43:31 UTC
++++ content/browser/audio/audio_service.cc
+@@ -32,7 +32,7 @@
+ #if BUILDFLAG(ENABLE_PASSTHROUGH_AUDIO_CODECS)
+ #include "ui/display/util/edid_parser.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/display/display_util.h"
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -200,7 +200,7 @@ audio::mojom::AudioService& GetAudioService() {
+ ->PostTaskAndReplyWithResult(
+ FROM_HERE, base::BindOnce(&ScanEdidBitstreams),
+ base::BindOnce(&LaunchAudioService, std::move(receiver)));
+-#elif BUILDFLAG(ENABLE_PASSTHROUGH_AUDIO_CODECS) && BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(ENABLE_PASSTHROUGH_AUDIO_CODECS) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))
+ LaunchAudioService(
+ std::move(receiver),
+ ConvertEdidBitstreams(display::DisplayUtil::GetAudioFormats()));
diff --git a/devel/electron31/files/patch-content_browser_browser__child__process__host__impl.cc b/devel/electron31/files/patch-content_browser_browser__child__process__host__impl.cc
new file mode 100644
index 000000000000..46764857ed1e
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_browser__child__process__host__impl.cc
@@ -0,0 +1,19 @@
+--- content/browser/browser_child_process_host_impl.cc.orig 2024-06-18 21:43:31 UTC
++++ content/browser/browser_child_process_host_impl.cc
+@@ -330,6 +330,7 @@ void BrowserChildProcessHostImpl::LaunchWithoutExtraCo
+ switches::kMojoCoreLibraryPath,
+ switches::kPerfettoDisableInterning,
+ switches::kTraceToConsole,
++ switches::kDisableUnveil,
+ };
+ cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches);
+
+@@ -658,7 +659,7 @@ void BrowserChildProcessHostImpl::OnProcessLaunched()
+ ->child_process());
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ child_thread_type_switcher_.SetPid(process.Pid());
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
diff --git a/devel/electron31/files/patch-content_browser_browser__child__process__host__impl.h b/devel/electron31/files/patch-content_browser_browser__child__process__host__impl.h
new file mode 100644
index 000000000000..43cdeae35739
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_browser__child__process__host__impl.h
@@ -0,0 +1,20 @@
+--- content/browser/browser_child_process_host_impl.h.orig 2024-06-18 21:43:31 UTC
++++ content/browser/browser_child_process_host_impl.h
+@@ -35,7 +35,7 @@
+ #include "base/win/object_watcher.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/browser/child_thread_type_switcher_linux.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+@@ -273,7 +273,7 @@ class BrowserChildProcessHostImpl
+ std::unique_ptr<tracing::SystemTracingService> system_tracing_service_;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ChildThreadTypeSwitcher child_thread_type_switcher_;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
diff --git a/devel/electron31/files/patch-content_browser_browser__child__process__host__impl__receiver__bindings.cc b/devel/electron31/files/patch-content_browser_browser__child__process__host__impl__receiver__bindings.cc
new file mode 100644
index 000000000000..6e61caae18dd
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_browser__child__process__host__impl__receiver__bindings.cc
@@ -0,0 +1,11 @@
+--- content/browser/browser_child_process_host_impl_receiver_bindings.cc.orig 2023-11-29 21:40:01 UTC
++++ content/browser/browser_child_process_host_impl_receiver_bindings.cc
+@@ -62,7 +62,7 @@ void BrowserChildProcessHostImpl::BindHostReceiver(
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (auto r = receiver.As<mojom::ThreadTypeSwitcher>()) {
+ child_thread_type_switcher_.Bind(std::move(r));
+ return;
diff --git a/devel/electron31/files/patch-content_browser_browser__main__loop.cc b/devel/electron31/files/patch-content_browser_browser__main__loop.cc
new file mode 100644
index 000000000000..e54c9fbe1ee2
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_browser__main__loop.cc
@@ -0,0 +1,37 @@
+--- content/browser/browser_main_loop.cc.orig 2024-06-18 21:43:31 UTC
++++ content/browser/browser_main_loop.cc
+@@ -249,6 +249,12 @@
+ #include "mojo/public/cpp/bindings/lib/test_random_mojo_delays.h"
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include "content/browser/sandbox_host_linux.h"
++#include "content/public/common/zygote/sandbox_support_linux.h"
++#include "sandbox/policy/sandbox.h"
++#endif
++
+ // One of the linux specific headers defines this as a macro.
+ #ifdef DestroyAll
+ #undef DestroyAll
+@@ -554,6 +560,12 @@ int BrowserMainLoop::EarlyInitialization() {
+ // by now since a thread to start the ServiceManager has been created
+ // before the browser main loop starts.
+ DCHECK(SandboxHostLinux::GetInstance()->IsInitialized());
++#elif BUILDFLAG(IS_BSD)
++ base::FileHandleMappingVector additional_remapped_fds;
++ base::LaunchOptions options;
++ SandboxHostLinux::GetInstance()->Init();
++ const int sfd = SandboxHostLinux::GetInstance()->GetChildSocket();
++ options.fds_to_remap.push_back(std::make_pair(sfd, GetSandboxFD()));
+ #endif
+
+ // GLib's spawning of new processes is buggy, so it's important that at this
+@@ -591,7 +603,7 @@ int BrowserMainLoop::EarlyInitialization() {
+ base::PlatformThread::SetCurrentThreadType(base::ThreadType::kCompositing);
+
+ #if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // We use quite a few file descriptors for our IPC as well as disk the disk
+ // cache, and the default limit on Apple is low (256), so bump it up.
+
diff --git a/devel/electron31/files/patch-content_browser_child__process__launcher__helper.h b/devel/electron31/files/patch-content_browser_child__process__launcher__helper.h
new file mode 100644
index 000000000000..4b2964e00f1d
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_child__process__launcher__helper.h
@@ -0,0 +1,11 @@
+--- content/browser/child_process_launcher_helper.h.orig 2024-06-18 21:43:31 UTC
++++ content/browser/child_process_launcher_helper.h
+@@ -297,7 +297,7 @@ class ChildProcessLauncherHelper
+ std::optional<base::ProcessId> process_id_ = std::nullopt;
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // The priority of the process. The state is stored to avoid changing the
+ // setting repeatedly.
+ std::optional<base::Process::Priority> priority_;
diff --git a/devel/electron31/files/patch-content_browser_child__process__launcher__helper__linux.cc b/devel/electron31/files/patch-content_browser_child__process__launcher__helper__linux.cc
new file mode 100644
index 000000000000..d01e9a9af7e3
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_child__process__launcher__helper__linux.cc
@@ -0,0 +1,139 @@
+--- content/browser/child_process_launcher_helper_linux.cc.orig 2024-06-30 11:48:30 UTC
++++ content/browser/child_process_launcher_helper_linux.cc
+@@ -22,7 +22,9 @@
+ #include "content/public/common/result_codes.h"
+ #include "content/public/common/sandboxed_process_launcher_delegate.h"
+ #include "content/public/common/zygote/sandbox_support_linux.h"
++#if !BUILDFLAG(IS_BSD)
+ #include "content/public/common/zygote/zygote_handle.h"
++#endif
+ #include "sandbox/policy/linux/sandbox_linux.h"
+
+ namespace content {
+@@ -47,14 +49,20 @@ bool ChildProcessLauncherHelper::IsUsingLaunchOptions(
+ }
+
+ bool ChildProcessLauncherHelper::IsUsingLaunchOptions() {
++#if !BUILDFLAG(IS_BSD)
+ return !GetZygoteForLaunch();
++#else
++ return true;
++#endif
+ }
+
+ bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread(
+ PosixFileDescriptorInfo& files_to_register,
+ base::LaunchOptions* options) {
+ if (options) {
++#if !BUILDFLAG(IS_BSD)
+ DCHECK(!GetZygoteForLaunch());
++#endif
+ // Convert FD mapping to FileHandleMappingVector
+ options->fds_to_remap = files_to_register.GetMappingWithIDAdjustment(
+ base::GlobalDescriptors::kBaseDescriptor);
+@@ -69,6 +77,7 @@ bool ChildProcessLauncherHelper::BeforeLaunchOnLaunche
+ remapped_fd.first);
+ }
+
++#if !BUILDFLAG(IS_BSD)
+ // (For Electron), if we're launching without zygote, that means we're
+ // launching an unsandboxed process (since all sandboxed processes are
+ // forked from the zygote). Relax the allow_new_privs option to permit
+@@ -77,12 +86,15 @@ bool ChildProcessLauncherHelper::BeforeLaunchOnLaunche
+ delegate_->GetZygote() == nullptr) {
+ options->allow_new_privs = true;
+ }
++#endif
+
+ options->current_directory = delegate_->GetCurrentDirectory();
+ options->environment = delegate_->GetEnvironment();
+ options->clear_environment = !delegate_->ShouldInheritEnvironment();
+ } else {
++#if !BUILDFLAG(IS_BSD)
+ DCHECK(GetZygoteForLaunch());
++#endif
+ // Environment variables could be supported in the future, but are not
+ // currently supported when launching with the zygote.
+ DCHECK(delegate_->GetEnvironment().empty());
+@@ -99,6 +111,7 @@ ChildProcessLauncherHelper::LaunchProcessOnLauncherThr
+ int* launch_result) {
+ *is_synchronous_launch = true;
+ Process process;
++#if !BUILDFLAG(IS_BSD)
+ ZygoteCommunication* zygote_handle = GetZygoteForLaunch();
+ if (zygote_handle) {
+ // TODO(crbug.com/40448989): If chrome supported multiple zygotes they could
+@@ -109,7 +122,6 @@ ChildProcessLauncherHelper::LaunchProcessOnLauncherThr
+ GetProcessType());
+ *launch_result = LAUNCH_RESULT_SUCCESS;
+
+-#if !BUILDFLAG(IS_OPENBSD)
+ if (handle) {
+ // It could be a renderer process or an utility process.
+ int oom_score = content::kMiscOomScore;
+@@ -118,15 +130,17 @@ ChildProcessLauncherHelper::LaunchProcessOnLauncherThr
+ oom_score = content::kLowestRendererOomScore;
+ ZygoteHostImpl::GetInstance()->AdjustRendererOOMScore(handle, oom_score);
+ }
+-#endif
+
+ process.process = base::Process(handle);
+ process.zygote = zygote_handle;
+ } else {
++#endif
+ process.process = base::LaunchProcess(*command_line(), *options);
+ *launch_result = process.process.IsValid() ? LAUNCH_RESULT_SUCCESS
+ : LAUNCH_RESULT_FAILURE;
++#if !BUILDFLAG(IS_BSD)
+ }
++#endif
+
+ #if BUILDFLAG(IS_CHROMEOS)
+ process_id_ = process.process.Pid();
+@@ -150,10 +164,14 @@ ChildProcessTerminationInfo ChildProcessLauncherHelper
+ const ChildProcessLauncherHelper::Process& process,
+ bool known_dead) {
+ ChildProcessTerminationInfo info;
++#if !BUILDFLAG(IS_BSD)
+ if (process.zygote) {
+ info.status = process.zygote->GetTerminationStatus(
+ process.process.Handle(), known_dead, &info.exit_code);
+ } else if (known_dead) {
++#else
++ if (known_dead) {
++#endif
+ info.status = base::GetKnownDeadTerminationStatus(process.process.Handle(),
+ &info.exit_code);
+ } else {
+@@ -179,13 +197,17 @@ void ChildProcessLauncherHelper::ForceNormalProcessTer
+ DCHECK(CurrentlyOnProcessLauncherTaskRunner());
+ process.process.Terminate(RESULT_CODE_NORMAL_EXIT, false);
+ // On POSIX, we must additionally reap the child.
++#if !BUILDFLAG(IS_BSD)
+ if (process.zygote) {
+ // If the renderer was created via a zygote, we have to proxy the reaping
+ // through the zygote process.
+ process.zygote->EnsureProcessTerminated(process.process.Handle());
+ } else {
++#endif
+ base::EnsureProcessTerminated(std::move(process.process));
++#if !BUILDFLAG(IS_BSD)
+ }
++#endif
+ }
+
+ void ChildProcessLauncherHelper::SetProcessPriorityOnLauncherThread(
+@@ -198,11 +220,13 @@ void ChildProcessLauncherHelper::SetProcessPriorityOnL
+ }
+ }
+
++#if !BUILDFLAG(IS_BSD)
+ ZygoteCommunication* ChildProcessLauncherHelper::GetZygoteForLaunch() {
+ return base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoZygote)
+ ? nullptr
+ : delegate_->GetZygote();
+ }
++#endif
+
+ base::File OpenFileToShare(const base::FilePath& path,
+ base::MemoryMappedFile::Region* region) {
diff --git a/devel/electron31/files/patch-content_browser_child__thread__type__switcher__linux.cc b/devel/electron31/files/patch-content_browser_child__thread__type__switcher__linux.cc
new file mode 100644
index 000000000000..005f15a97084
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_child__thread__type__switcher__linux.cc
@@ -0,0 +1,20 @@
+--- content/browser/child_thread_type_switcher_linux.cc.orig 2024-06-18 21:43:31 UTC
++++ content/browser/child_thread_type_switcher_linux.cc
+@@ -20,6 +20,9 @@ void SetThreadTypeOnLauncherThread(base::ProcessId pee
+ base::ThreadType thread_type) {
+ DCHECK(CurrentlyOnProcessLauncherTaskRunner());
+
++#if BUILDFLAG(IS_BSD)
++ NOTIMPLEMENTED();
++#else
+ bool ns_pid_supported = false;
+ pid_t peer_tid = base::FindThreadID(peer_pid, ns_tid, &ns_pid_supported);
+ if (peer_tid == -1) {
+@@ -38,6 +41,7 @@ void SetThreadTypeOnLauncherThread(base::ProcessId pee
+
+ base::PlatformThread::SetThreadType(peer_pid, peer_tid, thread_type,
+ base::IsViaIPC(true));
++#endif
+ }
+
+ } // namespace
diff --git a/devel/electron31/files/patch-content_browser_compositor_viz__process__transport__factory.cc b/devel/electron31/files/patch-content_browser_compositor_viz__process__transport__factory.cc
new file mode 100644
index 000000000000..de946031c430
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_compositor_viz__process__transport__factory.cc
@@ -0,0 +1,11 @@
+--- content/browser/compositor/viz_process_transport_factory.cc.orig 2024-04-28 08:50:04 UTC
++++ content/browser/compositor/viz_process_transport_factory.cc
+@@ -105,7 +105,7 @@ class HostDisplayClient : public viz::HostDisplayClien
+ HostDisplayClient& operator=(const HostDisplayClient&) = delete;
+
+ // viz::HostDisplayClient:
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ void DidCompleteSwapWithNewSize(const gfx::Size& size) override {
+ compositor_->OnCompleteSwapWithNewSize(size);
+ }
diff --git a/devel/electron31/files/patch-content_browser_devtools_devtools__frontend__host__impl.cc b/devel/electron31/files/patch-content_browser_devtools_devtools__frontend__host__impl.cc
new file mode 100644
index 000000000000..46dc874f5dac
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_devtools_devtools__frontend__host__impl.cc
@@ -0,0 +1,38 @@
+--- content/browser/devtools/devtools_frontend_host_impl.cc.orig 2023-11-29 21:40:01 UTC
++++ content/browser/devtools/devtools_frontend_host_impl.cc
+@@ -22,7 +22,7 @@
+ #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
+ #include "ui/base/webui/resource_path.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "components/crash/content/browser/error_reporting/javascript_error_report.h" // nogncheck
+ #include "components/crash/content/browser/error_reporting/js_error_report_processor.h" // nogncheck
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+@@ -37,7 +37,7 @@ const char kCompatibilityScriptSourceURL[] =
+ "\n//# "
+ "sourceURL=devtools://devtools/bundled/devtools_compatibility.js";
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Remove the pieces of the URL we don't want to send back with the error
+ // reports. In particular, do not send query or fragments as those can have
+ // privacy-sensitive information in them.
+@@ -107,7 +107,7 @@ DevToolsFrontendHostImpl::DevToolsFrontendHostImpl(
+ const HandleMessageCallback& handle_message_callback)
+ : web_contents_(WebContents::FromRenderFrameHost(frame_host)),
+ handle_message_callback_(handle_message_callback) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ Observe(web_contents_);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ mojo::AssociatedRemote<blink::mojom::DevToolsFrontend> frontend;
+@@ -132,7 +132,7 @@ void DevToolsFrontendHostImpl::DispatchEmbedderMessage
+ handle_message_callback_.Run(std::move(message));
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void DevToolsFrontendHostImpl::OnDidAddMessageToConsole(
+ RenderFrameHost* source_frame,
+ blink::mojom::ConsoleMessageLevel log_level,
diff --git a/devel/electron31/files/patch-content_browser_devtools_devtools__frontend__host__impl.h b/devel/electron31/files/patch-content_browser_devtools_devtools__frontend__host__impl.h
new file mode 100644
index 000000000000..d256342eeb1f
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_devtools_devtools__frontend__host__impl.h
@@ -0,0 +1,11 @@
+--- content/browser/devtools/devtools_frontend_host_impl.h.orig 2024-06-18 21:43:31 UTC
++++ content/browser/devtools/devtools_frontend_host_impl.h
+@@ -34,7 +34,7 @@ class DevToolsFrontendHostImpl : public DevToolsFronte
+
+ void BadMessageReceived() override;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void OnDidAddMessageToConsole(
+ RenderFrameHost* source_frame,
+ blink::mojom::ConsoleMessageLevel log_level,
diff --git a/devel/electron31/files/patch-content_browser_devtools_protocol_system__info__handler.cc b/devel/electron31/files/patch-content_browser_devtools_protocol_system__info__handler.cc
new file mode 100644
index 000000000000..ea62d0d1d001
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_devtools_protocol_system__info__handler.cc
@@ -0,0 +1,11 @@
+--- content/browser/devtools/protocol/system_info_handler.cc.orig 2024-06-18 21:43:31 UTC
++++ content/browser/devtools/protocol/system_info_handler.cc
+@@ -51,7 +51,7 @@ std::unique_ptr<SystemInfo::Size> GfxSizeToSystemInfoS
+ // 1046598, and 1153667.
+ // Windows builds need more time -- see Issue 873112 and 1004472.
+ // Mac builds need more time - see Issue angleproject:6182.
+-#if ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !defined(NDEBUG)) || \
++#if ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && !defined(NDEBUG)) || \
+ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_OZONE)
+ static constexpr int kGPUInfoWatchdogTimeoutMultiplierOS = 3;
+ #else
diff --git a/devel/electron31/files/patch-content_browser_file__system__access_file__system__access__local__path__watcher.cc b/devel/electron31/files/patch-content_browser_file__system__access_file__system__access__local__path__watcher.cc
new file mode 100644
index 000000000000..4e606a366979
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_file__system__access_file__system__access__local__path__watcher.cc
@@ -0,0 +1,11 @@
+--- content/browser/file_system_access/file_system_access_local_path_watcher.cc.orig 2024-06-18 21:43:31 UTC
++++ content/browser/file_system_access/file_system_access_local_path_watcher.cc
+@@ -64,7 +64,7 @@ void FileSystemAccessLocalPathWatcher::Initialize(
+ .type = scope().IsRecursive()
+ ? base::FilePathWatcher::Type::kRecursive
+ : base::FilePathWatcher::Type::kNonRecursive,
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Note: `report_modified_path` is also present on Android
+ // and Fuchsia. Update this switch if support for watching
+ // the local file system is added on those platforms.
diff --git a/devel/electron31/files/patch-content_browser_font__access_font__enumeration__data__source.cc b/devel/electron31/files/patch-content_browser_font__access_font__enumeration__data__source.cc
new file mode 100644
index 000000000000..c97bace8497b
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_font__access_font__enumeration__data__source.cc
@@ -0,0 +1,29 @@
+--- content/browser/font_access/font_enumeration_data_source.cc.orig 2023-11-29 21:40:01 UTC
++++ content/browser/font_access/font_enumeration_data_source.cc
+@@ -16,7 +16,7 @@
+ #include "content/browser/font_access/font_enumeration_data_source_win.h"
+ #elif BUILDFLAG(IS_APPLE)
+ #include "content/browser/font_access/font_enumeration_data_source_mac.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/browser/font_access/font_enumeration_data_source_linux.h"
+ #endif // BUILDFLAG(IS_WIN)
+
+@@ -61,7 +61,7 @@ std::unique_ptr<FontEnumerationDataSource> FontEnumera
+ return std::make_unique<FontEnumerationDataSourceWin>();
+ #elif BUILDFLAG(IS_APPLE)
+ return std::make_unique<FontEnumerationDataSourceMac>();
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return std::make_unique<FontEnumerationDataSourceLinux>();
+ #else
+ return std::make_unique<FontEnumerationDataSourceNull>();
+@@ -76,7 +76,7 @@ bool FontEnumerationDataSource::IsOsSupported() {
+ return true;
+ #elif BUILDFLAG(IS_APPLE)
+ return true;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return true;
+ #else
+ return false;
diff --git a/devel/electron31/files/patch-content_browser_gpu_compositor__util.cc b/devel/electron31/files/patch-content_browser_gpu_compositor__util.cc
new file mode 100644
index 000000000000..a444d882e4c6
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_gpu_compositor__util.cc
@@ -0,0 +1,20 @@
+--- content/browser/gpu/compositor_util.cc.orig 2024-04-15 20:33:57 UTC
++++ content/browser/gpu/compositor_util.cc
+@@ -149,7 +149,7 @@ std::vector<GpuFeatureData> GetGpuFeatureData(
+ "video_decode",
+ SafeGetFeatureStatus(
+ gpu_feature_info, gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE,
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ !base::FeatureList::IsEnabled(media::kVaapiVideoDecodeLinux) ||
+ #endif // BUILDFLAG(IS_LINUX)
+ command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode)),
+@@ -161,7 +161,7 @@ std::vector<GpuFeatureData> GetGpuFeatureData(
+ "video_encode",
+ SafeGetFeatureStatus(
+ gpu_feature_info, gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE,
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ !base::FeatureList::IsEnabled(media::kVaapiVideoEncodeLinux)),
+ #else
+ command_line.HasSwitch(switches::kDisableAcceleratedVideoEncode)),
diff --git a/devel/electron31/files/patch-content_browser_gpu_gpu__data__manager__impl.cc b/devel/electron31/files/patch-content_browser_gpu_gpu__data__manager__impl.cc
new file mode 100644
index 000000000000..71ce4768a922
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_gpu_gpu__data__manager__impl.cc
@@ -0,0 +1,11 @@
+--- content/browser/gpu/gpu_data_manager_impl.cc.orig 2024-06-18 21:43:31 UTC
++++ content/browser/gpu/gpu_data_manager_impl.cc
+@@ -397,7 +397,7 @@ void GpuDataManagerImpl::OnDisplayMetricsChanged(
+ private_->OnDisplayMetricsChanged(display, changed_metrics);
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool GpuDataManagerImpl::IsGpuMemoryBufferNV12Supported() {
+ base::AutoLock auto_lock(lock_);
+ return private_->IsGpuMemoryBufferNV12Supported();
diff --git a/devel/electron31/files/patch-content_browser_gpu_gpu__data__manager__impl.h b/devel/electron31/files/patch-content_browser_gpu_gpu__data__manager__impl.h
new file mode 100644
index 000000000000..e2f961d05be6
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_gpu_gpu__data__manager__impl.h
@@ -0,0 +1,11 @@
+--- content/browser/gpu/gpu_data_manager_impl.h.orig 2024-06-18 21:43:31 UTC
++++ content/browser/gpu/gpu_data_manager_impl.h
+@@ -219,7 +219,7 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDa
+ void OnDisplayMetricsChanged(const display::Display& display,
+ uint32_t changed_metrics) override;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool IsGpuMemoryBufferNV12Supported();
+ void SetGpuMemoryBufferNV12Supported(bool supported);
+ #endif // BUILDFLAG(IS_LINUX)
diff --git a/devel/electron31/files/patch-content_browser_gpu_gpu__data__manager__impl__private.cc b/devel/electron31/files/patch-content_browser_gpu_gpu__data__manager__impl__private.cc
new file mode 100644
index 000000000000..2d95e1dc7b85
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_gpu_gpu__data__manager__impl__private.cc
@@ -0,0 +1,11 @@
+--- content/browser/gpu/gpu_data_manager_impl_private.cc.orig 2024-06-18 21:43:31 UTC
++++ content/browser/gpu/gpu_data_manager_impl_private.cc
+@@ -1692,7 +1692,7 @@ void GpuDataManagerImplPrivate::RecordCompositingMode(
+ UMA_HISTOGRAM_ENUMERATION("GPU.CompositingMode", compositing_mode);
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool GpuDataManagerImplPrivate::IsGpuMemoryBufferNV12Supported() {
+ return is_gpu_memory_buffer_NV12_supported_;
+ }
diff --git a/devel/electron31/files/patch-content_browser_gpu_gpu__data__manager__impl__private.h b/devel/electron31/files/patch-content_browser_gpu_gpu__data__manager__impl__private.h
new file mode 100644
index 000000000000..02b49bcb4fac
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_gpu_gpu__data__manager__impl__private.h
@@ -0,0 +1,20 @@
+--- content/browser/gpu/gpu_data_manager_impl_private.h.orig 2024-03-15 05:15:49 UTC
++++ content/browser/gpu/gpu_data_manager_impl_private.h
+@@ -150,7 +150,7 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {
+ void OnDisplayMetricsChanged(const display::Display& display,
+ uint32_t changed_metrics);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool IsGpuMemoryBufferNV12Supported();
+ void SetGpuMemoryBufferNV12Supported(bool supported);
+ #endif // BUILDFLAG(IS_LINUX)
+@@ -302,7 +302,7 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {
+ bool application_is_visible_ = true;
+
+ bool disable_gpu_compositing_ = false;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool is_gpu_memory_buffer_NV12_supported_ = false;
+ #endif // BUILDFLAG(IS_LINUX)
+ };
diff --git a/devel/electron31/files/patch-content_browser_gpu_gpu__memory__buffer__manager__singleton.cc b/devel/electron31/files/patch-content_browser_gpu_gpu__memory__buffer__manager__singleton.cc
new file mode 100644
index 000000000000..e07837f0b0e9
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_gpu_gpu__memory__buffer__manager__singleton.cc
@@ -0,0 +1,20 @@
+--- content/browser/gpu/gpu_memory_buffer_manager_singleton.cc.orig 2024-02-21 00:20:44 UTC
++++ content/browser/gpu/gpu_memory_buffer_manager_singleton.cc
+@@ -54,7 +54,7 @@ scoped_refptr<base::SingleThreadTaskRunner> GetTaskRun
+ #endif
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool IsGpuMemoryBufferNV12Supported() {
+ static bool is_computed = false;
+ static bool supported = false;
+@@ -117,7 +117,7 @@ void GpuMemoryBufferManagerSingleton::OnGpuExtraInfoUp
+ SetNativeConfigurations(std::move(configs));
+ }
+ #endif // BUILDFLAG(IS_OZONE_X11)
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Dynamic check whether the NV12 format is supported as it may be
+ // inconsistent between the system GBM (Generic Buffer Management) and
+ // chromium miniGBM.
diff --git a/devel/electron31/files/patch-content_browser_gpu_gpu__process__host.cc b/devel/electron31/files/patch-content_browser_gpu_gpu__process__host.cc
new file mode 100644
index 000000000000..34ead99028eb
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_gpu_gpu__process__host.cc
@@ -0,0 +1,19 @@
+--- content/browser/gpu/gpu_process_host.cc.orig 2024-06-18 21:43:31 UTC
++++ content/browser/gpu/gpu_process_host.cc
+@@ -268,6 +268,7 @@ static const char* const kSwitchNames[] = {
+ switches::kEnableLowEndDeviceMode,
+ switches::kDisableSkiaGraphite,
+ switches::kDisableLowEndDeviceMode,
++ switches::kDisableUnveil,
+ switches::kProfilingAtStart,
+ switches::kProfilingFile,
+ switches::kProfilingFlush,
+@@ -295,7 +296,7 @@ static const char* const kSwitchNames[] = {
+ switches::kOzoneDumpFile,
+ switches::kEnableNativeGpuMemoryBuffers,
+ #endif
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ switches::kX11Display,
+ switches::kNoXshm,
+ #endif
diff --git a/devel/electron31/files/patch-content_browser_media_frameless__media__interface__proxy.h b/devel/electron31/files/patch-content_browser_media_frameless__media__interface__proxy.h
new file mode 100644
index 000000000000..63e7fbd6c280
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_media_frameless__media__interface__proxy.h
@@ -0,0 +1,20 @@
+--- content/browser/media/frameless_media_interface_proxy.h.orig 2024-06-18 21:43:31 UTC
++++ content/browser/media/frameless_media_interface_proxy.h
+@@ -19,7 +19,7 @@
+ #include "mojo/public/cpp/bindings/receiver_set.h"
+ #include "mojo/public/cpp/bindings/remote.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "media/mojo/mojom/stable/stable_video_decoder.mojom.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+@@ -105,7 +105,7 @@ class FramelessMediaInterfaceProxy final
+ // Connections to the renderer.
+ mojo::ReceiverSet<media::mojom::InterfaceFactory> receivers_;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Connection to the StableVideoDecoderFactory that lives in a utility
+ // process. This is only used for out-of-process video decoding and only when
+ // the FramelessMediaInterfaceProxy is created without a RenderProcessHost
diff --git a/devel/electron31/files/patch-content_browser_media_media__keys__listener__manager__impl.cc b/devel/electron31/files/patch-content_browser_media_media__keys__listener__manager__impl.cc
new file mode 100644
index 000000000000..f77f05077cd6
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_media_media__keys__listener__manager__impl.cc
@@ -0,0 +1,11 @@
+--- content/browser/media/media_keys_listener_manager_impl.cc.orig 2024-04-28 08:50:04 UTC
++++ content/browser/media/media_keys_listener_manager_impl.cc
+@@ -338,7 +338,7 @@ void MediaKeysListenerManagerImpl::StartListeningForMe
+ }
+
+ #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || \
+- BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // Create SystemMediaControls with the SingletonHwnd.
+ browser_system_media_controls_ =
+ system_media_controls::SystemMediaControls::Create(
diff --git a/devel/electron31/files/patch-content_browser_network__service__instance__impl.cc b/devel/electron31/files/patch-content_browser_network__service__instance__impl.cc
new file mode 100644
index 000000000000..5840129cefd2
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_network__service__instance__impl.cc
@@ -0,0 +1,29 @@
+--- content/browser/network_service_instance_impl.cc.orig 2024-06-18 21:43:31 UTC
++++ content/browser/network_service_instance_impl.cc
+@@ -82,7 +82,7 @@
+ #include "content/browser/network/network_service_process_tracker_win.h"
+ #endif
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/browser/system_dns_resolution/system_dns_resolver.h"
+ #include "services/network/public/mojom/system_dns_resolution.mojom-forward.h"
+ #endif
+@@ -360,7 +360,7 @@ void CreateInProcessNetworkService(
+ std::move(receiver)));
+ }
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Runs a self-owned SystemDnsResolverMojoImpl. This is meant to run on a
+ // high-priority thread pool.
+ void RunSystemDnsResolverOnThreadPool(
+@@ -429,7 +429,7 @@ network::mojom::NetworkServiceParamsPtr CreateNetworkS
+ }
+ #endif // BUILDFLAG(IS_POSIX)
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (GetContentClient()
+ ->browser()
+ ->ShouldRunOutOfProcessSystemDnsResolution() &&
diff --git a/devel/electron31/files/patch-content_browser_ppapi__plugin__process__host__receiver__bindings.cc b/devel/electron31/files/patch-content_browser_ppapi__plugin__process__host__receiver__bindings.cc
new file mode 100644
index 000000000000..db671fc88b41
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_ppapi__plugin__process__host__receiver__bindings.cc
@@ -0,0 +1,20 @@
+--- content/browser/ppapi_plugin_process_host_receiver_bindings.cc.orig 2022-02-28 16:54:41 UTC
++++ content/browser/ppapi_plugin_process_host_receiver_bindings.cc
+@@ -8,7 +8,7 @@
+
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "components/services/font/public/mojom/font_service.mojom.h" // nogncheck
+ #include "content/browser/font_service.h" // nogncheck
+ #endif
+@@ -17,7 +17,7 @@ namespace content {
+
+ void PpapiPluginProcessHost::BindHostReceiver(
+ mojo::GenericPendingReceiver receiver) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (auto font_receiver = receiver.As<font_service::mojom::FontService>())
+ ConnectToFontService(std::move(font_receiver));
+ #endif
diff --git a/devel/electron31/files/patch-content_browser_renderer__host_delegated__frame__host.cc b/devel/electron31/files/patch-content_browser_renderer__host_delegated__frame__host.cc
new file mode 100644
index 000000000000..7c97b2fec3d0
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_renderer__host_delegated__frame__host.cc
@@ -0,0 +1,11 @@
+--- content/browser/renderer_host/delegated_frame_host.cc.orig 2024-04-15 20:33:57 UTC
++++ content/browser/renderer_host/delegated_frame_host.cc
+@@ -318,7 +318,7 @@ void DelegatedFrameHost::EmbedSurface(
+
+ if (!primary_surface_id ||
+ primary_surface_id->local_surface_id() != local_surface_id_) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // On Windows and Linux, we would like to produce new content as soon as
+ // possible or the OS will create an additional black gutter. Until we can
+ // block resize on surface synchronization on these platforms, we will not
diff --git a/devel/electron31/files/patch-content_browser_renderer__host_input_input__device__change__observer.cc b/devel/electron31/files/patch-content_browser_renderer__host_input_input__device__change__observer.cc
new file mode 100644
index 000000000000..00e9275d7d0d
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_renderer__host_input_input__device__change__observer.cc
@@ -0,0 +1,29 @@
+--- content/browser/renderer_host/input/input_device_change_observer.cc.orig 2022-02-28 16:54:41 UTC
++++ content/browser/renderer_host/input/input_device_change_observer.cc
+@@ -9,7 +9,7 @@
+
+ #if BUILDFLAG(IS_WIN)
+ #include "ui/events/devices/input_device_observer_win.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "ui/events/devices/device_data_manager.h"
+ #elif BUILDFLAG(IS_ANDROID)
+ #include "ui/events/devices/input_device_observer_android.h"
+@@ -21,7 +21,7 @@ InputDeviceChangeObserver::InputDeviceChangeObserver(R
+ render_view_host_impl_ = rvhi;
+ #if BUILDFLAG(IS_WIN)
+ ui::InputDeviceObserverWin::GetInstance()->AddObserver(this);
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ui::DeviceDataManager::GetInstance()->AddObserver(this);
+ #elif BUILDFLAG(IS_ANDROID)
+ ui::InputDeviceObserverAndroid::GetInstance()->AddObserver(this);
+@@ -31,7 +31,7 @@ InputDeviceChangeObserver::InputDeviceChangeObserver(R
+ InputDeviceChangeObserver::~InputDeviceChangeObserver() {
+ #if BUILDFLAG(IS_WIN)
+ ui::InputDeviceObserverWin::GetInstance()->RemoveObserver(this);
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ui::DeviceDataManager::GetInstance()->RemoveObserver(this);
+ #elif BUILDFLAG(IS_ANDROID)
+ ui::InputDeviceObserverAndroid::GetInstance()->RemoveObserver(this);
diff --git a/devel/electron31/files/patch-content_browser_renderer__host_media_service__video__capture__device__launcher.cc b/devel/electron31/files/patch-content_browser_renderer__host_media_service__video__capture__device__launcher.cc
new file mode 100644
index 000000000000..b2142c8c0464
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_renderer__host_media_service__video__capture__device__launcher.cc
@@ -0,0 +1,20 @@
+--- content/browser/renderer_host/media/service_video_capture_device_launcher.cc.orig 2024-06-18 21:43:31 UTC
++++ content/browser/renderer_host/media/service_video_capture_device_launcher.cc
+@@ -25,7 +25,7 @@
+ #include "media/base/media_switches.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "content/browser/gpu/gpu_data_manager_impl.h"
+ #endif
+
+@@ -173,7 +173,7 @@ void ServiceVideoCaptureDeviceLauncher::LaunchDeviceAs
+ }
+ #else
+ if (switches::IsVideoCaptureUseGpuMemoryBufferEnabled()) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On Linux, additionally check whether the NV12 GPU memory buffer is
+ // supported.
+ if (GpuDataManagerImpl::GetInstance()->IsGpuMemoryBufferNV12Supported())
diff --git a/devel/electron31/files/patch-content_browser_renderer__host_pepper_pepper__file__io__host.cc b/devel/electron31/files/patch-content_browser_renderer__host_pepper_pepper__file__io__host.cc
new file mode 100644
index 000000000000..d56613d57656
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_renderer__host_pepper_pepper__file__io__host.cc
@@ -0,0 +1,20 @@
+--- content/browser/renderer_host/pepper/pepper_file_io_host.cc.orig 2024-02-21 00:20:45 UTC
++++ content/browser/renderer_host/pepper/pepper_file_io_host.cc
+@@ -462,7 +462,7 @@ void PepperFileIOHost::OnLocalFileOpened(
+ ppapi::host::ReplyMessageContext reply_context,
+ const base::FilePath& path,
+ base::File::Error error_code) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Quarantining a file before its contents are available is only supported on
+ // Windows and Linux.
+ if (!FileOpenForWrite(open_flags_) || error_code != base::File::FILE_OK) {
+@@ -496,7 +496,7 @@ void PepperFileIOHost::OnLocalFileOpened(
+ #endif
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void PepperFileIOHost::OnLocalFileQuarantined(
+ ppapi::host::ReplyMessageContext reply_context,
+ const base::FilePath& path,
diff --git a/devel/electron31/files/patch-content_browser_renderer__host_render__process__host__impl.cc b/devel/electron31/files/patch-content_browser_renderer__host_render__process__host__impl.cc
new file mode 100644
index 000000000000..0f84abb85770
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_renderer__host_render__process__host__impl.cc
@@ -0,0 +1,64 @@
+--- content/browser/renderer_host/render_process_host_impl.cc.orig 2024-06-30 11:48:28 UTC
++++ content/browser/renderer_host/render_process_host_impl.cc
+@@ -223,7 +223,7 @@
+ #include "third_party/blink/public/mojom/android_font_lookup/android_font_lookup.mojom.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <sys/resource.h>
+
+ #include "components/services/font/public/mojom/font_service.mojom.h" // nogncheck
+@@ -964,7 +964,7 @@ size_t GetPlatformProcessLimit() {
+ // to indicate failure and std::numeric_limits<size_t>::max() to indicate
+ // unlimited.
+ size_t GetPlatformProcessLimit() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ struct rlimit limit;
+ if (getrlimit(RLIMIT_NPROC, &limit) != 0)
+ return kUnknownPlatformProcessLimit;
+@@ -1150,7 +1150,7 @@ class RenderProcessHostImpl::IOThreadHostImpl : public
+ IOThreadHostImpl& operator=(const IOThreadHostImpl& other) = delete;
+
+ void SetPid(base::ProcessId child_pid) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ child_thread_type_switcher_.SetPid(child_pid);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ }
+@@ -1167,7 +1167,7 @@ class RenderProcessHostImpl::IOThreadHostImpl : public
+ return;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (auto font_receiver = receiver.As<font_service::mojom::FontService>()) {
+ ConnectToFontService(std::move(font_receiver));
+ return;
+@@ -1261,7 +1261,7 @@ class RenderProcessHostImpl::IOThreadHostImpl : public
+ std::unique_ptr<service_manager::BinderRegistry> binders_;
+ mojo::Receiver<mojom::ChildProcessHost> receiver_{this};
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ mojo::Remote<media::mojom::VideoEncodeAcceleratorProviderFactory>
+ video_encode_accelerator_factory_remote_;
+ ChildThreadTypeSwitcher child_thread_type_switcher_;
+@@ -3385,7 +3385,7 @@ void RenderProcessHostImpl::AppendRendererCommandLine(
+ base::TimeTicks::UnixEpoch().since_origin().InMicroseconds()));
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Append `kDisableVideoCaptureUseGpuMemoryBuffer` flag if there is no support
+ // for NV12 GPU memory buffer.
+ if (switches::IsVideoCaptureUseGpuMemoryBufferEnabled() &&
+@@ -3443,6 +3443,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLin
+ switches::kDisableSpeechAPI,
+ switches::kDisableThreadedCompositing,
+ switches::kDisableTouchDragDrop,
++ switches::kDisableUnveil,
+ switches::kDisableV8IdleTasks,
+ switches::kDisableVideoCaptureUseGpuMemoryBuffer,
+ switches::kDisableWebGLImageChromium,
diff --git a/devel/electron31/files/patch-content_browser_renderer__host_render__process__host__impl.h b/devel/electron31/files/patch-content_browser_renderer__host_render__process__host__impl.h
new file mode 100644
index 000000000000..cf1945035a4f
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_renderer__host_render__process__host__impl.h
@@ -0,0 +1,11 @@
+--- content/browser/renderer_host/render_process_host_impl.h.orig 2024-06-18 21:43:32 UTC
++++ content/browser/renderer_host/render_process_host_impl.h
+@@ -599,7 +599,7 @@ class CONTENT_EXPORT RenderProcessHostImpl
+ // Sets this RenderProcessHost to be guest only. For Testing only.
+ void SetForGuestsOnlyForTesting();
+
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD)
+ // Launch the zygote early in the browser startup.
+ static void EarlyZygoteLaunch();
+ #endif // BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_MAC)
diff --git a/devel/electron31/files/patch-content_browser_renderer__host_render__view__host__impl.cc b/devel/electron31/files/patch-content_browser_renderer__host_render__view__host__impl.cc
new file mode 100644
index 000000000000..894a18dac4b3
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_renderer__host_render__view__host__impl.cc
@@ -0,0 +1,11 @@
+--- content/browser/renderer_host/render_view_host_impl.cc.orig 2024-06-30 11:48:28 UTC
++++ content/browser/renderer_host/render_view_host_impl.cc
+@@ -271,7 +271,7 @@ void RenderViewHostImpl::GetPlatformSpecificPrefs(
+ display::win::ScreenWin::GetSystemMetricsInDIP(SM_CYVSCROLL);
+ prefs->arrow_bitmap_width_horizontal_scroll_bar_in_dips =
+ display::win::ScreenWin::GetSystemMetricsInDIP(SM_CXHSCROLL);
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kSystemFontFamily)) {
+ prefs->system_font_family_name =
diff --git a/devel/electron31/files/patch-content_browser_renderer__host_render__widget__host__view__aura.cc b/devel/electron31/files/patch-content_browser_renderer__host_render__widget__host__view__aura.cc
new file mode 100644
index 000000000000..fe039eae3750
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_renderer__host_render__widget__host__view__aura.cc
@@ -0,0 +1,47 @@
+--- content/browser/renderer_host/render_widget_host_view_aura.cc.orig 2024-06-30 11:48:30 UTC
++++ content/browser/renderer_host/render_widget_host_view_aura.cc
+@@ -120,7 +120,7 @@
+ #include "ui/gfx/gdi_util.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "content/browser/accessibility/browser_accessibility_auralinux.h"
+ #include "ui/base/ime/linux/text_edit_command_auralinux.h"
+ #include "ui/base/ime/text_input_flags.h"
+@@ -469,7 +469,7 @@ gfx::NativeViewAccessible RenderWidgetHostViewAura::Ge
+ return ToBrowserAccessibilityWin(manager->GetBrowserAccessibilityRoot())
+ ->GetCOM();
+
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ BrowserAccessibilityManager* manager =
+ host()->GetOrCreateRootBrowserAccessibilityManager();
+ if (manager && manager->GetBrowserAccessibilityRoot())
+@@ -1730,7 +1730,7 @@ bool RenderWidgetHostViewAura::ShouldDoLearning() {
+ return host() && host()->delegate() && host()->delegate()->ShouldDoLearning();
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool RenderWidgetHostViewAura::SetCompositionFromExistingText(
+ const gfx::Range& range,
+ const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) {
+@@ -2561,7 +2561,7 @@ bool RenderWidgetHostViewAura::NeedsMouseCapture() {
+ }
+
+ bool RenderWidgetHostViewAura::NeedsMouseCapture() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ return NeedsInputGrab();
+ #else
+ return false;
+@@ -2745,7 +2745,7 @@ void RenderWidgetHostViewAura::ForwardKeyboardEventWit
+ if (!target_host)
+ return;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto* linux_ui = ui::LinuxUi::instance();
+ std::vector<ui::TextEditCommandAuraLinux> commands;
+ if (!event.skip_if_unhandled && linux_ui && event.os_event &&
diff --git a/devel/electron31/files/patch-content_browser_renderer__host_render__widget__host__view__aura.h b/devel/electron31/files/patch-content_browser_renderer__host_render__widget__host__view__aura.h
new file mode 100644
index 000000000000..5cad878deaef
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_renderer__host_render__widget__host__view__aura.h
@@ -0,0 +1,11 @@
+--- content/browser/renderer_host/render_widget_host_view_aura.h.orig 2024-04-28 08:50:04 UTC
++++ content/browser/renderer_host/render_widget_host_view_aura.h
+@@ -259,7 +259,7 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
+ ukm::SourceId GetClientSourceForMetrics() const override;
+ bool ShouldDoLearning() override;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool SetCompositionFromExistingText(
+ const gfx::Range& range,
+ const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) override;
diff --git a/devel/electron31/files/patch-content_browser_renderer__host_render__widget__host__view__event__handler.cc b/devel/electron31/files/patch-content_browser_renderer__host_render__widget__host__view__event__handler.cc
new file mode 100644
index 000000000000..cfb9cbe9136e
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_renderer__host_render__widget__host__view__event__handler.cc
@@ -0,0 +1,11 @@
+--- content/browser/renderer_host/render_widget_host_view_event_handler.cc.orig 2024-06-18 21:43:32 UTC
++++ content/browser/renderer_host/render_widget_host_view_event_handler.cc
+@@ -596,7 +596,7 @@ bool RenderWidgetHostViewEventHandler::CanRendererHand
+ if (event->type() == ui::ET_MOUSE_EXITED) {
+ if (mouse_locked || selection_popup)
+ return false;
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Don't forward the mouse leave message which is received when the context
+ // menu is displayed by the page. This confuses the page and causes state
+ // changes.
diff --git a/devel/electron31/files/patch-content_browser_sandbox__host__linux.cc b/devel/electron31/files/patch-content_browser_sandbox__host__linux.cc
new file mode 100644
index 000000000000..d8ad72022d43
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_sandbox__host__linux.cc
@@ -0,0 +1,18 @@
+--- content/browser/sandbox_host_linux.cc.orig 2023-10-19 19:58:22 UTC
++++ content/browser/sandbox_host_linux.cc
+@@ -45,6 +45,7 @@ void SandboxHostLinux::Init() {
+ // Instead, it replies on a temporary socket provided by the caller.
+ PCHECK(0 == shutdown(browser_socket, SHUT_WR)) << "shutdown";
+
++#if !BUILDFLAG(IS_BSD)
+ int pipefds[2];
+ CHECK(0 == pipe(pipefds));
+ const int child_lifeline_fd = pipefds[0];
+@@ -55,6 +56,7 @@ void SandboxHostLinux::Init() {
+ ipc_thread_ = std::make_unique<base::DelegateSimpleThread>(
+ ipc_handler_.get(), "sandbox_ipc_thread");
+ ipc_thread_->Start();
++#endif
+ }
+
+ } // namespace content
diff --git a/devel/electron31/files/patch-content_browser_scheduler_responsiveness_jank__monitor__impl.cc b/devel/electron31/files/patch-content_browser_scheduler_responsiveness_jank__monitor__impl.cc
new file mode 100644
index 000000000000..78b3d502f529
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_scheduler_responsiveness_jank__monitor__impl.cc
@@ -0,0 +1,11 @@
+--- content/browser/scheduler/responsiveness/jank_monitor_impl.cc.orig 2024-06-18 21:43:32 UTC
++++ content/browser/scheduler/responsiveness/jank_monitor_impl.cc
+@@ -339,7 +339,7 @@ void JankMonitorImpl::ThreadExecutionState::DidRunTask
+ // in context menus, among others). Simply ignore the mismatches for now.
+ // See https://crbug.com/929813 for the details of why the mismatch
+ // happens.
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)) && \
+ BUILDFLAG(IS_OZONE)
+ task_execution_metadata_.clear();
+ #endif
diff --git a/devel/electron31/files/patch-content_browser_scheduler_responsiveness_native__event__observer.cc b/devel/electron31/files/patch-content_browser_scheduler_responsiveness_native__event__observer.cc
new file mode 100644
index 000000000000..07a8c97d46c8
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_scheduler_responsiveness_native__event__observer.cc
@@ -0,0 +1,20 @@
+--- content/browser/scheduler/responsiveness/native_event_observer.cc.orig 2022-02-28 16:54:41 UTC
++++ content/browser/scheduler/responsiveness/native_event_observer.cc
+@@ -15,7 +15,7 @@
+
+ #include "ui/events/platform/platform_event_source.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "ui/aura/env.h"
+ #include "ui/events/event.h"
+ #endif
+@@ -39,7 +39,7 @@ NativeEventObserver::~NativeEventObserver() {
+ DeregisterObserver();
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void NativeEventObserver::RegisterObserver() {
+ aura::Env::GetInstance()->AddWindowEventDispatcherObserver(this);
+ }
diff --git a/devel/electron31/files/patch-content_browser_scheduler_responsiveness_native__event__observer.h b/devel/electron31/files/patch-content_browser_scheduler_responsiveness_native__event__observer.h
new file mode 100644
index 000000000000..a051fea15045
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_scheduler_responsiveness_native__event__observer.h
@@ -0,0 +1,47 @@
+--- content/browser/scheduler/responsiveness/native_event_observer.h.orig 2023-02-01 18:43:19 UTC
++++ content/browser/scheduler/responsiveness/native_event_observer.h
+@@ -16,7 +16,7 @@
+ #include "content/public/browser/native_event_processor_observer_mac.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "ui/aura/window_event_dispatcher_observer.h"
+ #endif
+
+@@ -41,7 +41,7 @@ namespace responsiveness {
+ class CONTENT_EXPORT NativeEventObserver
+ #if BUILDFLAG(IS_MAC)
+ : public NativeEventProcessorObserver
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ : public aura::WindowEventDispatcherObserver
+ #elif BUILDFLAG(IS_WIN)
+ : public base::MessagePumpForUI::Observer
+@@ -58,7 +58,7 @@ class CONTENT_EXPORT NativeEventObserver
+ NativeEventObserver(WillRunEventCallback will_run_event_callback,
+ DidRunEventCallback did_run_event_callback);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ NativeEventObserver(const NativeEventObserver&) = delete;
+ NativeEventObserver& operator=(const NativeEventObserver&) = delete;
+@@ -74,7 +74,7 @@ class CONTENT_EXPORT NativeEventObserver
+ // Exposed for tests.
+ void WillRunNativeEvent(const void* opaque_identifier) override;
+ void DidRunNativeEvent(const void* opaque_identifier) override;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // aura::WindowEventDispatcherObserver overrides:
+ void OnWindowEventDispatcherStartedProcessing(
+ aura::WindowEventDispatcher* dispatcher,
+@@ -91,7 +91,7 @@ class CONTENT_EXPORT NativeEventObserver
+ void RegisterObserver();
+ void DeregisterObserver();
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ struct EventInfo {
+ raw_ptr<const void> unique_id;
+ };
diff --git a/devel/electron31/files/patch-content_browser_utility__process__host.cc b/devel/electron31/files/patch-content_browser_utility__process__host.cc
new file mode 100644
index 000000000000..9c9e67014ad3
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_utility__process__host.cc
@@ -0,0 +1,82 @@
+--- content/browser/utility_process_host.cc.orig 2024-06-30 11:48:30 UTC
++++ content/browser/utility_process_host.cc
+@@ -61,7 +61,7 @@
+ #include "content/browser/v8_snapshot_files.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/files/file_util.h"
+ #include "base/files/scoped_file.h"
+ #include "base/pickle.h"
+@@ -74,7 +74,7 @@
+ #include "services/network/public/mojom/network_service.mojom.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "base/task/sequenced_task_runner.h"
+ #include "components/viz/host/gpu_client.h"
+ #include "media/capture/capture_switches.h"
+@@ -85,7 +85,7 @@ namespace {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::ScopedFD PassNetworkContextParentDirs(
+ std::vector<base::FilePath> network_context_parent_dirs) {
+ base::Pickle pickle;
+@@ -150,7 +150,7 @@ UtilityProcessHost::UtilityProcessHost(std::unique_ptr
+ started_(false),
+ name_(u"utility process"),
+ file_data_(std::make_unique<ChildProcessLauncherFileData>()),
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ allowed_gpu_(false),
+ gpu_client_(nullptr, base::OnTaskRunnerDeleter(nullptr)),
+ #endif
+@@ -211,7 +211,7 @@ void UtilityProcessHost::SetAllowGpuClient() {
+ #endif // BUILDFLAG(IS_WIN)
+
+ void UtilityProcessHost::SetAllowGpuClient() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ allowed_gpu_ = true;
+ #endif
+ }
+@@ -369,6 +369,9 @@ bool UtilityProcessHost::StartProcess() {
+ switches::kFailAudioStreamCreation,
+ switches::kMuteAudio,
+ switches::kUseFileForFakeAudioCapture,
++#if BUILDFLAG(IS_BSD)
++ switches::kAudioBackend,
++#endif
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FREEBSD) || \
+ BUILDFLAG(IS_SOLARIS)
+ switches::kAlsaInputDevice,
+@@ -429,7 +432,7 @@ bool UtilityProcessHost::StartProcess() {
+ file_data_->files_to_preload.merge(GetV8SnapshotFilesToPreload(*cmd_line));
+ #endif // BUILDFLAG(IS_POSIX)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // The network service should have access to the parent directories
+ // necessary for its usage.
+ if (sandbox_type_ == sandbox::mojom::Sandbox::kNetwork) {
+@@ -440,13 +443,13 @@ bool UtilityProcessHost::StartProcess() {
+ }
+ #endif // BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ // Pass `kVideoCaptureUseGpuMemoryBuffer` flag to video capture service only
+ // when the video capture use GPU memory buffer enabled.
+ if (metrics_name_ == video_capture::mojom::VideoCaptureService::Name_) {
+ bool pass_gpu_buffer_flag =
+ switches::IsVideoCaptureUseGpuMemoryBufferEnabled();
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Check if NV12 GPU memory buffer supported at the same time.
+ pass_gpu_buffer_flag =
+ pass_gpu_buffer_flag &&
diff --git a/devel/electron31/files/patch-content_browser_utility__process__host.h b/devel/electron31/files/patch-content_browser_utility__process__host.h
new file mode 100644
index 000000000000..527534a275d4
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_utility__process__host.h
@@ -0,0 +1,20 @@
+--- content/browser/utility_process_host.h.orig 2024-06-30 11:48:30 UTC
++++ content/browser/utility_process_host.h
+@@ -37,7 +37,7 @@ class Thread;
+ class Thread;
+ } // namespace base
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ namespace viz {
+ class GpuClient;
+ } // namespace viz
+@@ -234,7 +234,7 @@ class CONTENT_EXPORT UtilityProcessHost
+ };
+ LaunchState launch_state_ = LaunchState::kLaunchInProgress;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ bool allowed_gpu_;
+ std::unique_ptr<viz::GpuClient, base::OnTaskRunnerDeleter> gpu_client_;
+ #endif
diff --git a/devel/electron31/files/patch-content_browser_utility__process__host__receiver__bindings.cc b/devel/electron31/files/patch-content_browser_utility__process__host__receiver__bindings.cc
new file mode 100644
index 000000000000..38b995951a0d
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_utility__process__host__receiver__bindings.cc
@@ -0,0 +1,33 @@
+--- content/browser/utility_process_host_receiver_bindings.cc.orig 2024-04-15 20:33:57 UTC
++++ content/browser/utility_process_host_receiver_bindings.cc
+@@ -10,12 +10,12 @@
+ #include "content/public/browser/content_browser_client.h"
+ #include "content/public/common/content_client.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "components/services/font/public/mojom/font_service.mojom.h" // nogncheck
+ #include "content/browser/font_service.h" // nogncheck
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "components/viz/host/gpu_client.h"
+ #include "content/public/browser/gpu_client.h"
+ #endif
+@@ -24,13 +24,13 @@ void UtilityProcessHost::BindHostReceiver(
+
+ void UtilityProcessHost::BindHostReceiver(
+ mojo::GenericPendingReceiver receiver) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (auto font_receiver = receiver.As<font_service::mojom::FontService>()) {
+ ConnectToFontService(std::move(font_receiver));
+ return;
+ }
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ if (allowed_gpu_) {
+ // TODO(crbug.com/328099369) Remove once all clients get this directly.
+ if (auto gpu_receiver = receiver.As<viz::mojom::Gpu>()) {
diff --git a/devel/electron31/files/patch-content_browser_utility__sandbox__delegate.cc b/devel/electron31/files/patch-content_browser_utility__sandbox__delegate.cc
new file mode 100644
index 000000000000..aeba3fb93cfa
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_utility__sandbox__delegate.cc
@@ -0,0 +1,28 @@
+--- content/browser/utility_sandbox_delegate.cc.orig 2024-02-27 21:36:01 UTC
++++ content/browser/utility_sandbox_delegate.cc
+@@ -69,10 +69,10 @@ UtilitySandboxedProcessLauncherDelegate::
+ #if BUILDFLAG(IS_FUCHSIA)
+ sandbox_type_ == sandbox::mojom::Sandbox::kVideoCapture ||
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ sandbox_type_ == sandbox::mojom::Sandbox::kHardwareVideoDecoding ||
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ sandbox_type_ == sandbox::mojom::Sandbox::kHardwareVideoEncoding ||
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+@@ -134,10 +134,10 @@ ZygoteCommunication* UtilitySandboxedProcessLauncherDe
+ // process upon startup.
+ if (sandbox_type_ == sandbox::mojom::Sandbox::kNetwork ||
+ sandbox_type_ == sandbox::mojom::Sandbox::kOnDeviceModelExecution ||
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ sandbox_type_ == sandbox::mojom::Sandbox::kHardwareVideoDecoding ||
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ sandbox_type_ == sandbox::mojom::Sandbox::kHardwareVideoEncoding ||
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/devel/electron31/files/patch-content_browser_v8__snapshot__files.cc b/devel/electron31/files/patch-content_browser_v8__snapshot__files.cc
new file mode 100644
index 000000000000..0d1d69308070
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_v8__snapshot__files.cc
@@ -0,0 +1,11 @@
+--- content/browser/v8_snapshot_files.cc.orig 2024-06-18 21:43:32 UTC
++++ content/browser/v8_snapshot_files.cc
+@@ -17,7 +17,7 @@ GetV8SnapshotFilesToPreload(base::CommandLine& process
+ std::map<std::string, absl::variant<base::FilePath, base::ScopedFD>>
+ GetV8SnapshotFilesToPreload(base::CommandLine& process_command_line) {
+ std::map<std::string, absl::variant<base::FilePath, base::ScopedFD>> files;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #if BUILDFLAG(USE_V8_CONTEXT_SNAPSHOT)
+ files[kV8ContextSnapshotDataDescriptor] = base::FilePath(
+ FILE_PATH_LITERAL(BUILDFLAG(V8_CONTEXT_SNAPSHOT_FILENAME)));
diff --git a/devel/electron31/files/patch-content_browser_web__contents_web__contents__view__aura.cc b/devel/electron31/files/patch-content_browser_web__contents_web__contents__view__aura.cc
new file mode 100644
index 000000000000..d567c701d55e
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_web__contents_web__contents__view__aura.cc
@@ -0,0 +1,29 @@
+--- content/browser/web_contents/web_contents_view_aura.cc.orig 2024-06-18 21:43:32 UTC
++++ content/browser/web_contents/web_contents_view_aura.cc
+@@ -174,7 +174,7 @@ class WebDragSourceAura : public content::WebContentsO
+ raw_ptr<aura::Window> window_;
+ };
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Fill out the OSExchangeData with a file contents, synthesizing a name if
+ // necessary.
+ void PrepareDragForFileContents(const DropData& drop_data,
+@@ -258,7 +258,7 @@ void PrepareDragData(const DropData& drop_data,
+ if (!drop_data.download_metadata.empty())
+ PrepareDragForDownload(drop_data, provider, web_contents);
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // We set the file contents before the URL because the URL also sets file
+ // contents (to a .URL shortcut). We want to prefer file content data over
+ // a shortcut so we add it first.
+@@ -1333,7 +1333,7 @@ void WebContentsViewAura::OnMouseEvent(ui::MouseEvent*
+ // Linux window managers like to handle raise-on-click themselves. If we
+ // raise-on-click manually, this may override user settings that prevent
+ // focus-stealing.
+-#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+ // It is possible for the web-contents to be destroyed while it is being
+ // activated. Use a weak-ptr to track whether that happened or not.
+ // More in https://crbug.com/1040725
diff --git a/devel/electron31/files/patch-content_browser_webui_web__ui__main__frame__observer.cc b/devel/electron31/files/patch-content_browser_webui_web__ui__main__frame__observer.cc
new file mode 100644
index 000000000000..d6bb2940679f
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_webui_web__ui__main__frame__observer.cc
@@ -0,0 +1,38 @@
+--- content/browser/webui/web_ui_main_frame_observer.cc.orig 2024-06-18 21:43:32 UTC
++++ content/browser/webui/web_ui_main_frame_observer.cc
+@@ -13,7 +13,7 @@
+ #include "content/public/browser/navigation_handle.h"
+ #include "content/public/browser/web_ui_controller.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/feature_list.h"
+ #include "base/functional/callback_helpers.h"
+ #include "base/logging.h"
+@@ -31,7 +31,7 @@ namespace {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Remove the pieces of the URL we don't want to send back with the error
+ // reports. In particular, do not send query or fragments as those can have
+ // privacy-sensitive information in them.
+@@ -55,7 +55,7 @@ WebUIMainFrameObserver::~WebUIMainFrameObserver() = de
+
+ WebUIMainFrameObserver::~WebUIMainFrameObserver() = default;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void WebUIMainFrameObserver::OnDidAddMessageToConsole(
+ RenderFrameHost* source_frame,
+ blink::mojom::ConsoleMessageLevel log_level,
+@@ -167,7 +167,7 @@ void WebUIMainFrameObserver::ReadyToCommitNavigation(
+
+ // TODO(crbug.com/40149439) This is currently disabled due to Windows DLL
+ // thunking issues. Fix & re-enable.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ MaybeEnableWebUIJavaScriptErrorReporting(navigation_handle);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ }
diff --git a/devel/electron31/files/patch-content_browser_webui_web__ui__main__frame__observer.h b/devel/electron31/files/patch-content_browser_webui_web__ui__main__frame__observer.h
new file mode 100644
index 000000000000..6466dad6ad74
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_webui_web__ui__main__frame__observer.h
@@ -0,0 +1,20 @@
+--- content/browser/webui/web_ui_main_frame_observer.h.orig 2024-06-18 21:43:32 UTC
++++ content/browser/webui/web_ui_main_frame_observer.h
+@@ -44,7 +44,7 @@ class CONTENT_EXPORT WebUIMainFrameObserver : public W
+
+ // TODO(crbug.com/40149439) This is currently disabled due to Windows DLL
+ // thunking issues. Fix & re-enable.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On official Google builds, capture and report JavaScript error messages on
+ // WebUI surfaces back to Google. This allows us to fix JavaScript errors and
+ // exceptions.
+@@ -60,7 +60,7 @@ class CONTENT_EXPORT WebUIMainFrameObserver : public W
+ void ReadyToCommitNavigation(NavigationHandle* navigation_handle) override;
+
+ private:
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void MaybeEnableWebUIJavaScriptErrorReporting(
+ NavigationHandle* navigation_handle);
+
diff --git a/devel/electron31/files/patch-content_browser_zygote__host_zygote__host__impl__linux.cc b/devel/electron31/files/patch-content_browser_zygote__host_zygote__host__impl__linux.cc
new file mode 100644
index 000000000000..90d5930a6fba
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_zygote__host_zygote__host__impl__linux.cc
@@ -0,0 +1,81 @@
+--- content/browser/zygote_host/zygote_host_impl_linux.cc.orig 2024-04-15 20:33:57 UTC
++++ content/browser/zygote_host/zygote_host_impl_linux.cc
+@@ -18,8 +18,10 @@
+ #include "build/chromeos_buildflags.h"
+ #include "content/common/zygote/zygote_commands_linux.h"
+ #include "content/common/zygote/zygote_communication_linux.h"
++#if !BUILDFLAG(IS_BSD)
+ #include "content/common/zygote/zygote_handle_impl_linux.h"
+ #include "content/public/common/zygote/zygote_handle.h"
++#endif
+ #include "sandbox/linux/services/credentials.h"
+ #include "sandbox/linux/services/namespace_sandbox.h"
+ #include "sandbox/linux/suid/client/setuid_sandbox_host.h"
+@@ -37,6 +39,7 @@ namespace {
+
+ namespace {
+
++#if !BUILDFLAG(IS_BSD)
+ // Receive a fixed message on fd and return the sender's PID.
+ // Returns true if the message received matches the expected message.
+ bool ReceiveFixedMessage(int fd,
+@@ -58,6 +61,7 @@ bool ReceiveFixedMessage(int fd,
+ return false;
+ return true;
+ }
++#endif
+
+ } // namespace
+
+@@ -67,9 +71,13 @@ ZygoteHostImpl::ZygoteHostImpl()
+ }
+
+ ZygoteHostImpl::ZygoteHostImpl()
++#if !BUILDFLAG(IS_BSD)
+ : use_namespace_sandbox_(false),
+ use_suid_sandbox_(false),
+ use_suid_sandbox_for_adj_oom_score_(false),
++#else
++ :
++#endif
+ sandbox_binary_(),
+ zygote_pids_lock_(),
+ zygote_pids_() {}
+@@ -82,6 +90,7 @@ void ZygoteHostImpl::Init(const base::CommandLine& com
+ }
+
+ void ZygoteHostImpl::Init(const base::CommandLine& command_line) {
++#if !BUILDFLAG(IS_BSD)
+ if (command_line.HasSwitch(sandbox::policy::switches::kNoSandbox)) {
+ return;
+ }
+@@ -132,6 +141,7 @@ void ZygoteHostImpl::Init(const base::CommandLine& com
+ "you can try using --"
+ << sandbox::policy::switches::kNoSandbox << ".";
+ }
++#endif
+ }
+
+ void ZygoteHostImpl::AddZygotePid(pid_t pid) {
+@@ -156,6 +166,7 @@ pid_t ZygoteHostImpl::LaunchZygote(
+ base::CommandLine* cmd_line,
+ base::ScopedFD* control_fd,
+ base::FileHandleMappingVector additional_remapped_fds) {
++#if !BUILDFLAG(IS_BSD)
+ int fds[2];
+ CHECK_EQ(0, socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, fds));
+ CHECK(base::UnixDomainSocket::EnableReceiveProcessId(fds[0]));
+@@ -224,9 +235,12 @@ pid_t ZygoteHostImpl::LaunchZygote(
+
+ AddZygotePid(pid);
+ return pid;
++#else
++ return 0;
++#endif
+ }
+
+-#if !BUILDFLAG(IS_OPENBSD)
++#if !BUILDFLAG(IS_BSD)
+ void ZygoteHostImpl::AdjustRendererOOMScore(base::ProcessHandle pid,
+ int score) {
+ // 1) You can't change the oom_score_adj of a non-dumpable process
diff --git a/devel/electron31/files/patch-content_browser_zygote__host_zygote__host__impl__linux.h b/devel/electron31/files/patch-content_browser_zygote__host_zygote__host__impl__linux.h
new file mode 100644
index 000000000000..ef9868a470dc
--- /dev/null
+++ b/devel/electron31/files/patch-content_browser_zygote__host_zygote__host__impl__linux.h
@@ -0,0 +1,29 @@
+--- content/browser/zygote_host/zygote_host_impl_linux.h.orig 2023-02-01 18:43:19 UTC
++++ content/browser/zygote_host/zygote_host_impl_linux.h
+@@ -47,12 +47,14 @@ class CONTENT_EXPORT ZygoteHostImpl : public ZygoteHos
+ base::ScopedFD* control_fd,
+ base::FileHandleMappingVector additional_remapped_fds);
+
++#if !BUILDFLAG(IS_BSD)
+ void AdjustRendererOOMScore(base::ProcessHandle process_handle,
+ int score) override;
+ #if BUILDFLAG(IS_CHROMEOS)
+ void ReinitializeLogging(uint32_t logging_dest,
+ base::PlatformFile log_file_fd) override;
+ #endif // BUILDFLAG(IS_CHROMEOS)
++#endif
+
+ bool HasZygote() { return !zygote_pids_.empty(); }
+
+@@ -67,9 +69,11 @@ class CONTENT_EXPORT ZygoteHostImpl : public ZygoteHos
+
+ int renderer_sandbox_status_;
+
++#if !BUILDFLAG(IS_BSD)
+ bool use_namespace_sandbox_;
+ bool use_suid_sandbox_;
+ bool use_suid_sandbox_for_adj_oom_score_;
++#endif
+ std::string sandbox_binary_;
+
+ // This lock protects the |zygote_pids_| set.
diff --git a/devel/electron31/files/patch-content_child_BUILD.gn b/devel/electron31/files/patch-content_child_BUILD.gn
new file mode 100644
index 000000000000..595edffe65a3
--- /dev/null
+++ b/devel/electron31/files/patch-content_child_BUILD.gn
@@ -0,0 +1,16 @@
+--- content/child/BUILD.gn.orig 2024-06-18 21:43:32 UTC
++++ content/child/BUILD.gn
+@@ -130,6 +130,13 @@ target(link_target_type, "child") {
+ ]
+ }
+
++ if (is_bsd) {
++ sources -= [
++ "sandboxed_process_thread_type_handler.cc",
++ "sandboxed_process_thread_type_handler.h",
++ ]
++ }
++
+ if (is_win) {
+ sources += [
+ "dwrite_font_proxy/dwrite_font_proxy_init_impl_win.cc",
diff --git a/devel/electron31/files/patch-content_child_child__process.cc b/devel/electron31/files/patch-content_child_child__process.cc
new file mode 100644
index 000000000000..7f24d1d27e5a
--- /dev/null
+++ b/devel/electron31/files/patch-content_child_child__process.cc
@@ -0,0 +1,11 @@
+--- content/child/child_process.cc.orig 2023-11-29 21:40:01 UTC
++++ content/child/child_process.cc
+@@ -66,7 +66,7 @@ ChildProcess::ChildProcess(base::ThreadType io_thread_
+ thread_pool_init_params)
+ : resetter_(&child_process, this, nullptr),
+ io_thread_(std::make_unique<ChildIOThread>()) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const base::CommandLine& command_line =
+ *base::CommandLine::ForCurrentProcess();
+ const bool is_embedded_in_browser_process =
diff --git a/devel/electron31/files/patch-content_common_BUILD.gn b/devel/electron31/files/patch-content_common_BUILD.gn
new file mode 100644
index 000000000000..3f4818c6a891
--- /dev/null
+++ b/devel/electron31/files/patch-content_common_BUILD.gn
@@ -0,0 +1,36 @@
+--- content/common/BUILD.gn.orig 2024-06-30 11:48:27 UTC
++++ content/common/BUILD.gn
+@@ -449,19 +449,28 @@ source_set("common") {
+ }
+
+ if (is_linux || is_chromeos) {
+- sources += [
+- "gpu_pre_sandbox_hook_linux.cc",
+- "gpu_pre_sandbox_hook_linux.h",
+- ]
++ if (is_bsd) {
++ sources += [
++ "gpu_pre_sandbox_hook_bsd.cc",
++ "gpu_pre_sandbox_hook_bsd.h",
++ ]
++ } else {
++ sources += [
++ "gpu_pre_sandbox_hook_linux.cc",
++ "gpu_pre_sandbox_hook_linux.h",
++ ]
++ }
+ public_deps += [ "//sandbox/policy" ]
+ deps += [
+ ":sandbox_support_linux",
+ "//media/gpu:buildflags",
+ "//sandbox/linux:sandbox_services",
+- "//sandbox/linux:seccomp_bpf",
+ "//sandbox/policy:chromecast_sandbox_allowlist_buildflags",
+ "//third_party/fontconfig",
+ ]
++ if (use_seccomp_bpf) {
++ deps += [ "//sandbox/linux:seccomp_bpf" ]
++ }
+ if (use_v4l2_codec) {
+ deps += [ "//media/gpu/v4l2" ]
+ }
diff --git a/devel/electron31/files/patch-content_common_features.cc b/devel/electron31/files/patch-content_common_features.cc
new file mode 100644
index 000000000000..05ba7583fc24
--- /dev/null
+++ b/devel/electron31/files/patch-content_common_features.cc
@@ -0,0 +1,20 @@
+--- content/common/features.cc.orig 2024-06-18 21:43:32 UTC
++++ content/common/features.cc
+@@ -164,7 +164,7 @@ BASE_FEATURE(kEnableBackForwardCacheForOngoingSubframe
+ base::FEATURE_ENABLED_BY_DEFAULT);
+
+ // Enables error reporting for JS errors inside DevTools frontend host
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kEnableDevToolsJsErrorReporting,
+ "EnableDevToolsJsErrorReporting",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+@@ -253,7 +253,7 @@ BASE_FEATURE(kGroupNIKByJoiningOrigin,
+ // process and having browser process handle adjusting thread properties (nice
+ // value, c-group, latency sensitivity...) for children which have sandbox
+ // restrictions.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kHandleChildThreadTypeChangesInBrowser,
+ "HandleChildThreadTypeChangesInBrowser",
+ base::FEATURE_ENABLED_BY_DEFAULT);
diff --git a/devel/electron31/files/patch-content_common_features.h b/devel/electron31/files/patch-content_common_features.h
new file mode 100644
index 000000000000..3a9237bb8303
--- /dev/null
+++ b/devel/electron31/files/patch-content_common_features.h
@@ -0,0 +1,20 @@
+--- content/common/features.h.orig 2024-06-18 21:43:32 UTC
++++ content/common/features.h
+@@ -36,7 +36,7 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(
+ CONTENT_EXPORT BASE_DECLARE_FEATURE(kEnableBackForwardCacheForScreenReader);
+ CONTENT_EXPORT BASE_DECLARE_FEATURE(
+ kEnableBackForwardCacheForOngoingSubframeNavigation);
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ CONTENT_EXPORT BASE_DECLARE_FEATURE(kEnableDevToolsJsErrorReporting);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ CONTENT_EXPORT BASE_DECLARE_FEATURE(kEmbeddingRequiresOptIn);
+@@ -59,7 +59,7 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kGroupNIKByJoining
+ CONTENT_EXPORT BASE_DECLARE_FEATURE(kGpuInfoCollectionSeparatePrefetch);
+ #endif
+ CONTENT_EXPORT BASE_DECLARE_FEATURE(kGroupNIKByJoiningOrigin);
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ CONTENT_EXPORT BASE_DECLARE_FEATURE(kHandleChildThreadTypeChangesInBrowser);
+ #endif
+ #if BUILDFLAG(IS_ANDROID)
diff --git a/devel/electron31/files/patch-content_common_font__list__unittest.cc b/devel/electron31/files/patch-content_common_font__list__unittest.cc
new file mode 100644
index 000000000000..174ea1144110
--- /dev/null
+++ b/devel/electron31/files/patch-content_common_font__list__unittest.cc
@@ -0,0 +1,11 @@
+--- content/common/font_list_unittest.cc.orig 2024-06-18 21:43:32 UTC
++++ content/common/font_list_unittest.cc
+@@ -48,7 +48,7 @@ TEST(FontList, GetFontList) {
+ EXPECT_TRUE(HasFontWithName(fonts, "MS Gothic", "MS Gothic"));
+ EXPECT_TRUE(HasFontWithName(fonts, "Segoe UI", "Segoe UI"));
+ EXPECT_TRUE(HasFontWithName(fonts, "Verdana", "Verdana"));
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ EXPECT_TRUE(HasFontWithName(fonts, "Arimo", "Arimo"));
+ #else
+ EXPECT_TRUE(HasFontWithName(fonts, "Arial", "Arial"));
diff --git a/devel/electron31/files/patch-content_common_gpu__pre__sandbox__hook__bsd.cc b/devel/electron31/files/patch-content_common_gpu__pre__sandbox__hook__bsd.cc
new file mode 100644
index 000000000000..f2d60daa4a29
--- /dev/null
+++ b/devel/electron31/files/patch-content_common_gpu__pre__sandbox__hook__bsd.cc
@@ -0,0 +1,71 @@
+--- content/common/gpu_pre_sandbox_hook_bsd.cc.orig 2024-04-28 08:50:26 UTC
++++ content/common/gpu_pre_sandbox_hook_bsd.cc
+@@ -0,0 +1,68 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "content/common/gpu_pre_sandbox_hook_bsd.h"
++
++#include <dlfcn.h>
++#include <errno.h>
++#include <sys/stat.h>
++
++#include <memory>
++#include <sstream>
++#include <utility>
++#include <vector>
++
++#include "base/base_paths.h"
++#include "base/files/file_enumerator.h"
++#include "base/files/file_path.h"
++#include "base/files/scoped_file.h"
++#include "base/functional/bind.h"
++#include "base/logging.h"
++#include "base/path_service.h"
++#include "base/strings/stringprintf.h"
++#include "build/build_config.h"
++#include "build/buildflag.h"
++#include "build/chromeos_buildflags.h"
++#include "content/public/common/content_switches.h"
++#include "media/gpu/buildflags.h"
++
++namespace content {
++namespace {
++
++constexpr int dlopen_flag = RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE;
++
++void LoadVulkanLibraries() {
++ // Try to preload Vulkan libraries. Failure is not an error as not all may be
++ // present.
++ const char* kLibraries[] = {
++ "libvulkan.so",
++ "libvulkan_intel.so",
++ "libvulkan_intel_hasvk.so",
++ "libvulkan_radeon.so",
++ };
++ for (const auto* library : kLibraries) {
++ dlopen(library, dlopen_flag);
++ }
++}
++
++bool LoadLibrariesForGpu(
++ const sandbox::policy::SandboxSeccompBPF::Options& options) {
++ LoadVulkanLibraries();
++
++ return true;
++}
++
++} // namespace
++
++bool GpuPreSandboxHook(sandbox::policy::SandboxLinux::Options options) {
++ if (!LoadLibrariesForGpu(options))
++ return false;
++
++ // TODO(tsepez): enable namspace sandbox here once crashes are understood.
++
++ errno = 0;
++ return true;
++}
++
++} // namespace content
diff --git a/devel/electron31/files/patch-content_common_gpu__pre__sandbox__hook__bsd.h b/devel/electron31/files/patch-content_common_gpu__pre__sandbox__hook__bsd.h
new file mode 100644
index 000000000000..52612d85e7a1
--- /dev/null
+++ b/devel/electron31/files/patch-content_common_gpu__pre__sandbox__hook__bsd.h
@@ -0,0 +1,23 @@
+--- content/common/gpu_pre_sandbox_hook_bsd.h.orig 2024-02-27 21:36:23 UTC
++++ content/common/gpu_pre_sandbox_hook_bsd.h
+@@ -0,0 +1,20 @@
++// Copyright 2017 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef CONTENT_COMMON_GPU_PRE_SANDBOX_HOOK_BSD_H_
++#define CONTENT_COMMON_GPU_PRE_SANDBOX_HOOK_BSD_H_
++
++#include "base/component_export.h"
++#include "sandbox/policy/sandbox.h"
++
++namespace content {
++
++// A pre-sandbox hook to use on Linux-based systems in sandboxed processes that
++// require general GPU usage.
++COMPONENT_EXPORT(GPU_PRE_SANDBOX_HOOK)
++bool GpuPreSandboxHook(sandbox::policy::SandboxLinux::Options options);
++
++} // namespace content
++
++#endif // CONTENT_COMMON_GPU_PRE_SANDBOX_HOOK_BSD_H_
diff --git a/devel/electron31/files/patch-content_common_gpu__pre__sandbox__hook__linux.h b/devel/electron31/files/patch-content_common_gpu__pre__sandbox__hook__linux.h
new file mode 100644
index 000000000000..726f22ba754e
--- /dev/null
+++ b/devel/electron31/files/patch-content_common_gpu__pre__sandbox__hook__linux.h
@@ -0,0 +1,16 @@
+--- content/common/gpu_pre_sandbox_hook_linux.h.orig 2024-04-15 20:33:57 UTC
++++ content/common/gpu_pre_sandbox_hook_linux.h
+@@ -5,8 +5,13 @@
+ #ifndef CONTENT_COMMON_GPU_PRE_SANDBOX_HOOK_LINUX_H_
+ #define CONTENT_COMMON_GPU_PRE_SANDBOX_HOOK_LINUX_H_
+
++#include "build/build_config.h"
+ #include "base/component_export.h"
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#else
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+
+ namespace content {
+
diff --git a/devel/electron31/files/patch-content_common_mojo__core__library__support.cc b/devel/electron31/files/patch-content_common_mojo__core__library__support.cc
new file mode 100644
index 000000000000..2c3d86d98b7e
--- /dev/null
+++ b/devel/electron31/files/patch-content_common_mojo__core__library__support.cc
@@ -0,0 +1,11 @@
+--- content/common/mojo_core_library_support.cc.orig 2024-02-21 00:20:45 UTC
++++ content/common/mojo_core_library_support.cc
+@@ -15,7 +15,7 @@ std::optional<base::FilePath> GetMojoCoreSharedLibrary
+ }
+
+ std::optional<base::FilePath> GetMojoCoreSharedLibraryPath() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const base::CommandLine& command_line =
+ *base::CommandLine::ForCurrentProcess();
+ if (!command_line.HasSwitch(switches::kMojoCoreLibraryPath))
diff --git a/devel/electron31/files/patch-content_common_user__agent.cc b/devel/electron31/files/patch-content_common_user__agent.cc
new file mode 100644
index 000000000000..b29b11284b7a
--- /dev/null
+++ b/devel/electron31/files/patch-content_common_user__agent.cc
@@ -0,0 +1,37 @@
+--- content/common/user_agent.cc.orig 2023-03-30 00:33:51 UTC
++++ content/common/user_agent.cc
+@@ -45,7 +45,7 @@ std::string GetUserAgentPlatform() {
+ return "";
+ #elif BUILDFLAG(IS_MAC)
+ return "Macintosh; ";
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return "X11; "; // strange, but that's what Firefox uses
+ #elif BUILDFLAG(IS_ANDROID)
+ return "Linux; ";
+@@ -71,7 +71,7 @@ std::string GetUnifiedPlatform() {
+ return "Windows NT 10.0; Win64; x64";
+ #elif BUILDFLAG(IS_FUCHSIA)
+ return "Fuchsia";
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return "X11; Linux x86_64";
+ #elif BUILDFLAG(IS_IOS)
+ if (ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET) {
+@@ -296,6 +296,16 @@ std::string BuildOSCpuInfoFromOSVersionAndCpuType(cons
+ "Android %s", os_version.c_str()
+ #elif BUILDFLAG(IS_FUCHSIA)
+ "Fuchsia"
++#elif BUILDFLAG(IS_BSD)
++#if defined(__x86_64__)
++ "Linux x86_64; %s %s",
++#elif defined(__aarch64__)
++ "Linux aarch64; %s %s",
++#else
++ "Linux i686; %s %s",
++#endif
++ unixinfo.sysname, // e.g. Linux
++ cpu_type.c_str() // e.g. i686
+ #elif BUILDFLAG(IS_IOS)
+ "CPU %s OS %s like Mac OS X", cpu_type.c_str(),
+ os_version.c_str()
diff --git a/devel/electron31/files/patch-content_gpu_gpu__child__thread.cc b/devel/electron31/files/patch-content_gpu_gpu__child__thread.cc
new file mode 100644
index 000000000000..7e50a07c7523
--- /dev/null
+++ b/devel/electron31/files/patch-content_gpu_gpu__child__thread.cc
@@ -0,0 +1,21 @@
+--- content/gpu/gpu_child_thread.cc.orig 2024-04-15 20:33:57 UTC
++++ content/gpu/gpu_child_thread.cc
+@@ -58,7 +58,7 @@
+ #include "third_party/skia/include/ports/SkFontConfigInterface.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/child/sandboxed_process_thread_type_handler.h"
+ #endif
+
+@@ -142,7 +142,8 @@ void GpuChildThread::Init(const base::TimeTicks& proce
+
+ viz_main_.gpu_service()->set_start_time(process_start_time);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++// XXX BSD
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_BSD)
+ SandboxedProcessThreadTypeHandler::NotifyMainChildThreadCreated();
+ #endif
+
diff --git a/devel/electron31/files/patch-content_gpu_gpu__main.cc b/devel/electron31/files/patch-content_gpu_gpu__main.cc
new file mode 100644
index 000000000000..ca09a2009737
--- /dev/null
+++ b/devel/electron31/files/patch-content_gpu_gpu__main.cc
@@ -0,0 +1,73 @@
+--- content/gpu/gpu_main.cc.orig 2024-06-30 11:48:28 UTC
++++ content/gpu/gpu_main.cc
+@@ -94,10 +94,14 @@
+ #include "sandbox/win/src/sandbox.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/child/sandboxed_process_thread_type_handler.h"
+ #include "content/common/gpu_pre_sandbox_hook_linux.h"
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#else
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+ #include "sandbox/policy/sandbox_type.h"
+ #endif
+
+@@ -117,7 +121,7 @@ namespace {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool StartSandboxLinux(gpu::GpuWatchdogThread*,
+ const gpu::GPUInfo*,
+ const gpu::GpuPreferences&);
+@@ -182,7 +186,7 @@ class ContentSandboxHelper : public gpu::GpuSandboxHel
+ bool EnsureSandboxInitialized(gpu::GpuWatchdogThread* watchdog_thread,
+ const gpu::GPUInfo* gpu_info,
+ const gpu::GpuPreferences& gpu_prefs) override {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return StartSandboxLinux(watchdog_thread, gpu_info, gpu_prefs);
+ #elif BUILDFLAG(IS_WIN)
+ return StartSandboxWindows(sandbox_info_);
+@@ -295,7 +299,7 @@ int GpuMain(MainFunctionParams parameters) {
+ std::make_unique<base::SingleThreadTaskExecutor>(
+ gpu_preferences.message_pump_type);
+ }
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #error "Unsupported Linux platform."
+ #elif BUILDFLAG(IS_MAC)
+ // Cross-process CoreAnimation requires a CFRunLoop to function at all, and
+@@ -317,7 +321,8 @@ int GpuMain(MainFunctionParams parameters) {
+
+ base::PlatformThread::SetName("CrGpuMain");
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++// XXX BSD
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_BSD)
+ // Thread type delegate of the process should be registered before
+ // thread type change below for the main thread and for thread pool in
+ // ChildProcess constructor.
+@@ -446,7 +451,7 @@ namespace {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool StartSandboxLinux(gpu::GpuWatchdogThread* watchdog_thread,
+ const gpu::GPUInfo* gpu_info,
+ const gpu::GpuPreferences& gpu_prefs) {
+@@ -486,7 +491,7 @@ bool StartSandboxLinux(gpu::GpuWatchdogThread* watchdo
+ sandbox_options.accelerated_video_encode_enabled =
+ !gpu_prefs.disable_accelerated_video_encode;
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Video decoding of many video streams can use thousands of FDs as well as
+ // Exo clients like Lacros.
+ // See https://crbug.com/1417237
diff --git a/devel/electron31/files/patch-content_ppapi__plugin_ppapi__blink__platform__impl.cc b/devel/electron31/files/patch-content_ppapi__plugin_ppapi__blink__platform__impl.cc
new file mode 100644
index 000000000000..6f77b824ee91
--- /dev/null
+++ b/devel/electron31/files/patch-content_ppapi__plugin_ppapi__blink__platform__impl.cc
@@ -0,0 +1,29 @@
+--- content/ppapi_plugin/ppapi_blink_platform_impl.cc.orig 2024-02-21 00:20:45 UTC
++++ content/ppapi_plugin/ppapi_blink_platform_impl.cc
+@@ -21,7 +21,7 @@
+
+ #if BUILDFLAG(IS_MAC)
+ #include "content/child/child_process_sandbox_support_impl_mac.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/child/child_process_sandbox_support_impl_linux.h"
+ #include "mojo/public/cpp/bindings/pending_remote.h"
+ #endif
+@@ -36,7 +36,7 @@ PpapiBlinkPlatformImpl::PpapiBlinkPlatformImpl() {
+ namespace content {
+
+ PpapiBlinkPlatformImpl::PpapiBlinkPlatformImpl() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ mojo::PendingRemote<font_service::mojom::FontService> font_service;
+ ChildThread::Get()->BindHostReceiver(
+ font_service.InitWithNewPipeAndPassReceiver());
+@@ -55,7 +55,7 @@ blink::WebSandboxSupport* PpapiBlinkPlatformImpl::GetS
+ void PpapiBlinkPlatformImpl::Shutdown() {}
+
+ blink::WebSandboxSupport* PpapiBlinkPlatformImpl::GetSandboxSupport() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ return sandbox_support_.get();
+ #else
+ return nullptr;
diff --git a/devel/electron31/files/patch-content_ppapi__plugin_ppapi__blink__platform__impl.h b/devel/electron31/files/patch-content_ppapi__plugin_ppapi__blink__platform__impl.h
new file mode 100644
index 000000000000..105c5c76be7a
--- /dev/null
+++ b/devel/electron31/files/patch-content_ppapi__plugin_ppapi__blink__platform__impl.h
@@ -0,0 +1,11 @@
+--- content/ppapi_plugin/ppapi_blink_platform_impl.h.orig 2024-02-21 00:20:45 UTC
++++ content/ppapi_plugin/ppapi_blink_platform_impl.h
+@@ -34,7 +34,7 @@ class PpapiBlinkPlatformImpl : public BlinkPlatformImp
+ blink::WebString DefaultLocale() override;
+
+ private:
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<blink::WebSandboxSupport> sandbox_support_;
+ #endif
+ };
diff --git a/devel/electron31/files/patch-content_ppapi__plugin_ppapi__plugin__main.cc b/devel/electron31/files/patch-content_ppapi__plugin_ppapi__plugin__main.cc
new file mode 100644
index 000000000000..8db52fe29e7b
--- /dev/null
+++ b/devel/electron31/files/patch-content_ppapi__plugin_ppapi__plugin__main.cc
@@ -0,0 +1,23 @@
+--- content/ppapi_plugin/ppapi_plugin_main.cc.orig 2023-08-10 01:48:43 UTC
++++ content/ppapi_plugin/ppapi_plugin_main.cc
+@@ -54,6 +54,11 @@
+ #include "gin/v8_initializer.h"
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#include "sandbox/policy/sandbox_type.h"
++#endif
++
+ #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
+ #include <stdlib.h>
+ #endif
+@@ -150,7 +155,7 @@ int PpapiPluginMain(MainFunctionParams parameters) {
+ gin::V8Initializer::LoadV8Snapshot();
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OPENBSD)
+ sandbox::policy::SandboxLinux::GetInstance()->InitializeSandbox(
+ sandbox::policy::SandboxTypeFromCommandLine(command_line),
+ sandbox::policy::SandboxLinux::PreSandboxHook(),
diff --git a/devel/electron31/files/patch-content_public_browser_content__browser__client.cc b/devel/electron31/files/patch-content_public_browser_content__browser__client.cc
new file mode 100644
index 000000000000..b1b245d70bd6
--- /dev/null
+++ b/devel/electron31/files/patch-content_public_browser_content__browser__client.cc
@@ -0,0 +1,11 @@
+--- content/public/browser/content_browser_client.cc.orig 2024-06-30 11:48:26 UTC
++++ content/public/browser/content_browser_client.cc
+@@ -1305,7 +1305,7 @@ bool ContentBrowserClient::ShouldRunOutOfProcessSystem
+ // that can be adequately sandboxed.
+ // Currently Android's network service will not run out of process or sandboxed,
+ // so OutOfProcessSystemDnsResolution is not currently enabled on Android.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return true;
+ #else
+ return false;
diff --git a/devel/electron31/files/patch-content_public_browser_service__process__host.cc b/devel/electron31/files/patch-content_public_browser_service__process__host.cc
new file mode 100644
index 000000000000..cc874ecd82c3
--- /dev/null
+++ b/devel/electron31/files/patch-content_public_browser_service__process__host.cc
@@ -0,0 +1,11 @@
+--- content/public/browser/service_process_host.cc.orig 2024-06-30 11:48:30 UTC
++++ content/public/browser/service_process_host.cc
+@@ -103,7 +103,7 @@ ServiceProcessHost::Options& ServiceProcessHost::Optio
+
+ ServiceProcessHost::Options& ServiceProcessHost::Options::WithGpuClient(
+ base::PassKey<ServiceProcessHostGpuClient> passkey) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ allow_gpu_client = true;
+ #endif
+ return *this;
diff --git a/devel/electron31/files/patch-content_public_browser_zygote__host_zygote__host__linux.h b/devel/electron31/files/patch-content_public_browser_zygote__host_zygote__host__linux.h
new file mode 100644
index 000000000000..d5adcef76c4f
--- /dev/null
+++ b/devel/electron31/files/patch-content_public_browser_zygote__host_zygote__host__linux.h
@@ -0,0 +1,16 @@
+--- content/public/browser/zygote_host/zygote_host_linux.h.orig 2023-02-01 18:43:19 UTC
++++ content/public/browser/zygote_host/zygote_host_linux.h
+@@ -35,11 +35,13 @@ class ZygoteHost {
+ // after the first render has been forked.
+ virtual int GetRendererSandboxStatus() = 0;
+
++#if !BUILDFLAG(IS_BSD)
+ // Adjust the OOM score of the given renderer's PID. The allowed
+ // range for the score is [0, 1000], where higher values are more
+ // likely to be killed by the OOM killer.
+ virtual void AdjustRendererOOMScore(base::ProcessHandle process_handle,
+ int score) = 0;
++#endif
+
+ #if BUILDFLAG(IS_CHROMEOS)
+ // Reinitialize logging for the Zygote processes. Needed on ChromeOS, which
diff --git a/devel/electron31/files/patch-content_public_common_content__features.cc b/devel/electron31/files/patch-content_public_common_content__features.cc
new file mode 100644
index 000000000000..302caa4ab86b
--- /dev/null
+++ b/devel/electron31/files/patch-content_public_common_content__features.cc
@@ -0,0 +1,35 @@
+--- content/public/common/content_features.cc.orig 2024-06-18 21:43:32 UTC
++++ content/public/common/content_features.cc
+@@ -29,7 +29,7 @@ BASE_FEATURE(kAudioServiceOutOfProcess,
+ // TODO(crbug.com/40118868): Remove !IS_CHROMEOS_LACROS once lacros starts being
+ // built with OS_CHROMEOS instead of OS_LINUX.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS))
++ (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -1076,9 +1076,9 @@ BASE_FEATURE(kWebAssemblyTrapHandler,
+ BASE_FEATURE(kWebAssemblyTrapHandler,
+ "WebAssemblyTrapHandler",
+ #if ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_MAC)) && \
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)) && \
+ defined(ARCH_CPU_X86_64)) || \
+- ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)) && \
++ ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)) && \
+ defined(ARCH_CPU_ARM64))
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+@@ -1115,7 +1115,11 @@ BASE_FEATURE(kWebUICodeCache,
+
+ // Controls whether the WebUSB API is enabled:
+ // https://wicg.github.io/webusb
++#if BUILDFLAG(IS_BSD)
++BASE_FEATURE(kWebUsb, "WebUSB", base::FEATURE_DISABLED_BY_DEFAULT);
++#else
+ BASE_FEATURE(kWebUsb, "WebUSB", base::FEATURE_ENABLED_BY_DEFAULT);
++#endif
+
+ // Controls whether the WebXR Device API is enabled.
+ BASE_FEATURE(kWebXr, "WebXR", base::FEATURE_ENABLED_BY_DEFAULT);
diff --git a/devel/electron31/files/patch-content_public_common_content__switches.cc b/devel/electron31/files/patch-content_public_common_content__switches.cc
new file mode 100644
index 000000000000..191adb8fc487
--- /dev/null
+++ b/devel/electron31/files/patch-content_public_common_content__switches.cc
@@ -0,0 +1,20 @@
+--- content/public/common/content_switches.cc.orig 2024-06-18 21:43:32 UTC
++++ content/public/common/content_switches.cc
+@@ -352,6 +352,8 @@ const char kEnableLogging[] = "enable-
+ // builds.
+ const char kEnableLogging[] = "enable-logging";
+
++const char kDisableUnveil[] = "disable-unveil";
++
+ // Enables the type, downlinkMax attributes of the NetInfo API. Also, enables
+ // triggering of change attribute of the NetInfo API when there is a change in
+ // the connection type.
+@@ -990,7 +992,7 @@ const char kPreventResizingContentsForTesting[] =
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Allows sending text-to-speech requests to speech-dispatcher, a common
+ // Linux speech service. Because it's buggy, the user must explicitly
+ // enable it so that visiting a random webpage can't cause instability.
diff --git a/devel/electron31/files/patch-content_public_common_content__switches.h b/devel/electron31/files/patch-content_public_common_content__switches.h
new file mode 100644
index 000000000000..645fb7b37a39
--- /dev/null
+++ b/devel/electron31/files/patch-content_public_common_content__switches.h
@@ -0,0 +1,19 @@
+--- content/public/common/content_switches.h.orig 2024-06-18 21:43:32 UTC
++++ content/public/common/content_switches.h
+@@ -111,6 +111,7 @@ CONTENT_EXPORT extern const char kEnableLogging[];
+ CONTENT_EXPORT extern const char kEnableIsolatedWebAppsInRenderer[];
+ CONTENT_EXPORT extern const char kEnableLCDText[];
+ CONTENT_EXPORT extern const char kEnableLogging[];
++CONTENT_EXPORT extern const char kDisableUnveil[];
+ CONTENT_EXPORT extern const char kEnableNetworkInformationDownlinkMax[];
+ CONTENT_EXPORT extern const char kEnableCanvas2DLayers[];
+ CONTENT_EXPORT extern const char kEnablePluginPlaceholderTesting[];
+@@ -268,7 +269,7 @@ CONTENT_EXPORT extern const char kPreventResizingConte
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ CONTENT_EXPORT extern const char kEnableSpeechDispatcher[];
+ CONTENT_EXPORT extern const char kLLVMProfileFile[];
+ #endif
diff --git a/devel/electron31/files/patch-content_public_common_zygote_features.gni b/devel/electron31/files/patch-content_public_common_zygote_features.gni
new file mode 100644
index 000000000000..0b01fb059dea
--- /dev/null
+++ b/devel/electron31/files/patch-content_public_common_zygote_features.gni
@@ -0,0 +1,8 @@
+--- content/public/common/zygote/features.gni.orig 2023-03-30 00:33:51 UTC
++++ content/public/common/zygote/features.gni
+@@ -2,4 +2,4 @@
+ # Use of this source code is governed by a BSD-style license that can be
+ # found in the LICENSE file.
+
+-use_zygote = is_posix && !is_android && !is_apple
++use_zygote = is_posix && !is_android && !is_mac && !is_bsd
diff --git a/devel/electron31/files/patch-content_renderer_media_gpu_gpu__video__accelerator__factories__impl.cc b/devel/electron31/files/patch-content_renderer_media_gpu_gpu__video__accelerator__factories__impl.cc
new file mode 100644
index 000000000000..d478766ff794
--- /dev/null
+++ b/devel/electron31/files/patch-content_renderer_media_gpu_gpu__video__accelerator__factories__impl.cc
@@ -0,0 +1,11 @@
+--- content/renderer/media/gpu/gpu_video_accelerator_factories_impl.cc.orig 2024-06-18 21:43:32 UTC
++++ content/renderer/media/gpu/gpu_video_accelerator_factories_impl.cc
+@@ -47,7 +47,7 @@ bool UseSingleNV12() {
+ #else
+ static BASE_FEATURE(kUseSingleNV12ForSoftwareGMB,
+ "UseSingleNV12ForSoftwareGMB",
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT);
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT);
diff --git a/devel/electron31/files/patch-content_renderer_render__thread__impl.cc b/devel/electron31/files/patch-content_renderer_render__thread__impl.cc
new file mode 100644
index 000000000000..3a88a2c02db6
--- /dev/null
+++ b/devel/electron31/files/patch-content_renderer_render__thread__impl.cc
@@ -0,0 +1,38 @@
+--- content/renderer/render_thread_impl.cc.orig 2024-06-30 11:48:26 UTC
++++ content/renderer/render_thread_impl.cc
+@@ -206,6 +206,8 @@
+
+ #if BUILDFLAG(IS_APPLE)
+ #include <malloc/malloc.h>
++#elif BUILDFLAG(IS_BSD)
++#include <stdlib.h>
+ #else
+ #include <malloc.h>
+ #endif
+@@ -1000,7 +1002,7 @@ media::GpuVideoAcceleratorFactories* RenderThreadImpl:
+ kGpuStreamIdMedia, kGpuStreamPriorityMedia);
+
+ const bool enable_video_decode_accelerator =
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FeatureList::IsEnabled(media::kVaapiVideoDecodeLinux) &&
+ #endif // BUILDFLAG(IS_LINUX)
+ !cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode) &&
+@@ -1009,7 +1011,7 @@ media::GpuVideoAcceleratorFactories* RenderThreadImpl:
+ gpu::kGpuFeatureStatusEnabled);
+
+ const bool enable_video_encode_accelerator =
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FeatureList::IsEnabled(media::kVaapiVideoEncodeLinux) &&
+ #else
+ !cmd_line->HasSwitch(switches::kDisableAcceleratedVideoEncode) &&
+@@ -1752,7 +1754,7 @@ std::unique_ptr<CodecFactory> RenderThreadImpl::Create
+ bool enable_video_encode_accelerator) {
+ mojo::PendingRemote<media::mojom::VideoEncodeAcceleratorProvider>
+ vea_provider;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (base::FeatureList::IsEnabled(media::kUseOutOfProcessVideoEncoding)) {
+ BindHostReceiver(vea_provider.InitWithNewPipeAndPassReceiver());
+ } else {
diff --git a/devel/electron31/files/patch-content_renderer_renderer__blink__platform__impl.cc b/devel/electron31/files/patch-content_renderer_renderer__blink__platform__impl.cc
new file mode 100644
index 000000000000..2c18a3bde287
--- /dev/null
+++ b/devel/electron31/files/patch-content_renderer_renderer__blink__platform__impl.cc
@@ -0,0 +1,45 @@
+--- content/renderer/renderer_blink_platform_impl.cc.orig 2024-04-28 08:50:04 UTC
++++ content/renderer/renderer_blink_platform_impl.cc
+@@ -115,7 +115,7 @@
+
+ #if BUILDFLAG(IS_MAC)
+ #include "content/child/child_process_sandbox_support_impl_mac.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/child/child_process_sandbox_support_impl_linux.h"
+ #include "content/child/sandboxed_process_thread_type_handler.h"
+ #endif
+@@ -185,13 +185,13 @@ RendererBlinkPlatformImpl::RendererBlinkPlatformImpl(
+ is_locked_to_site_(false),
+ main_thread_scheduler_(main_thread_scheduler),
+ next_frame_sink_id_(uint32_t{std::numeric_limits<int32_t>::max()} + 1) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ sk_sp<font_service::FontLoader> font_loader;
+ #endif
+
+ // RenderThread may not exist in some tests.
+ if (RenderThreadImpl::current()) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ mojo::PendingRemote<font_service::mojom::FontService> font_service;
+ RenderThreadImpl::current()->BindHostReceiver(
+ font_service.InitWithNewPipeAndPassReceiver());
+@@ -200,7 +200,7 @@ RendererBlinkPlatformImpl::RendererBlinkPlatformImpl(
+ #endif
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (sandboxEnabled()) {
+ #if BUILDFLAG(IS_MAC)
+ sandbox_support_ = std::make_unique<WebSandboxSupportMac>();
+@@ -261,7 +261,7 @@ blink::WebSandboxSupport* RendererBlinkPlatformImpl::G
+ #endif
+
+ blink::WebSandboxSupport* RendererBlinkPlatformImpl::GetSandboxSupport() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ return sandbox_support_.get();
+ #else
+ // These platforms do not require sandbox support.
diff --git a/devel/electron31/files/patch-content_renderer_renderer__blink__platform__impl.h b/devel/electron31/files/patch-content_renderer_renderer__blink__platform__impl.h
new file mode 100644
index 000000000000..3eba55df8f60
--- /dev/null
+++ b/devel/electron31/files/patch-content_renderer_renderer__blink__platform__impl.h
@@ -0,0 +1,11 @@
+--- content/renderer/renderer_blink_platform_impl.h.orig 2024-02-27 21:36:00 UTC
++++ content/renderer/renderer_blink_platform_impl.h
+@@ -249,7 +249,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : publi
+ void Collect3DContextInformation(blink::Platform::GraphicsInfo* gl_info,
+ const gpu::GPUInfo& gpu_info) const;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<blink::WebSandboxSupport> sandbox_support_;
+ #endif
+
diff --git a/devel/electron31/files/patch-content_renderer_renderer__main__platform__delegate__linux.cc b/devel/electron31/files/patch-content_renderer_renderer__main__platform__delegate__linux.cc
new file mode 100644
index 000000000000..aad0a7035f0b
--- /dev/null
+++ b/devel/electron31/files/patch-content_renderer_renderer__main__platform__delegate__linux.cc
@@ -0,0 +1,18 @@
+--- content/renderer/renderer_main_platform_delegate_linux.cc.orig 2023-10-19 19:58:22 UTC
++++ content/renderer/renderer_main_platform_delegate_linux.cc
+@@ -44,6 +44,7 @@ bool RendererMainPlatformDelegate::EnableSandbox() {
+ // any renderer has been started.
+ // Here, we test that the status of SeccompBpf in the renderer is consistent
+ // with what SandboxLinux::GetStatus() said we would do.
++#if !BUILDFLAG(IS_BSD)
+ auto* linux_sandbox = sandbox::policy::SandboxLinux::GetInstance();
+ if (linux_sandbox->GetStatus() & sandbox::policy::SandboxLinux::kSeccompBPF) {
+ CHECK(linux_sandbox->seccomp_bpf_started());
+@@ -65,6 +66,7 @@ bool RendererMainPlatformDelegate::EnableSandbox() {
+ CHECK_EQ(errno, EPERM);
+ }
+ #endif // __x86_64__
++#endif
+
+ return true;
+ }
diff --git a/devel/electron31/files/patch-content_shell_BUILD.gn b/devel/electron31/files/patch-content_shell_BUILD.gn
new file mode 100644
index 000000000000..9b0ff94468f4
--- /dev/null
+++ b/devel/electron31/files/patch-content_shell_BUILD.gn
@@ -0,0 +1,11 @@
+--- content/shell/BUILD.gn.orig 2024-06-18 21:43:32 UTC
++++ content/shell/BUILD.gn
+@@ -1094,7 +1094,7 @@ group("content_shell_crash_test") {
+ if (is_win) {
+ data_deps += [ "//build/win:copy_cdb_to_output" ]
+ }
+- if (is_posix) {
++ if (is_posix && !is_bsd) {
+ data_deps += [
+ "//third_party/breakpad:dump_syms",
+ "//third_party/breakpad:minidump_stackwalk",
diff --git a/devel/electron31/files/patch-content_shell_app_shell__main__delegate.cc b/devel/electron31/files/patch-content_shell_app_shell__main__delegate.cc
new file mode 100644
index 000000000000..0c581d956558
--- /dev/null
+++ b/devel/electron31/files/patch-content_shell_app_shell__main__delegate.cc
@@ -0,0 +1,11 @@
+--- content/shell/app/shell_main_delegate.cc.orig 2024-06-18 21:43:32 UTC
++++ content/shell/app/shell_main_delegate.cc
+@@ -281,7 +281,7 @@ void ShellMainDelegate::PreSandboxStartup() {
+ // Reporting for sub-processes will be initialized in ZygoteForked.
+ if (process_type != switches::kZygoteProcess) {
+ crash_reporter::InitializeCrashpad(process_type.empty(), process_type);
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ crash_reporter::SetFirstChanceExceptionHandler(
+ v8::TryHandleWebAssemblyTrapPosix);
+ #endif
diff --git a/devel/electron31/files/patch-content_shell_browser_shell__browser__main__parts.cc b/devel/electron31/files/patch-content_shell_browser_shell__browser__main__parts.cc
new file mode 100644
index 000000000000..f463ffc51529
--- /dev/null
+++ b/devel/electron31/files/patch-content_shell_browser_shell__browser__main__parts.cc
@@ -0,0 +1,47 @@
+--- content/shell/browser/shell_browser_main_parts.cc.orig 2023-10-19 19:58:22 UTC
++++ content/shell/browser/shell_browser_main_parts.cc
+@@ -51,7 +51,7 @@
+ #include "net/base/network_change_notifier.h"
+ #endif
+
+-#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ #include "ui/base/ime/init/input_method_initializer.h"
+ #endif
+
+@@ -68,7 +68,7 @@
+ #include "chromeos/lacros/dbus/lacros_dbus_thread_manager.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui.h" // nogncheck
+ #include "ui/linux/linux_ui_factory.h" // nogncheck
+ #endif
+@@ -139,7 +139,7 @@ void ShellBrowserMainParts::PostCreateMainMessageLoop(
+ }
+
+ int ShellBrowserMainParts::PreEarlyInitialization() {
+-#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ ui::InitializeInputMethodForTesting();
+ #endif
+ #if BUILDFLAG(IS_ANDROID)
+@@ -168,7 +168,7 @@ void ShellBrowserMainParts::ToolkitInitialized() {
+ if (switches::IsRunWebTestsSwitchPresent())
+ return;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ui::LinuxUi::SetInstance(ui::GetDefaultLinuxUi());
+ #endif
+ }
+@@ -215,7 +215,7 @@ void ShellBrowserMainParts::PostMainMessageLoopRun() {
+ ShellDevToolsManagerDelegate::StopHttpHandler();
+ browser_context_.reset();
+ off_the_record_browser_context_.reset();
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ui::LinuxUi::SetInstance(nullptr);
+ #endif
+ performance_manager_lifetime_.reset();
diff --git a/devel/electron31/files/patch-content_shell_browser_shell__paths.cc b/devel/electron31/files/patch-content_shell_browser_shell__paths.cc
new file mode 100644
index 000000000000..c00a1c66a5a2
--- /dev/null
+++ b/devel/electron31/files/patch-content_shell_browser_shell__paths.cc
@@ -0,0 +1,20 @@
+--- content/shell/browser/shell_paths.cc.orig 2022-02-28 16:54:41 UTC
++++ content/shell/browser/shell_paths.cc
+@@ -13,7 +13,7 @@
+
+ #if BUILDFLAG(IS_FUCHSIA)
+ #include "base/fuchsia/file_utils.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/nix/xdg_util.h"
+ #endif
+
+@@ -25,7 +25,7 @@ bool GetDefaultUserDataDirectory(base::FilePath* resul
+ #if BUILDFLAG(IS_WIN)
+ CHECK(base::PathService::Get(base::DIR_LOCAL_APP_DATA, result));
+ *result = result->Append(std::wstring(L"content_shell"));
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
+ base::FilePath config_dir(base::nix::GetXDGDirectory(
+ env.get(), base::nix::kXdgConfigHomeEnvVar, base::nix::kDotConfigDir));
diff --git a/devel/electron31/files/patch-content_shell_renderer_shell__content__renderer__client.cc b/devel/electron31/files/patch-content_shell_renderer_shell__content__renderer__client.cc
new file mode 100644
index 000000000000..a12a439a283d
--- /dev/null
+++ b/devel/electron31/files/patch-content_shell_renderer_shell__content__renderer__client.cc
@@ -0,0 +1,11 @@
+--- content/shell/renderer/shell_content_renderer_client.cc.orig 2024-06-18 21:43:32 UTC
++++ content/shell/renderer/shell_content_renderer_client.cc
+@@ -54,7 +54,7 @@
+ #include "media/base/media_switches.h"
+ #endif
+
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && \
+ (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM64))
+ #define ENABLE_WEB_ASSEMBLY_TRAP_HANDLER_LINUX
+ #include "base/debug/stack_trace.h"
diff --git a/devel/electron31/files/patch-content_shell_utility_shell__content__utility__client.cc b/devel/electron31/files/patch-content_shell_utility_shell__content__utility__client.cc
new file mode 100644
index 000000000000..6096106c4f80
--- /dev/null
+++ b/devel/electron31/files/patch-content_shell_utility_shell__content__utility__client.cc
@@ -0,0 +1,20 @@
+--- content/shell/utility/shell_content_utility_client.cc.orig 2023-03-30 00:33:51 UTC
++++ content/shell/utility/shell_content_utility_client.cc
+@@ -38,7 +38,7 @@
+ #include "sandbox/policy/sandbox.h"
+ #include "services/test/echo/echo_service.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/test/sandbox_status_service.h"
+ #endif
+
+@@ -187,7 +187,7 @@ void ShellContentUtilityClient::ExposeInterfacesToBrow
+ binders->Add<mojom::PowerMonitorTest>(
+ base::BindRepeating(&PowerMonitorTestImpl::MakeSelfOwnedReceiver),
+ base::SingleThreadTaskRunner::GetCurrentDefault());
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (register_sandbox_status_helper_) {
+ binders->Add<content::mojom::SandboxStatusService>(
+ base::BindRepeating(
diff --git a/devel/electron31/files/patch-content_utility_services.cc b/devel/electron31/files/patch-content_utility_services.cc
new file mode 100644
index 000000000000..dd5be5c83733
--- /dev/null
+++ b/devel/electron31/files/patch-content_utility_services.cc
@@ -0,0 +1,99 @@
+--- content/utility/services.cc.orig 2024-06-18 21:43:32 UTC
++++ content/utility/services.cc
+@@ -74,7 +74,7 @@ extern sandbox::TargetServices* g_utility_target_servi
+ extern sandbox::TargetServices* g_utility_target_services;
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "media/mojo/services/mojo_video_encode_accelerator_provider_factory.h"
+ #include "sandbox/linux/services/libc_interceptor.h"
+ #include "sandbox/policy/mojom/sandbox.mojom.h"
+@@ -97,7 +97,7 @@ extern sandbox::TargetServices* g_utility_target_servi
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH) && (BUILDFLAG(USE_VAAPI) ||
+ // BUILDFLAG(USE_V4L2_CODEC))
+
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)) && \
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)) && \
+ (BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC))
+ #include "content/common/features.h"
+ #include "media/mojo/services/stable_video_decoder_factory_process_service.h" // nogncheck
+@@ -115,13 +115,13 @@ extern sandbox::TargetServices* g_utility_target_servi
+ #endif // BUILDFLAG(ENABLE_ACCESSIBILITY_SERVICE)
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || \
+- BUILDFLAG(ENABLE_VIDEO_EFFECTS)
++ BUILDFLAG(ENABLE_VIDEO_EFFECTS) || BUILDFLAG(IS_BSD)
+ #include "services/viz/public/cpp/gpu/gpu.h"
+ #include "services/viz/public/mojom/gpu.mojom.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) ||
+ // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(ENABLE_VIDEO_EFFECTS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "media/capture/capture_switches.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) ||
+ // BUILDFLAG(IS_CHROMEOS_ASH)
+@@ -239,7 +239,7 @@ auto RunAudio(mojo::PendingReceiver<audio::mojom::Audi
+ << "task_policy_set TASK_QOS_POLICY";
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ auto* command_line = base::CommandLine::ForCurrentProcess();
+ if (sandbox::policy::SandboxTypeFromCommandLine(*command_line) ==
+ sandbox::mojom::Sandbox::kNoSandbox) {
+@@ -328,7 +328,7 @@ auto RunVideoCapture(
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+ auto service = std::make_unique<UtilityThreadVideoCaptureServiceImpl>(
+ std::move(receiver), base::SingleThreadTaskRunner::GetCurrentDefault());
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ {
+ #else
+@@ -384,7 +384,7 @@ auto RunOOPArcVideoAcceleratorFactoryService(
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH) && (BUILDFLAG(USE_VAAPI) ||
+ // BUILDFLAG(USE_V4L2_CODEC))
+
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)) && \
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)) && \
+ (BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC))
+ auto RunStableVideoDecoderFactoryProcessService(
+ mojo::PendingReceiver<
+@@ -395,7 +395,7 @@ auto RunStableVideoDecoderFactoryProcessService(
+ #endif // (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)) &&
+ // (BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC))
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ auto RunVideoEncodeAcceleratorProviderFactory(
+ mojo::PendingReceiver<media::mojom::VideoEncodeAcceleratorProviderFactory>
+ receiver) {
+@@ -418,7 +418,7 @@ void RegisterIOThreadServices(mojo::ServiceFactory& se
+ // loop of type IO that can get notified when pipes have data.
+ services.Add(RunNetworkService);
+
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)) && \
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)) && \
+ (BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC))
+ if (base::FeatureList::IsEnabled(
+ features::kRunStableVideoDecoderFactoryProcessServiceOnIOThread)) {
+@@ -470,7 +470,7 @@ void RegisterMainThreadServices(mojo::ServiceFactory&
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH) && (BUILDFLAG(USE_VAAPI) ||
+ // BUILDFLAG(USE_V4L2_CODEC))
+
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)) && \
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)) && \
+ (BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC))
+ if (!base::FeatureList::IsEnabled(
+ features::kRunStableVideoDecoderFactoryProcessServiceOnIOThread)) {
+@@ -479,7 +479,7 @@ void RegisterMainThreadServices(mojo::ServiceFactory&
+ #endif // (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)) &&
+ // (BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC))
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ services.Add(RunVideoEncodeAcceleratorProviderFactory);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
diff --git a/devel/electron31/files/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.cc b/devel/electron31/files/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.cc
new file mode 100644
index 000000000000..92e07e8d0385
--- /dev/null
+++ b/devel/electron31/files/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.cc
@@ -0,0 +1,37 @@
+--- content/utility/speech/speech_recognition_sandbox_hook_linux.cc.orig 2024-04-15 20:33:58 UTC
++++ content/utility/speech/speech_recognition_sandbox_hook_linux.cc
+@@ -12,11 +12,14 @@
+ #include "sandbox/linux/syscall_broker/broker_command.h"
+ #include "sandbox/linux/syscall_broker/broker_file_permission.h"
+
++#if !BUILDFLAG(IS_BSD)
+ using sandbox::syscall_broker::BrokerFilePermission;
+ using sandbox::syscall_broker::MakeBrokerCommandSet;
++#endif
+
+ namespace speech {
+
++#if !BUILDFLAG(IS_BSD)
+ namespace {
+
+ // Gets the file permissions required by the Speech On-Device API (SODA).
+@@ -50,9 +53,11 @@ std::vector<BrokerFilePermission> GetSodaFilePermissio
+ }
+
+ } // namespace
++#endif
+
+ bool SpeechRecognitionPreSandboxHook(
+ sandbox::policy::SandboxLinux::Options options) {
++#if !BUILDFLAG(IS_BSD)
+ #if BUILDFLAG(ENABLE_SODA_INTEGRATION_TESTS)
+ base::FilePath test_binary_path = GetSodaTestBinaryPath();
+ DVLOG(0) << "SODA test binary path: " << test_binary_path.value().c_str();
+@@ -75,6 +80,7 @@ bool SpeechRecognitionPreSandboxHook(
+ }),
+ GetSodaFilePermissions(), options);
+ instance->EngageNamespaceSandboxIfPossible();
++#endif
+
+ return true;
+ }
diff --git a/devel/electron31/files/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.h b/devel/electron31/files/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.h
new file mode 100644
index 000000000000..cbeba4accc3e
--- /dev/null
+++ b/devel/electron31/files/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.h
@@ -0,0 +1,16 @@
+--- content/utility/speech/speech_recognition_sandbox_hook_linux.h.orig 2023-10-19 19:58:23 UTC
++++ content/utility/speech/speech_recognition_sandbox_hook_linux.h
+@@ -5,7 +5,13 @@
+ #ifndef CONTENT_UTILITY_SPEECH_SPEECH_RECOGNITION_SANDBOX_HOOK_LINUX_H_
+ #define CONTENT_UTILITY_SPEECH_SPEECH_RECOGNITION_SANDBOX_HOOK_LINUX_H_
+
++#include "build/build_config.h"
++
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#else
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+
+ namespace speech {
+
diff --git a/devel/electron31/files/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.cc b/devel/electron31/files/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.cc
new file mode 100644
index 000000000000..d954dca7e1c3
--- /dev/null
+++ b/devel/electron31/files/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.cc
@@ -0,0 +1,29 @@
+--- content/utility/utility_blink_platform_with_sandbox_support_impl.cc.orig 2023-05-25 00:41:55 UTC
++++ content/utility/utility_blink_platform_with_sandbox_support_impl.cc
+@@ -9,7 +9,7 @@
+
+ #if BUILDFLAG(IS_MAC)
+ #include "content/child/child_process_sandbox_support_impl_mac.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/child/child_process_sandbox_support_impl_linux.h"
+ #endif
+
+@@ -17,7 +17,7 @@ namespace content {
+
+ UtilityBlinkPlatformWithSandboxSupportImpl::
+ UtilityBlinkPlatformWithSandboxSupportImpl() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ mojo::PendingRemote<font_service::mojom::FontService> font_service;
+ UtilityThread::Get()->BindHostReceiver(
+ font_service.InitWithNewPipeAndPassReceiver());
+@@ -35,7 +35,7 @@ UtilityBlinkPlatformWithSandboxSupportImpl::
+
+ blink::WebSandboxSupport*
+ UtilityBlinkPlatformWithSandboxSupportImpl::GetSandboxSupport() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ return sandbox_support_.get();
+ #else
+ return nullptr;
diff --git a/devel/electron31/files/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.h b/devel/electron31/files/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.h
new file mode 100644
index 000000000000..c92332ad1c74
--- /dev/null
+++ b/devel/electron31/files/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.h
@@ -0,0 +1,11 @@
+--- content/utility/utility_blink_platform_with_sandbox_support_impl.h.orig 2023-05-25 00:41:55 UTC
++++ content/utility/utility_blink_platform_with_sandbox_support_impl.h
+@@ -33,7 +33,7 @@ class UtilityBlinkPlatformWithSandboxSupportImpl : pub
+ blink::WebSandboxSupport* GetSandboxSupport() override;
+
+ private:
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<blink::WebSandboxSupport> sandbox_support_;
+ #endif
+ };
diff --git a/devel/electron31/files/patch-content_utility_utility__main.cc b/devel/electron31/files/patch-content_utility_utility__main.cc
new file mode 100644
index 000000000000..9abd4cc2cd7f
--- /dev/null
+++ b/devel/electron31/files/patch-content_utility_utility__main.cc
@@ -0,0 +1,128 @@
+--- content/utility/utility_main.cc.orig 2024-06-18 21:43:32 UTC
++++ content/utility/utility_main.cc
+@@ -38,17 +38,21 @@
+ #include "third_party/icu/source/common/unicode/unistr.h"
+ #include "third_party/icu/source/i18n/unicode/timezone.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/file_descriptor_store.h"
+ #include "base/files/file_util.h"
+ #include "base/pickle.h"
+ #include "content/child/sandboxed_process_thread_type_handler.h"
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "content/common/gpu_pre_sandbox_hook_linux.h"
++#endif
+ #include "content/public/common/content_descriptor_keys.h"
+ #include "content/utility/speech/speech_recognition_sandbox_hook_linux.h"
+ #include "gpu/config/gpu_info_collector.h"
+ #include "media/gpu/sandbox/hardware_video_encoding_sandbox_hook_linux.h"
++#if !BUILDFLAG(IS_BSD)
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+ #include "services/audio/audio_sandbox_hook_linux.h"
+ #include "services/network/network_sandbox_hook_linux.h"
+ // gn check is not smart enough to realize that this include only applies to
+@@ -60,10 +64,15 @@
+ #endif
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
+
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#include "content/common/gpu_pre_sandbox_hook_bsd.h"
++#endif
++
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ #include "chromeos/ash/components/assistant/buildflags.h"
+ #include "chromeos/ash/services/ime/ime_sandbox_hook.h"
+@@ -75,7 +84,7 @@
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+ #if (BUILDFLAG(ENABLE_SCREEN_AI_SERVICE) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)))
+ #include "services/screen_ai/public/cpp/utilities.h" // nogncheck
+ #include "services/screen_ai/sandbox/screen_ai_sandbox_hook_linux.h" // nogncheck
+ #endif
+@@ -102,7 +111,7 @@ namespace {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::vector<std::string> GetNetworkContextsParentDirectories() {
+ base::MemoryMappedFile::Region region;
+ base::ScopedFD read_pipe_fd = base::FileDescriptorStore::GetInstance().TakeFD(
+@@ -129,9 +138,10 @@ std::vector<std::string> GetNetworkContextsParentDirec
+ return dirs;
+ }
+
++#if !BUILDFLAG(IS_BSD)
+ bool ShouldUseAmdGpuPolicy(sandbox::mojom::Sandbox sandbox_type) {
+ const bool obtain_gpu_info =
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ sandbox_type == sandbox::mojom::Sandbox::kHardwareVideoDecoding ||
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
+ sandbox_type == sandbox::mojom::Sandbox::kHardwareVideoEncoding;
+@@ -146,6 +156,7 @@ bool ShouldUseAmdGpuPolicy(sandbox::mojom::Sandbox san
+
+ return false;
+ }
++#endif
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+ #if BUILDFLAG(IS_WIN)
+@@ -250,7 +261,8 @@ int UtilityMain(MainFunctionParams parameters) {
+ CHECK(on_device_model::OnDeviceModelService::PreSandboxInit());
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++// XXX BSD
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_BSD)
+ // Thread type delegate of the process should be registered before first
+ // thread type change in ChildProcess constructor. It also needs to be
+ // registered before the process has multiple threads, which may race with
+@@ -262,7 +274,7 @@ int UtilityMain(MainFunctionParams parameters) {
+ }
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Initializes the sandbox before any threads are created.
+ // TODO(jorgelo): move this after GTK initialization when we enable a strict
+ // Seccomp-BPF policy.
+@@ -300,7 +312,7 @@ int UtilityMain(MainFunctionParams parameters) {
+ screen_ai::GetBinaryPathSwitch()));
+ break;
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ case sandbox::mojom::Sandbox::kHardwareVideoDecoding:
+ pre_sandbox_hook =
+ base::BindOnce(&media::HardwareVideoDecodingPreSandboxHook);
+@@ -327,6 +339,7 @@ int UtilityMain(MainFunctionParams parameters) {
+ default:
+ break;
+ }
++#if !BUILDFLAG(IS_BSD)
+ if (!sandbox::policy::IsUnsandboxedSandboxType(sandbox_type) &&
+ (parameters.zygote_child || !pre_sandbox_hook.is_null())) {
+ sandbox_options.use_amd_specific_policies =
+@@ -334,6 +347,11 @@ int UtilityMain(MainFunctionParams parameters) {
+ sandbox::policy::Sandbox::Initialize(
+ sandbox_type, std::move(pre_sandbox_hook), sandbox_options);
+ }
++#else
++ sandbox::policy::Sandbox::Initialize(
++ sandbox_type, std::move(pre_sandbox_hook),
++ sandbox::policy::SandboxLinux::Options());
++#endif
+
+ // Start the HangWatcher now that the sandbox is engaged, if it hasn't
+ // already been started.
diff --git a/devel/electron31/files/patch-content_utility_utility__thread__impl.cc b/devel/electron31/files/patch-content_utility_utility__thread__impl.cc
new file mode 100644
index 000000000000..8912b26856bf
--- /dev/null
+++ b/devel/electron31/files/patch-content_utility_utility__thread__impl.cc
@@ -0,0 +1,21 @@
+--- content/utility/utility_thread_impl.cc.orig 2024-06-18 21:43:32 UTC
++++ content/utility/utility_thread_impl.cc
+@@ -31,7 +31,7 @@
+ #include "mojo/public/cpp/bindings/pending_receiver.h"
+ #include "mojo/public/cpp/bindings/service_factory.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/child/sandboxed_process_thread_type_handler.h"
+ #endif
+
+@@ -251,7 +251,8 @@ void UtilityThreadImpl::Init() {
+
+ GetContentClient()->utility()->UtilityThreadStarted();
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++// XXX BSD
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_BSD)
+ SandboxedProcessThreadTypeHandler::NotifyMainChildThreadCreated();
+ #endif
+
diff --git a/devel/electron31/files/patch-content_zygote_BUILD.gn b/devel/electron31/files/patch-content_zygote_BUILD.gn
new file mode 100644
index 000000000000..b9c3d8fe8cdc
--- /dev/null
+++ b/devel/electron31/files/patch-content_zygote_BUILD.gn
@@ -0,0 +1,11 @@
+--- content/zygote/BUILD.gn.orig 2022-02-07 13:39:41 UTC
++++ content/zygote/BUILD.gn
+@@ -5,7 +5,7 @@
+ import("//build/config/nacl/config.gni")
+ import("//content/public/common/zygote/features.gni")
+
+-if (is_linux || is_chromeos) {
++if ((is_linux || is_chromeos) && !is_bsd) {
+ source_set("zygote") {
+ sources = [
+ "zygote_linux.cc",
diff --git a/devel/electron31/files/patch-content_zygote_zygote__linux.cc b/devel/electron31/files/patch-content_zygote_zygote__linux.cc
new file mode 100644
index 000000000000..a063b60ce6d0
--- /dev/null
+++ b/devel/electron31/files/patch-content_zygote_zygote__linux.cc
@@ -0,0 +1,15 @@
+--- content/zygote/zygote_linux.cc.orig 2024-06-18 21:43:32 UTC
++++ content/zygote/zygote_linux.cc
+@@ -1,6 +1,7 @@
+ // Copyright 2012 The Chromium Authors
+ // Use of this source code is governed by a BSD-style license that can be
+ // found in the LICENSE file.
++#if 0
+
+ #include "content/zygote/zygote_linux.h"
+
+@@ -718,3 +719,4 @@ void Zygote::HandleReinitializeLoggingRequest(base::Pi
+ }
+
+ } // namespace content
++#endif
diff --git a/devel/electron31/files/patch-content_zygote_zygote__main__linux.cc b/devel/electron31/files/patch-content_zygote_zygote__main__linux.cc
new file mode 100644
index 000000000000..cd698a7423d4
--- /dev/null
+++ b/devel/electron31/files/patch-content_zygote_zygote__main__linux.cc
@@ -0,0 +1,58 @@
+--- content/zygote/zygote_main_linux.cc.orig 2023-10-19 19:58:23 UTC
++++ content/zygote/zygote_main_linux.cc
+@@ -11,7 +11,9 @@
+ #include <stddef.h>
+ #include <stdint.h>
+ #include <string.h>
++#if !BUILDFLAG(IS_BSD)
+ #include <sys/prctl.h>
++#endif
+ #include <sys/socket.h>
+ #include <sys/types.h>
+ #include <unistd.h>
+@@ -41,7 +43,9 @@
+ #include "sandbox/linux/services/thread_helpers.h"
+ #include "sandbox/linux/suid/client/setuid_sandbox_client.h"
+ #include "sandbox/policy/linux/sandbox_debug_handling_linux.h"
++#if !BUILDFLAG(IS_BSD)
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+ #include "sandbox/policy/sandbox.h"
+ #include "sandbox/policy/switches.h"
+ #include "third_party/icu/source/i18n/unicode/timezone.h"
+@@ -50,11 +54,13 @@ namespace content {
+
+ namespace {
+
++#if !BUILDFLAG(IS_BSD)
+ void CloseFds(const std::vector<int>& fds) {
+ for (const auto& it : fds) {
+ PCHECK(0 == IGNORE_EINTR(close(it)));
+ }
+ }
++#endif
+
+ base::OnceClosure ClosureFromTwoClosures(base::OnceClosure one,
+ base::OnceClosure two) {
+@@ -157,9 +163,11 @@ static void EnterLayerOneSandbox(sandbox::policy::Sand
+ CHECK(!using_layer1_sandbox);
+ }
+ }
++#endif
+
+ bool ZygoteMain(
+ std::vector<std::unique_ptr<ZygoteForkDelegate>> fork_delegates) {
++#if !BUILDFLAG(IS_BSD)
+ sandbox::SetAmZygoteOrRenderer(true, GetSandboxFD());
+
+ auto* linux_sandbox = sandbox::policy::SandboxLinux::GetInstance();
+@@ -224,6 +232,9 @@ bool ZygoteMain(
+
+ // This function call can return multiple times, once per fork().
+ return zygote.ProcessRequests();
++#else
++ return false;
++#endif
+ }
+
+ } // namespace content
diff --git a/devel/electron31/files/patch-device_bluetooth_bluetooth__adapter.cc b/devel/electron31/files/patch-device_bluetooth_bluetooth__adapter.cc
new file mode 100644
index 000000000000..a429ccd154fb
--- /dev/null
+++ b/devel/electron31/files/patch-device_bluetooth_bluetooth__adapter.cc
@@ -0,0 +1,11 @@
+--- device/bluetooth/bluetooth_adapter.cc.orig 2024-04-15 20:33:58 UTC
++++ device/bluetooth/bluetooth_adapter.cc
+@@ -32,7 +32,7 @@ BluetoothAdapter::ServiceOptions::~ServiceOptions() =
+ BluetoothAdapter::ServiceOptions::ServiceOptions() = default;
+ BluetoothAdapter::ServiceOptions::~ServiceOptions() = default;
+
+-#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS) && \
++#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD) && \
+ !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_LINUX)
+ // static
+ scoped_refptr<BluetoothAdapter> BluetoothAdapter::CreateAdapter() {
diff --git a/devel/electron31/files/patch-device_bluetooth_cast__bluetooth.gni b/devel/electron31/files/patch-device_bluetooth_cast__bluetooth.gni
new file mode 100644
index 000000000000..0fcfccc24b76
--- /dev/null
+++ b/devel/electron31/files/patch-device_bluetooth_cast__bluetooth.gni
@@ -0,0 +1,9 @@
+--- device/bluetooth/cast_bluetooth.gni.orig 2022-08-31 12:19:35 UTC
++++ device/bluetooth/cast_bluetooth.gni
+@@ -2,5 +2,5 @@ import("//build/config/features.gni")
+
+ declare_args() {
+ force_cast_bluetooth = false
+- use_bluez = (is_linux && !is_castos && use_dbus) || is_chromeos
++ use_bluez = use_dbus && !is_bsd
+ }
diff --git a/devel/electron31/files/patch-device_fido_fido__discovery__factory.cc b/devel/electron31/files/patch-device_fido_fido__discovery__factory.cc
new file mode 100644
index 000000000000..e173864ba0c9
--- /dev/null
+++ b/devel/electron31/files/patch-device_fido_fido__discovery__factory.cc
@@ -0,0 +1,11 @@
+--- device/fido/fido_discovery_factory.cc.orig 2024-06-18 21:43:33 UTC
++++ device/fido/fido_discovery_factory.cc
+@@ -127,7 +127,7 @@ FidoDiscoveryFactory::MaybeCreateEnclaveDiscovery() {
+
+ std::optional<std::unique_ptr<FidoDiscoveryBase>>
+ FidoDiscoveryFactory::MaybeCreateEnclaveDiscovery() {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!base::FeatureList::IsEnabled(kWebAuthnEnclaveAuthenticator) ||
+ !enclave_ui_request_stream_ || !network_context_factory_) {
+ return std::nullopt;
diff --git a/devel/electron31/files/patch-device_gamepad_BUILD.gn b/devel/electron31/files/patch-device_gamepad_BUILD.gn
new file mode 100644
index 000000000000..ef656feb8ebb
--- /dev/null
+++ b/devel/electron31/files/patch-device_gamepad_BUILD.gn
@@ -0,0 +1,11 @@
+--- device/gamepad/BUILD.gn.orig 2023-11-29 21:40:02 UTC
++++ device/gamepad/BUILD.gn
+@@ -99,7 +99,7 @@ component("gamepad") {
+ "hid_writer_linux.cc",
+ "hid_writer_linux.h",
+ ]
+- if (use_udev) {
++ if (use_udev && !is_bsd) {
+ sources += [
+ "gamepad_device_linux.cc",
+ "gamepad_device_linux.h",
diff --git a/devel/electron31/files/patch-device_gamepad_gamepad__provider.cc b/devel/electron31/files/patch-device_gamepad_gamepad__provider.cc
new file mode 100644
index 000000000000..5f74852478e2
--- /dev/null
+++ b/devel/electron31/files/patch-device_gamepad_gamepad__provider.cc
@@ -0,0 +1,11 @@
+--- device/gamepad/gamepad_provider.cc.orig 2023-03-30 00:33:51 UTC
++++ device/gamepad/gamepad_provider.cc
+@@ -219,7 +219,7 @@ void GamepadProvider::Initialize(std::unique_ptr<Gamep
+
+ if (!polling_thread_)
+ polling_thread_ = std::make_unique<base::Thread>("Gamepad polling thread");
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On Linux, the data fetcher needs to watch file descriptors, so the message
+ // loop needs to be a libevent loop.
+ const base::MessagePumpType kMessageLoopType = base::MessagePumpType::IO;
diff --git a/devel/electron31/files/patch-device_gamepad_hid__writer__linux.cc b/devel/electron31/files/patch-device_gamepad_hid__writer__linux.cc
new file mode 100644
index 000000000000..439446240bac
--- /dev/null
+++ b/devel/electron31/files/patch-device_gamepad_hid__writer__linux.cc
@@ -0,0 +1,11 @@
+--- device/gamepad/hid_writer_linux.cc.orig 2022-02-28 16:54:41 UTC
++++ device/gamepad/hid_writer_linux.cc
+@@ -2,6 +2,8 @@
+ // Use of this source code is governed by a BSD-style license that can be
+ // found in the LICENSE file.
+
++#include <unistd.h>
++
+ #include "device/gamepad/hid_writer_linux.h"
+
+ #include <unistd.h>
diff --git a/devel/electron31/files/patch-electron_BUILD.gn b/devel/electron31/files/patch-electron_BUILD.gn
new file mode 100644
index 000000000000..c503cc8dd259
--- /dev/null
+++ b/devel/electron31/files/patch-electron_BUILD.gn
@@ -0,0 +1,60 @@
+--- electron/BUILD.gn.orig 2024-06-24 09:53:23 UTC
++++ electron/BUILD.gn
+@@ -523,7 +523,7 @@ source_set("electron_lib") {
+ defines += [ "GDK_DISABLE_DEPRECATION_WARNINGS" ]
+ }
+
+- if (!is_mas_build) {
++ if (!is_mas_build && !is_bsd) {
+ deps += [
+ "//components/crash/core/app",
+ "//components/crash/core/browser",
+@@ -616,6 +616,12 @@ source_set("electron_lib") {
+ cflags_objcc = [ "-fobjc-weak" ]
+ }
+ }
++ if (is_bsd) {
++ sources -= [
++ "shell/common/crash_keys.cc",
++ "shell/common/crash_keys.h",
++ ]
++ }
+ if (is_linux) {
+ libs = [ "xshmfence" ]
+ deps += [
+@@ -1196,7 +1202,7 @@ if (is_mac) {
+ ":electron_lib",
+ ":electron_win32_resources",
+ ":packed_resources",
+- "//components/crash/core/app",
++ # "//components/crash/core/app",
+ "//content:sandbox_helper_win",
+ "//electron/buildflags",
+ "//ui/strings",
+@@ -1222,7 +1228,7 @@ if (is_mac) {
+ public_deps = [ "//tools/v8_context_snapshot:v8_context_snapshot" ]
+ }
+
+- if (is_linux) {
++ if (is_linux && !is_bsd) {
+ data_deps += [ "//components/crash/core/app:chrome_crashpad_handler" ]
+ }
+
+@@ -1289,7 +1295,7 @@ if (is_mac) {
+ configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
+ }
+
+- if (is_linux) {
++ if (is_linux && !is_bsd) {
+ deps += [ "//sandbox/linux:chrome_sandbox" ]
+ }
+ }
+@@ -1397,7 +1403,7 @@ dist_zip("electron_dist_zip") {
+ ":electron_version_file",
+ ":licenses",
+ ]
+- if (is_linux) {
++ if (is_linux && !is_bsd) {
+ data_deps += [ "//sandbox/linux:chrome_sandbox" ]
+ }
+ deps = data_deps
diff --git a/devel/electron31/files/patch-electron_build_args_all.gn b/devel/electron31/files/patch-electron_build_args_all.gn
new file mode 100644
index 000000000000..e482b2c2b360
--- /dev/null
+++ b/devel/electron31/files/patch-electron_build_args_all.gn
@@ -0,0 +1,13 @@
+--- electron/build/args/all.gn.orig 2023-08-27 08:03:01 UTC
++++ electron/build/args/all.gn
+@@ -14,8 +14,8 @@ v8_enable_snapshot_native_code_counters = false
+ v8_enable_javascript_promise_hooks = true
+
+ enable_cdm_host_verification = false
+-proprietary_codecs = true
+-ffmpeg_branding = "Chrome"
++# proprietary_codecs = true
++# ffmpeg_branding = "Chrome"
+
+ enable_printing = true
+
diff --git a/devel/electron31/files/patch-electron_build_args_release.gn b/devel/electron31/files/patch-electron_build_args_release.gn
new file mode 100644
index 000000000000..99262be2e1ef
--- /dev/null
+++ b/devel/electron31/files/patch-electron_build_args_release.gn
@@ -0,0 +1,11 @@
+--- electron/build/args/release.gn.orig 2023-08-27 08:03:35 UTC
++++ electron/build/args/release.gn
+@@ -7,7 +7,7 @@ is_official_build = true
+ # explicitly override here to build OpenH264 encoder/FFmpeg decoder.
+ # The initialization of the decoder depends on whether ffmpeg has
+ # been built with H.264 support.
+-rtc_use_h264 = proprietary_codecs
++# rtc_use_h264 = proprietary_codecs
+
+ # By default, Electron builds ffmpeg with proprietary codecs enabled. In order
+ # to facilitate users who don't want to ship proprietary codecs in ffmpeg, or
diff --git a/devel/electron31/files/patch-electron_default__app_default__app.ts b/devel/electron31/files/patch-electron_default__app_default__app.ts
new file mode 100644
index 000000000000..bcba0762b54b
--- /dev/null
+++ b/devel/electron31/files/patch-electron_default__app_default__app.ts
@@ -0,0 +1,11 @@
+--- electron/default_app/default_app.ts.orig 2023-12-04 18:19:02 UTC
++++ electron/default_app/default_app.ts
+@@ -60,7 +60,7 @@ async function createWindow (backgroundColor?: string)
+ show: false
+ };
+
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd') {
+ options.icon = url.fileURLToPath(new URL('icon.png', import.meta.url));
+ }
+
diff --git a/devel/electron31/files/patch-electron_filenames.gni b/devel/electron31/files/patch-electron_filenames.gni
new file mode 100644
index 000000000000..a065ddeed995
--- /dev/null
+++ b/devel/electron31/files/patch-electron_filenames.gni
@@ -0,0 +1,13 @@
+--- electron/filenames.gni.orig 2024-07-15 15:22:56 UTC
++++ electron/filenames.gni
+@@ -236,8 +236,8 @@ filenames = {
+ "shell/app/command_line_args.h",
+ "shell/app/electron_content_client.cc",
+ "shell/app/electron_content_client.h",
+- "shell/app/electron_crash_reporter_client.cc",
+- "shell/app/electron_crash_reporter_client.h",
++ # "shell/app/electron_crash_reporter_client.cc",
++ # "shell/app/electron_crash_reporter_client.h",
+ "shell/app/electron_main_delegate.cc",
+ "shell/app/electron_main_delegate.h",
+ "shell/app/node_main.cc",
diff --git a/devel/electron31/files/patch-electron_lib_browser_api_app.ts b/devel/electron31/files/patch-electron_lib_browser_api_app.ts
new file mode 100644
index 000000000000..e10729ea752c
--- /dev/null
+++ b/devel/electron31/files/patch-electron_lib_browser_api_app.ts
@@ -0,0 +1,11 @@
+--- electron/lib/browser/api/app.ts.orig 2024-02-21 16:26:48 UTC
++++ electron/lib/browser/api/app.ts
+@@ -67,7 +67,7 @@ if (process.platform === 'darwin') {
+ app.dock!.getMenu = () => dockMenu;
+ }
+
+-if (process.platform === 'linux') {
++if (process.platform === 'linux' || process.platform === 'freebsd') {
+ const patternVmRSS = /^VmRSS:\s*(\d+) kB$/m;
+ const patternVmHWM = /^VmHWM:\s*(\d+) kB$/m;
+
diff --git a/devel/electron31/files/patch-electron_lib_browser_api_dialog.ts b/devel/electron31/files/patch-electron_lib_browser_api_dialog.ts
new file mode 100644
index 000000000000..7c30509a8597
--- /dev/null
+++ b/devel/electron31/files/patch-electron_lib_browser_api_dialog.ts
@@ -0,0 +1,11 @@
+--- electron/lib/browser/api/dialog.ts.orig 2023-12-04 18:19:02 UTC
++++ electron/lib/browser/api/dialog.ts
+@@ -40,7 +40,7 @@ const normalizeAccessKey = (text: string) => {
+ // existing single underscores with a second underscore, replace double
+ // ampersands with a single ampersand, and replace a single ampersand with
+ // a single underscore
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd') {
+ return text.replaceAll('_', '__').replaceAll(/&(.?)/g, (match, after) => {
+ if (after === '&') return after;
+ return `_${after}`;
diff --git a/devel/electron31/files/patch-electron_lib_browser_api_menu-item-roles.ts b/devel/electron31/files/patch-electron_lib_browser_api_menu-item-roles.ts
new file mode 100644
index 000000000000..e89259c7e505
--- /dev/null
+++ b/devel/electron31/files/patch-electron_lib_browser_api_menu-item-roles.ts
@@ -0,0 +1,11 @@
+--- electron/lib/browser/api/menu-item-roles.ts.orig 2022-05-18 15:31:32 UTC
++++ electron/lib/browser/api/menu-item-roles.ts
+@@ -2,7 +2,7 @@ import { app, BrowserWindow, session, webContents, Web
+
+ const isMac = process.platform === 'darwin';
+ const isWindows = process.platform === 'win32';
+-const isLinux = process.platform === 'linux';
++const isLinux = (process.platform === 'linux' || process.platform === 'freebsd');
+
+ type RoleId = 'about' | 'close' | 'copy' | 'cut' | 'delete' | 'forcereload' | 'front' | 'help' | 'hide' | 'hideothers' | 'minimize' |
+ 'paste' | 'pasteandmatchstyle' | 'quit' | 'redo' | 'reload' | 'resetzoom' | 'selectall' | 'services' | 'recentdocuments' | 'clearrecentdocuments' |
diff --git a/devel/electron31/files/patch-electron_lib_browser_api_power-monitor.ts b/devel/electron31/files/patch-electron_lib_browser_api_power-monitor.ts
new file mode 100644
index 000000000000..24713c283fe7
--- /dev/null
+++ b/devel/electron31/files/patch-electron_lib_browser_api_power-monitor.ts
@@ -0,0 +1,11 @@
+--- electron/lib/browser/api/power-monitor.ts.orig 2023-08-14 18:19:06 UTC
++++ electron/lib/browser/api/power-monitor.ts
+@@ -17,7 +17,7 @@ class PowerMonitor extends EventEmitter {
+ const pm = createPowerMonitor();
+ pm.emit = this.emit.bind(this);
+
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd') {
+ // On Linux, we inhibit shutdown in order to give the app a chance to
+ // decide whether or not it wants to prevent the shutdown. We don't
+ // inhibit the shutdown event unless there's a listener for it. This
diff --git a/devel/electron31/files/patch-electron_lib_browser_init.ts b/devel/electron31/files/patch-electron_lib_browser_init.ts
new file mode 100644
index 000000000000..d93e40087b1d
--- /dev/null
+++ b/devel/electron31/files/patch-electron_lib_browser_init.ts
@@ -0,0 +1,11 @@
+--- electron/lib/browser/init.ts.orig 2024-04-16 14:29:17 UTC
++++ electron/lib/browser/init.ts
+@@ -161,7 +161,7 @@ function currentPlatformSupportsAppIndicator () {
+ const KNOWN_XDG_DESKTOP_VALUES = new Set(['Pantheon', 'Unity:Unity7', 'pop:GNOME']);
+
+ function currentPlatformSupportsAppIndicator () {
+- if (process.platform !== 'linux') return false;
++ if (process.platform !== 'linux' && process.platform !== 'freebsd') return false;
+ const currentDesktop = process.env.XDG_CURRENT_DESKTOP;
+
+ if (!currentDesktop) return false;
diff --git a/devel/electron31/files/patch-electron_lib_browser_rpc-server.ts b/devel/electron31/files/patch-electron_lib_browser_rpc-server.ts
new file mode 100644
index 000000000000..2e2fca45dfa6
--- /dev/null
+++ b/devel/electron31/files/patch-electron_lib_browser_rpc-server.ts
@@ -0,0 +1,11 @@
+--- electron/lib/browser/rpc-server.ts.orig 2022-05-11 15:32:29 UTC
++++ electron/lib/browser/rpc-server.ts
+@@ -26,7 +26,7 @@ const allowedClipboardMethods = (() => {
+ switch (process.platform) {
+ case 'darwin':
+ return new Set(['readFindText', 'writeFindText']);
+- case 'linux':
++ case 'linux': case 'freebsd':
+ return new Set(Object.keys(clipboard));
+ default:
+ return new Set();
diff --git a/devel/electron31/files/patch-electron_lib_renderer_api_clipboard.ts b/devel/electron31/files/patch-electron_lib_renderer_api_clipboard.ts
new file mode 100644
index 000000000000..5941a466e994
--- /dev/null
+++ b/devel/electron31/files/patch-electron_lib_renderer_api_clipboard.ts
@@ -0,0 +1,11 @@
+--- electron/lib/renderer/api/clipboard.ts.orig 2023-08-14 18:19:06 UTC
++++ electron/lib/renderer/api/clipboard.ts
+@@ -7,7 +7,7 @@ const makeRemoteMethod = function (method: keyof Elect
+ return (...args: any[]) => ipcRendererUtils.invokeSync(IPC_MESSAGES.BROWSER_CLIPBOARD_SYNC, method, ...args);
+ };
+
+-if (process.platform === 'linux') {
++if (process.platform === 'linux' || process.platform === 'freebsd') {
+ // On Linux we could not access clipboard in renderer process.
+ for (const method of Object.keys(clipboard) as (keyof Electron.Clipboard)[]) {
+ clipboard[method] = makeRemoteMethod(method);
diff --git a/devel/electron31/files/patch-electron_script_lib_config.py b/devel/electron31/files/patch-electron_script_lib_config.py
new file mode 100644
index 000000000000..4915ef347e14
--- /dev/null
+++ b/devel/electron31/files/patch-electron_script_lib_config.py
@@ -0,0 +1,12 @@
+--- electron/script/lib/config.py.orig 2024-05-29 09:41:07 UTC
++++ electron/script/lib/config.py
+@@ -7,6 +7,9 @@ PLATFORM = {
+ 'cygwin': 'win32',
+ 'msys': 'win32',
+ 'darwin': 'darwin',
++ 'freebsd13': 'freebsd',
++ 'freebsd14': 'freebsd',
++ 'freebsd15': 'freebsd',
+ 'linux': 'linux',
+ 'linux2': 'linux',
+ 'win32': 'win32',
diff --git a/devel/electron31/files/patch-electron_script_lib_utils.js b/devel/electron31/files/patch-electron_script_lib_utils.js
new file mode 100644
index 000000000000..cefe6c3e9422
--- /dev/null
+++ b/devel/electron31/files/patch-electron_script_lib_utils.js
@@ -0,0 +1,11 @@
+--- electron/script/lib/utils.js.orig 2024-07-15 15:22:56 UTC
++++ electron/script/lib/utils.js
+@@ -18,7 +18,7 @@ function getElectronExec () {
+ return `out/${OUT_DIR}/Electron.app/Contents/MacOS/Electron`;
+ case 'win32':
+ return `out/${OUT_DIR}/electron.exe`;
+- case 'linux':
++ case 'linux': case 'freebsd':
+ return `out/${OUT_DIR}/electron`;
+ default:
+ throw new Error('Unknown platform');
diff --git a/devel/electron31/files/patch-electron_script_spec-runner.js b/devel/electron31/files/patch-electron_script_spec-runner.js
new file mode 100644
index 000000000000..52b0a481e161
--- /dev/null
+++ b/devel/electron31/files/patch-electron_script_spec-runner.js
@@ -0,0 +1,11 @@
+--- electron/script/spec-runner.js.orig 2024-02-21 16:26:48 UTC
++++ electron/script/spec-runner.js
+@@ -161,7 +161,7 @@ async function runTestUsingElectron (specDir, testName
+ exe = path.resolve(BASE, utils.getElectronExec());
+ }
+ const runnerArgs = [`electron/${specDir}`, ...unknownArgs.slice(2)];
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd') {
+ runnerArgs.unshift(path.resolve(__dirname, 'dbus_mock.py'), exe);
+ exe = 'python3';
+ }
diff --git a/devel/electron31/files/patch-electron_shell_app_electron__crash__reporter__client.cc b/devel/electron31/files/patch-electron_shell_app_electron__crash__reporter__client.cc
new file mode 100644
index 000000000000..2dcbd76fe2d8
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_app_electron__crash__reporter__client.cc
@@ -0,0 +1,20 @@
+--- electron/shell/app/electron_crash_reporter_client.cc.orig 2024-06-24 09:53:23 UTC
++++ electron/shell/app/electron_crash_reporter_client.cc
+@@ -95,7 +95,7 @@ ElectronCrashReporterClient::~ElectronCrashReporterCli
+
+ ElectronCrashReporterClient::~ElectronCrashReporterClient() = default;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void ElectronCrashReporterClient::SetCrashReporterClientIdFromGUID(
+ const std::string& client_guid) {
+ crash_keys::SetMetricsClientIdFromGUID(client_guid);
+@@ -196,7 +196,7 @@ void ElectronCrashReporterClient::GetProcessSimpleAnno
+ (*annotations)["ver"] = ELECTRON_VERSION_STRING;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ bool ElectronCrashReporterClient::ShouldMonitorCrashHandlerExpensively() {
+ return false;
+ }
diff --git a/devel/electron31/files/patch-electron_shell_app_electron__crash__reporter__client.h b/devel/electron31/files/patch-electron_shell_app_electron__crash__reporter__client.h
new file mode 100644
index 000000000000..b2d30d9936cd
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_app_electron__crash__reporter__client.h
@@ -0,0 +1,20 @@
+--- electron/shell/app/electron_crash_reporter_client.h.orig 2024-06-24 09:53:23 UTC
++++ electron/shell/app/electron_crash_reporter_client.h
+@@ -31,7 +31,7 @@ class ElectronCrashReporterClient : public crash_repor
+ const std::map<std::string, std::string>& annotations);
+
+ // crash_reporter::CrashReporterClient implementation.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SetCrashReporterClientIdFromGUID(
+ const std::string& client_guid) override;
+ void GetProductNameAndVersion(const char** product_name,
+@@ -70,7 +70,7 @@ class ElectronCrashReporterClient : public crash_repor
+ bool ReportingIsEnforcedByPolicy(bool* breakpad_enabled) override;
+ #endif
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool ShouldMonitorCrashHandlerExpensively() override;
+ #endif
+
diff --git a/devel/electron31/files/patch-electron_shell_app_electron__main__delegate.cc b/devel/electron31/files/patch-electron_shell_app_electron__main__delegate.cc
new file mode 100644
index 000000000000..f078734cac0f
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_app_electron__main__delegate.cc
@@ -0,0 +1,54 @@
+--- electron/shell/app/electron_main_delegate.cc.orig 2024-06-24 09:53:23 UTC
++++ electron/shell/app/electron_main_delegate.cc
+@@ -59,13 +59,13 @@
+ #include "chrome/child/v8_crashpad_support_win.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/nix/xdg_util.h"
+ #include "v8/include/v8-wasm-trap-handler-posix.h"
+ #include "v8/include/v8.h"
+ #endif
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ #include "components/crash/core/app/crash_switches.h" // nogncheck
+ #include "components/crash/core/app/crashpad.h" // nogncheck
+ #include "components/crash/core/common/crash_key.h"
+@@ -157,7 +157,7 @@ bool ElectronPathProvider(int key, base::FilePath* res
+ create_dir = true;
+ break;
+ }
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ case DIR_APP_DATA: {
+ auto env = base::Environment::Create();
+ cur = base::nix::GetXDGDirectory(
+@@ -289,7 +289,7 @@ std::optional<int> ElectronMainDelegate::BasicStartupC
+ base::win::PinUser32();
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Check for --no-sandbox parameter when running as root.
+ if (getuid() == 0 && IsSandboxEnabled(command_line))
+ LOG(FATAL) << "Running as root without --"
+@@ -339,7 +339,7 @@ void ElectronMainDelegate::PreSandboxStartup() {
+ /* is_preinit = */ IsBrowserProcess() || IsZygoteProcess());
+ #endif
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ crash_reporter::InitializeCrashKeys();
+ #endif
+
+@@ -374,7 +374,7 @@ void ElectronMainDelegate::PreSandboxStartup() {
+ }
+ #endif
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ crash_keys::SetCrashKeysFromCommandLine(*command_line);
+ crash_keys::SetPlatformCrashKey();
+ #endif
diff --git a/devel/electron31/files/patch-electron_shell_app_node__main.cc b/devel/electron31/files/patch-electron_shell_app_node__main.cc
new file mode 100644
index 000000000000..887eeee21238
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_app_node__main.cc
@@ -0,0 +1,38 @@
+--- electron/shell/app/node_main.cc.orig 2024-04-16 14:29:17 UTC
++++ electron/shell/app/node_main.cc
+@@ -48,7 +48,7 @@
+ #include "shell/common/mac/codesign_util.h"
+ #endif
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ #include "components/crash/core/app/crashpad.h" // nogncheck
+ #include "shell/app/electron_crash_reporter_client.h"
+ #include "shell/common/crash_keys.h"
+@@ -99,7 +99,7 @@ bool UnsetHijackableEnvs(base::Environment* env) {
+ }
+ #endif
+
+-#if IS_MAS_BUILD()
++#if IS_MAS_BUILD() || BUILDFLAG(IS_BSD)
+ void SetCrashKeyStub(const std::string& key, const std::string& value) {}
+ void ClearCrashKeyStub(const std::string& key) {}
+ #endif
+@@ -110,7 +110,7 @@ v8::Local<v8::Value> GetParameters(v8::Isolate* isolat
+
+ v8::Local<v8::Value> GetParameters(v8::Isolate* isolate) {
+ std::map<std::string, std::string> keys;
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ electron::crash_keys::GetCrashKeys(&keys);
+ #endif
+ return gin::ConvertToV8(isolate, keys);
+@@ -271,7 +271,7 @@ int NodeMain(int argc, char* argv[]) {
+ // Setup process.crashReporter in child node processes
+ auto reporter = gin_helper::Dictionary::CreateEmpty(isolate);
+ reporter.SetMethod("getParameters", &GetParameters);
+-#if IS_MAS_BUILD()
++#if IS_MAS_BUILD() || BUILDFLAG(IS_BSD)
+ reporter.SetMethod("addExtraParameter", &SetCrashKeyStub);
+ reporter.SetMethod("removeExtraParameter", &ClearCrashKeyStub);
+ #else
diff --git a/devel/electron31/files/patch-electron_shell_browser_api_electron__api__app.cc b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__app.cc
new file mode 100644
index 000000000000..6dbc74d6c9f6
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__app.cc
@@ -0,0 +1,47 @@
+--- electron/shell/browser/api/electron_api_app.cc.orig 2024-06-24 09:53:23 UTC
++++ electron/shell/browser/api/electron_api_app.cc
+@@ -591,7 +591,7 @@ void App::OnFinishLaunching(base::Value::Dict launch_i
+ }
+
+ void App::OnFinishLaunching(base::Value::Dict launch_info) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Set the application name for audio streams shown in external
+ // applications. Only affects pulseaudio currently.
+ media::AudioManager::SetGlobalAppName(Browser::Get()->GetName());
+@@ -916,7 +916,7 @@ void App::SetDesktopName(const std::string& desktop_na
+ }
+
+ void App::SetDesktopName(const std::string& desktop_name) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto env = base::Environment::Create();
+ env->SetVar("CHROME_DESKTOP", desktop_name);
+ #endif
+@@ -1300,7 +1300,7 @@ std::vector<gin_helper::Dictionary> App::GetAppMetrics
+ pid_dict.Set("name", process_metric.second->name);
+ }
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ auto memory_info = process_metric.second->GetMemoryInfo();
+
+ auto memory_dict = gin_helper::Dictionary::CreateEmpty(isolate);
+@@ -1683,7 +1683,7 @@ gin::ObjectTemplateBuilder App::GetObjectTemplateBuild
+ .SetMethod(
+ "removeAsDefaultProtocolClient",
+ base::BindRepeating(&Browser::RemoveAsDefaultProtocolClient, browser))
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ .SetMethod(
+ "getApplicationInfoForProtocol",
+ base::BindRepeating(&Browser::GetApplicationInfoForProtocol, browser))
+@@ -1741,7 +1741,7 @@ gin::ObjectTemplateBuilder App::GetObjectTemplateBuild
+ .SetMethod("getJumpListSettings", &App::GetJumpListSettings)
+ .SetMethod("setJumpList", &App::SetJumpList)
+ #endif
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ .SetMethod("isUnityRunning",
+ base::BindRepeating(&Browser::IsUnityRunning, browser))
+ #endif
diff --git a/devel/electron31/files/patch-electron_shell_browser_api_electron__api__base__window.cc b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__base__window.cc
new file mode 100644
index 000000000000..32005cf74a2b
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__base__window.cc
@@ -0,0 +1,38 @@
+--- electron/shell/browser/api/electron_api_base_window.cc.orig 2024-07-15 15:22:56 UTC
++++ electron/shell/browser/api/electron_api_base_window.cc
+@@ -40,7 +40,7 @@
+ #include "shell/browser/ui/views/win_frame_view.h"
+ #include "shell/browser/ui/win/taskbar_host.h"
+ #include "ui/base/win/shell.h"
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "shell/browser/ui/views/opaque_frame_view.h"
+ #endif
+
+@@ -988,7 +988,7 @@ void BaseWindow::SetIconImpl(v8::Isolate* isolate,
+ static_cast<NativeWindowViews*>(window_.get())
+ ->SetIcon(native_image->GetHICON(GetSystemMetrics(SM_CXSMICON)),
+ native_image->GetHICON(GetSystemMetrics(SM_CXICON)));
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ static_cast<NativeWindowViews*>(window_.get())
+ ->SetIcon(native_image->image().AsImageSkia());
+ #endif
+@@ -1045,7 +1045,7 @@ void BaseWindow::SetAppDetails(const gin_helper::Dicti
+ }
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void BaseWindow::SetTitleBarOverlay(const gin_helper::Dictionary& options,
+ gin_helper::Arguments* args) {
+ // Ensure WCO is already enabled on this window
+@@ -1296,7 +1296,7 @@ void BaseWindow::BuildPrototype(v8::Isolate* isolate,
+ .SetMethod("setThumbnailToolTip", &BaseWindow::SetThumbnailToolTip)
+ .SetMethod("setAppDetails", &BaseWindow::SetAppDetails)
+ #endif
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ .SetMethod("setTitleBarOverlay", &BaseWindow::SetTitleBarOverlay)
+ #endif
+ .SetProperty("id", &BaseWindow::GetID);
diff --git a/devel/electron31/files/patch-electron_shell_browser_api_electron__api__base__window.h b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__base__window.h
new file mode 100644
index 000000000000..83af79c40ce2
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__base__window.h
@@ -0,0 +1,11 @@
+--- electron/shell/browser/api/electron_api_base_window.h.orig 2024-07-17 06:27:32 UTC
++++ electron/shell/browser/api/electron_api_base_window.h
+@@ -243,7 +243,7 @@ class BaseWindow : public gin_helper::TrackableObject<
+ void SetAppDetails(const gin_helper::Dictionary& options);
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SetTitleBarOverlay(const gin_helper::Dictionary& options,
+ gin_helper::Arguments* args);
+ #endif
diff --git a/devel/electron31/files/patch-electron_shell_browser_api_electron__api__crash__reporter.cc b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__crash__reporter.cc
new file mode 100644
index 000000000000..f229a1bde031
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__crash__reporter.cc
@@ -0,0 +1,72 @@
+--- electron/shell/browser/api/electron_api_crash_reporter.cc.orig 2023-06-07 10:09:25 UTC
++++ electron/shell/browser/api/electron_api_crash_reporter.cc
+@@ -31,7 +31,7 @@
+ #include "shell/common/process_util.h"
+ #include "shell/common/thread_restrictions.h"
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ #include "components/crash/core/app/crashpad.h" // nogncheck
+ #include "components/crash/core/browser/crash_upload_list_crashpad.h" // nogncheck
+ #include "components/crash/core/common/crash_key.h"
+@@ -66,7 +66,7 @@ bool g_crash_reporter_initialized = false;
+
+ namespace electron::api::crash_reporter {
+
+-#if IS_MAS_BUILD()
++#if IS_MAS_BUILD() || BUILDFLAG(IS_BSD)
+ namespace {
+
+ void NoOp() {}
+@@ -133,7 +133,7 @@ void Start(const std::string& submit_url,
+ const std::map<std::string, std::string>& extra,
+ bool is_node_process) {
+ TRACE_EVENT0("electron", "crash_reporter::Start");
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ if (g_crash_reporter_initialized)
+ return;
+ g_crash_reporter_initialized = true;
+@@ -179,7 +179,7 @@ void Start(const std::string& submit_url,
+
+ namespace {
+
+-#if IS_MAS_BUILD()
++#if IS_MAS_BUILD() || BUILDFLAG(IS_BSD)
+ void GetUploadedReports(
+ v8::Isolate* isolate,
+ base::OnceCallback<void(v8::Local<v8::Value>)> callback) {
+@@ -235,13 +235,13 @@ v8::Local<v8::Value> GetUploadedReports(v8::Isolate* i
+ #endif
+
+ void SetUploadToServer(bool upload) {
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ ElectronCrashReporterClient::Get()->SetCollectStatsConsent(upload);
+ #endif
+ }
+
+ bool GetUploadToServer() {
+-#if IS_MAS_BUILD()
++#if IS_MAS_BUILD() || BUILDFLAG(IS_BSD)
+ return false;
+ #else
+ return ElectronCrashReporterClient::Get()->GetCollectStatsConsent();
+@@ -250,7 +250,7 @@ bool GetUploadToServer() {
+
+ v8::Local<v8::Value> GetParameters(v8::Isolate* isolate) {
+ std::map<std::string, std::string> keys;
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ electron::crash_keys::GetCrashKeys(&keys);
+ #endif
+ return gin::ConvertToV8(isolate, keys);
+@@ -262,7 +262,7 @@ void Initialize(v8::Local<v8::Object> exports,
+ void* priv) {
+ gin_helper::Dictionary dict(context->GetIsolate(), exports);
+ dict.SetMethod("start", &electron::api::crash_reporter::Start);
+-#if IS_MAS_BUILD()
++#if IS_MAS_BUILD() || BUILDFLAG(IS_BSD)
+ dict.SetMethod("addExtraParameter", &electron::api::crash_reporter::NoOp);
+ dict.SetMethod("removeExtraParameter", &electron::api::crash_reporter::NoOp);
+ #else
diff --git a/devel/electron31/files/patch-electron_shell_browser_api_electron__api__desktop__capturer.cc b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__desktop__capturer.cc
new file mode 100644
index 000000000000..b278676a040f
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__desktop__capturer.cc
@@ -0,0 +1,11 @@
+--- electron/shell/browser/api/electron_api_desktop_capturer.cc.orig 2024-04-16 14:29:17 UTC
++++ electron/shell/browser/api/electron_api_desktop_capturer.cc
+@@ -41,7 +41,7 @@
+ #include "ui/gfx/x/randr.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Private function in ui/base/x/x11_display_util.cc
+ base::flat_map<x11::RandR::Output, int> GetMonitors(
+ std::pair<uint32_t, uint32_t> version,
diff --git a/devel/electron31/files/patch-electron_shell_browser_api_electron__api__power__monitor.cc b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__power__monitor.cc
new file mode 100644
index 000000000000..accdebd37eaf
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__power__monitor.cc
@@ -0,0 +1,23 @@
+--- electron/shell/browser/api/electron_api_power_monitor.cc.orig 2023-08-14 18:19:06 UTC
++++ electron/shell/browser/api/electron_api_power_monitor.cc
+@@ -118,6 +118,11 @@ void PowerMonitor::OnSpeedLimitChange(int speed_limit)
+ gin::DataObjectBuilder(isolate).Set("limit", speed_limit).Build());
+ }
+
++#if BUILDFLAG(IS_BSD)
++void PowerMonitor::SetListeningForShutdown(bool is_listening) {
++}
++#endif
++
+ #if BUILDFLAG(IS_LINUX)
+ void PowerMonitor::SetListeningForShutdown(bool is_listening) {
+ if (is_listening) {
+@@ -143,7 +148,7 @@ gin::ObjectTemplateBuilder PowerMonitor::GetObjectTemp
+ auto builder =
+ gin_helper::EventEmitterMixin<PowerMonitor>::GetObjectTemplateBuilder(
+ isolate);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ builder.SetMethod("setListeningForShutdown",
+ &PowerMonitor::SetListeningForShutdown);
+ #endif
diff --git a/devel/electron31/files/patch-electron_shell_browser_api_electron__api__power__monitor.h b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__power__monitor.h
new file mode 100644
index 000000000000..7aa5993e972e
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__power__monitor.h
@@ -0,0 +1,11 @@
+--- electron/shell/browser/api/electron_api_power_monitor.h.orig 2023-05-03 13:27:52 UTC
++++ electron/shell/browser/api/electron_api_power_monitor.h
+@@ -40,7 +40,7 @@ class PowerMonitor : public gin::Wrappable<PowerMonito
+ explicit PowerMonitor(v8::Isolate* isolate);
+ ~PowerMonitor() override;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SetListeningForShutdown(bool);
+ #endif
+
diff --git a/devel/electron31/files/patch-electron_shell_browser_api_electron__api__safe__storage.cc b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__safe__storage.cc
new file mode 100644
index 000000000000..b9302ba7f004
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__safe__storage.cc
@@ -0,0 +1,29 @@
+--- electron/shell/browser/api/electron_api_safe_storage.cc.orig 2023-08-14 18:19:06 UTC
++++ electron/shell/browser/api/electron_api_safe_storage.cc
+@@ -22,7 +22,7 @@ static const char* kEncryptionVersionPrefixV11 = "v11"
+ static bool use_password_v10 = false;
+
+ bool IsEncryptionAvailable() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Calling IsEncryptionAvailable() before the app is ready results in a crash
+ // on Linux.
+ // Refs: https://github.com/electron/electron/issues/32206.
+@@ -41,7 +41,7 @@ void SetUsePasswordV10(bool use) {
+ use_password_v10 = use;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::string GetSelectedLinuxBackend() {
+ if (!Browser::Get()->is_ready())
+ return "unknown";
+@@ -142,7 +142,7 @@ void Initialize(v8::Local<v8::Object> exports,
+ dict.SetMethod("decryptString", &electron::safestorage::DecryptString);
+ dict.SetMethod("setUsePlainTextEncryption",
+ &electron::safestorage::SetUsePasswordV10);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ dict.SetMethod("getSelectedStorageBackend",
+ &electron::safestorage::GetSelectedLinuxBackend);
+ #endif
diff --git a/devel/electron31/files/patch-electron_shell_browser_api_electron__api__web__contents.cc b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__web__contents.cc
new file mode 100644
index 000000000000..f95f38f0dfb0
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__web__contents.cc
@@ -0,0 +1,61 @@
+--- electron/shell/browser/api/electron_api_web_contents.cc.orig 2024-06-24 09:53:23 UTC
++++ electron/shell/browser/api/electron_api_web_contents.cc
+@@ -153,11 +153,11 @@
+ #include "ui/base/cocoa/defaults_utils.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "ui/gfx/font_render_params.h"
+ #endif
+
+@@ -517,7 +517,7 @@ std::optional<base::TimeDelta> GetCursorBlinkInterval(
+ ui::TextInsertionCaretBlinkPeriodFromDefaults());
+ if (system_value)
+ return *system_value;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (auto* linux_ui = ui::LinuxUi::instance())
+ return linux_ui->GetCursorBlinkInterval();
+ #elif BUILDFLAG(IS_WIN)
+@@ -881,7 +881,7 @@ void WebContents::InitWithSessionAndOptions(
+ accept_languages.pop_back();
+ prefs->accept_languages = accept_languages;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Update font settings.
+ static const gfx::FontRenderParams params(
+ gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(), nullptr));
+@@ -2618,7 +2618,7 @@ void WebContents::ForcefullyCrashRenderer() {
+
+ content::RenderProcessHost* rph = rwh->GetProcess();
+ if (rph) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // A generic |CrashDumpHungChildProcess()| is not implemented for Linux.
+ // Instead we send an explicit IPC to crash on the renderer's IO thread.
+ rph->ForceCrash();
+@@ -3300,7 +3300,7 @@ void WebContents::Focus() {
+ void WebContents::Focus() {
+ // Focusing on WebContents does not automatically focus the window on macOS
+ // and Linux, do it manually to match the behavior on Windows.
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (owner_window())
+ owner_window()->Focus(true);
+ #endif
+@@ -4148,7 +4148,7 @@ ui::ImageModel WebContents::GetDevToolsWindowIcon() {
+ }
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void WebContents::GetDevToolsWindowWMClass(std::string* name,
+ std::string* class_name) {
+ *class_name = Browser::Get()->GetName();
diff --git a/devel/electron31/files/patch-electron_shell_browser_api_electron__api__web__contents.h b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__web__contents.h
new file mode 100644
index 000000000000..e168c2a1099c
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_api_electron__api__web__contents.h
@@ -0,0 +1,11 @@
+--- electron/shell/browser/api/electron_api_web_contents.h.orig 2024-06-24 09:53:23 UTC
++++ electron/shell/browser/api/electron_api_web_contents.h
+@@ -762,7 +762,7 @@ class WebContents : public ExclusiveAccessContext,
+ #if defined(TOOLKIT_VIEWS) && !BUILDFLAG(IS_MAC)
+ ui::ImageModel GetDevToolsWindowIcon() override;
+ #endif
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void GetDevToolsWindowWMClass(std::string* name,
+ std::string* class_name) override;
+ #endif
diff --git a/devel/electron31/files/patch-electron_shell_browser_api_process__metric.h b/devel/electron31/files/patch-electron_shell_browser_api_process__metric.h
new file mode 100644
index 000000000000..d6ff67a703bf
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_api_process__metric.h
@@ -0,0 +1,20 @@
+--- electron/shell/browser/api/process_metric.h.orig 2022-05-18 15:31:32 UTC
++++ electron/shell/browser/api/process_metric.h
+@@ -14,7 +14,7 @@
+
+ namespace electron {
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ struct ProcessMemoryInfo {
+ size_t working_set_size = 0;
+ size_t peak_working_set_size = 0;
+@@ -48,7 +48,7 @@ struct ProcessMetric {
+ const std::string& name = std::string());
+ ~ProcessMetric();
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ ProcessMemoryInfo GetMemoryInfo() const;
+ #endif
+
diff --git a/devel/electron31/files/patch-electron_shell_browser_browser.cc b/devel/electron31/files/patch-electron_shell_browser_browser.cc
new file mode 100644
index 000000000000..239fb301a610
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_browser.cc
@@ -0,0 +1,11 @@
+--- electron/shell/browser/browser.cc.orig 2024-04-16 14:29:17 UTC
++++ electron/shell/browser/browser.cc
+@@ -66,7 +66,7 @@ Browser* Browser::Get() {
+ return ElectronBrowserMainParts::Get()->browser();
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void Browser::Focus(gin::Arguments* args) {
+ // Focus on the first visible window.
+ for (auto* const window : WindowList::GetWindows()) {
diff --git a/devel/electron31/files/patch-electron_shell_browser_browser.h b/devel/electron31/files/patch-electron_shell_browser_browser.h
new file mode 100644
index 000000000000..36529c18419e
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_browser.h
@@ -0,0 +1,24 @@
+--- electron/shell/browser/browser.h.orig 2024-06-12 10:49:40 UTC
++++ electron/shell/browser/browser.h
+@@ -145,7 +145,7 @@ class Browser : public WindowListObserver {
+
+ std::u16string GetApplicationNameForProtocol(const GURL& url);
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ // get the name, icon and path for an application
+ v8::Local<v8::Promise> GetApplicationInfoForProtocol(v8::Isolate* isolate,
+ const GURL& url);
+@@ -273,10 +273,10 @@ class Browser : public WindowListObserver {
+ PCWSTR GetAppUserModelID();
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Whether Unity launcher is running.
+ bool IsUnityRunning();
+-#endif // BUILDFLAG(IS_LINUX)
++#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ // Tell the application to open a file.
+ bool OpenFile(const std::string& file_path);
diff --git a/devel/electron31/files/patch-electron_shell_browser_browser__linux.cc b/devel/electron31/files/patch-electron_shell_browser_browser__linux.cc
new file mode 100644
index 000000000000..4c9593dbf7f5
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_browser__linux.cc
@@ -0,0 +1,11 @@
+--- electron/shell/browser/browser_linux.cc.orig 2024-04-16 14:29:17 UTC
++++ electron/shell/browser/browser_linux.cc
+@@ -18,7 +18,7 @@
+ #include "shell/common/gin_converters/login_item_settings_converter.h"
+ #include "shell/common/thread_restrictions.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "shell/browser/linux/unity_service.h"
+ #include "ui/gtk/gtk_util.h" // nogncheck
+ #endif
diff --git a/devel/electron31/files/patch-electron_shell_browser_browser__process__impl.cc b/devel/electron31/files/patch-electron_shell_browser_browser__process__impl.cc
new file mode 100644
index 000000000000..005928550954
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_browser__process__impl.cc
@@ -0,0 +1,20 @@
+--- electron/shell/browser/browser_process_impl.cc.orig 2024-06-24 09:53:23 UTC
++++ electron/shell/browser/browser_process_impl.cc
+@@ -334,7 +334,7 @@ electron::ResolveProxyHelper* BrowserProcessImpl::GetR
+ return resolve_proxy_helper_.get();
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void BrowserProcessImpl::SetLinuxStorageBackend(
+ os_crypt::SelectedLinuxBackend selected_backend) {
+ switch (selected_backend) {
+@@ -358,7 +358,7 @@ void BrowserProcessImpl::SetLinuxStorageBackend(
+ break;
+ }
+ }
+-#endif // BUILDFLAG(IS_LINUX)
++#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ void BrowserProcessImpl::SetApplicationLocale(const std::string& locale) {
+ locale_ = locale;
diff --git a/devel/electron31/files/patch-electron_shell_browser_browser__process__impl.h b/devel/electron31/files/patch-electron_shell_browser_browser__process__impl.h
new file mode 100644
index 000000000000..c07d6fdb57cf
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_browser__process__impl.h
@@ -0,0 +1,29 @@
+--- electron/shell/browser/browser_process_impl.h.orig 2024-06-24 09:53:23 UTC
++++ electron/shell/browser/browser_process_impl.h
+@@ -23,7 +23,7 @@
+ #include "services/network/public/cpp/shared_url_loader_factory.h"
+ #include "shell/browser/net/system_network_context_manager.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "components/os_crypt/sync/key_storage_util_linux.h"
+ #endif
+
+@@ -61,7 +61,7 @@ class BrowserProcessImpl : public BrowserProcess {
+ const std::string& GetSystemLocale() const;
+ electron::ResolveProxyHelper* GetResolveProxyHelper();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SetLinuxStorageBackend(os_crypt::SelectedLinuxBackend selected_backend);
+ [[nodiscard]] const std::string& linux_storage_backend() const {
+ return selected_linux_storage_backend_;
+@@ -147,7 +147,7 @@ class BrowserProcessImpl : public BrowserProcess {
+ std::unique_ptr<PrefService> local_state_;
+ std::string locale_;
+ std::string system_locale_;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::string selected_linux_storage_backend_;
+ #endif
+ embedder_support::OriginTrialsSettingsStorage origin_trials_settings_storage_;
diff --git a/devel/electron31/files/patch-electron_shell_browser_electron__browser__main__parts.cc b/devel/electron31/files/patch-electron_shell_browser_electron__browser__main__parts.cc
new file mode 100644
index 000000000000..39ce152d7a3c
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_electron__browser__main__parts.cc
@@ -0,0 +1,84 @@
+--- electron/shell/browser/electron_browser_main_parts.cc.orig 2024-07-15 15:22:56 UTC
++++ electron/shell/browser/electron_browser_main_parts.cc
+@@ -78,7 +78,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"
+@@ -131,7 +131,7 @@ namespace {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ class LinuxUiGetterImpl : public ui::LinuxUiGetter {
+ public:
+ LinuxUiGetterImpl() = default;
+@@ -214,7 +214,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
+@@ -304,7 +304,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
+@@ -335,7 +335,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)
+@@ -395,7 +395,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<LinuxUiGetterImpl>();
+@@ -501,7 +501,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)
+@@ -513,7 +513,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.
+@@ -613,7 +615,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
+ }
diff --git a/devel/electron31/files/patch-electron_shell_browser_electron__browser__main__parts.h b/devel/electron31/files/patch-electron_shell_browser_electron__browser__main__parts.h
new file mode 100644
index 000000000000..c9596387818f
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_electron__browser__main__parts.h
@@ -0,0 +1,20 @@
+--- electron/shell/browser/electron_browser_main_parts.h.orig 2023-10-20 08:29:17 UTC
++++ electron/shell/browser/electron_browser_main_parts.h
+@@ -119,7 +119,7 @@ class ElectronBrowserMainParts : public content::Brows
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void DetectOzonePlatform();
+ #endif
+
+@@ -141,7 +141,7 @@ class ElectronBrowserMainParts : public content::Brows
+ std::unique_ptr<display::Screen> screen_;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<ui::DarkModeManagerLinux> dark_mode_manager_;
+ std::unique_ptr<ui::LinuxUiGetter> linux_ui_getter_;
+ #endif
diff --git a/devel/electron31/files/patch-electron_shell_browser_electron__browser__main__parts__posix.cc b/devel/electron31/files/patch-electron_shell_browser_electron__browser__main__parts__posix.cc
new file mode 100644
index 000000000000..37f52e6f9b94
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_electron__browser__main__parts__posix.cc
@@ -0,0 +1,19 @@
+--- electron/shell/browser/electron_browser_main_parts_posix.cc.orig 2022-08-03 15:31:32 UTC
++++ electron/shell/browser/electron_browser_main_parts_posix.cc
+@@ -198,12 +198,16 @@ void ElectronBrowserMainParts::InstallShutdownSignalHa
+ g_pipe_pid = getpid();
+ g_shutdown_pipe_read_fd = pipefd[0];
+ g_shutdown_pipe_write_fd = pipefd[1];
++#if defined(OS_BSD)
++ const size_t kShutdownDetectorThreadStackSize = 0;
++#else
+ #if !defined(ADDRESS_SANITIZER)
+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2;
+ #else
+ // ASan instrumentation bloats the stack frames, so we need to increase the
+ // stack size to avoid hitting the guard page.
+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4;
++#endif
+ #endif
+ ShutdownDetector* detector = new ShutdownDetector(
+ g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner);
diff --git a/devel/electron31/files/patch-electron_shell_browser_extensions_api_runtime_electron__runtime__api__delegate.cc b/devel/electron31/files/patch-electron_shell_browser_extensions_api_runtime_electron__runtime__api__delegate.cc
new file mode 100644
index 000000000000..91481f5ae73c
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_extensions_api_runtime_electron__runtime__api__delegate.cc
@@ -0,0 +1,11 @@
+--- electron/shell/browser/extensions/api/runtime/electron_runtime_api_delegate.cc.orig 2023-08-09 14:05:20 UTC
++++ electron/shell/browser/extensions/api/runtime/electron_runtime_api_delegate.cc
+@@ -55,6 +55,8 @@ bool ElectronRuntimeAPIDelegate::GetPlatformInfo(Platf
+ info->os = extensions::api::runtime::PlatformOs::kLinux;
+ } else if (strcmp(os, "openbsd") == 0) {
+ info->os = extensions::api::runtime::PlatformOs::kOpenbsd;
++ } else if (strcmp(os, "freebsd") == 0) {
++ info->os = extensions::api::runtime::PlatformOs::kFreebsd;
+ } else {
+ NOTREACHED();
+ return false;
diff --git a/devel/electron31/files/patch-electron_shell_browser_native__window.cc b/devel/electron31/files/patch-electron_shell_browser_native__window.cc
new file mode 100644
index 000000000000..d67815650ff3
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_native__window.cc
@@ -0,0 +1,11 @@
+--- electron/shell/browser/native_window.cc.orig 2024-07-15 15:22:56 UTC
++++ electron/shell/browser/native_window.cc
+@@ -203,7 +203,7 @@ void NativeWindow::InitFromOptions(const gin_helper::D
+ } else {
+ SetSizeConstraints(size_constraints);
+ }
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool closable;
+ if (options.Get(options::kClosable, &closable)) {
+ SetClosable(closable);
diff --git a/devel/electron31/files/patch-electron_shell_browser_native__window__views.cc b/devel/electron31/files/patch-electron_shell_browser_native__window__views.cc
new file mode 100644
index 000000000000..e13b55bfbc57
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_native__window__views.cc
@@ -0,0 +1,200 @@
+--- electron/shell/browser/native_window_views.cc.orig 2024-07-15 15:22:56 UTC
++++ electron/shell/browser/native_window_views.cc
+@@ -52,7 +52,7 @@
+ #include "ui/wm/core/shadow_types.h"
+ #include "ui/wm/core/window_util.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/strings/string_util.h"
+ #include "shell/browser/browser.h"
+ #include "shell/browser/linux/unity_service.h"
+@@ -297,7 +297,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper:
+ params.parent = parent->GetNativeWindow();
+
+ params.native_widget = new ElectronDesktopNativeWidgetAura(this);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::string name = Browser::Get()->GetName();
+ // Set WM_WINDOW_ROLE.
+ params.wm_role_name = "browser-window";
+@@ -323,7 +323,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper:
+ std::string window_type;
+ options.Get(options::kType, &window_type);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Set _GTK_THEME_VARIANT to dark if we have "dark-theme" option set.
+ bool use_dark_theme = false;
+ if (options.Get(options::kDarkTheme, &use_dark_theme) && use_dark_theme) {
+@@ -425,7 +425,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper:
+ if (window)
+ window->AddPreTargetHandler(this);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On linux after the widget is initialized we might have to force set the
+ // bounds if the bounds are smaller than the current display
+ SetBounds(gfx::Rect(GetPosition(), bounds.size()), false);
+@@ -461,7 +461,7 @@ void NativeWindowViews::SetGTKDarkThemeEnabled(bool us
+ }
+
+ void NativeWindowViews::SetGTKDarkThemeEnabled(bool use_dark_theme) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (IsX11()) {
+ const std::string color = use_dark_theme ? "dark" : "light";
+ auto* connection = x11::Connection::Get();
+@@ -523,7 +523,7 @@ void NativeWindowViews::Show() {
+
+ NotifyWindowShow();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (global_menu_bar_)
+ global_menu_bar_->OnWindowMapped();
+
+@@ -539,7 +539,7 @@ void NativeWindowViews::ShowInactive() {
+
+ NotifyWindowShow();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (global_menu_bar_)
+ global_menu_bar_->OnWindowMapped();
+ #endif
+@@ -553,7 +553,7 @@ void NativeWindowViews::Hide() {
+
+ NotifyWindowHide();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (global_menu_bar_)
+ global_menu_bar_->OnWindowUnmapped();
+ #endif
+@@ -584,7 +584,7 @@ bool NativeWindowViews::IsEnabled() const {
+ bool NativeWindowViews::IsEnabled() const {
+ #if BUILDFLAG(IS_WIN)
+ return ::IsWindowEnabled(GetAcceleratedWidget());
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (IsX11())
+ return !event_disabler_.get();
+ NOTIMPLEMENTED();
+@@ -640,7 +640,7 @@ void NativeWindowViews::SetEnabledInternal(bool enable
+ #endif
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void NativeWindowViews::Maximize() {
+ if (IsVisible()) {
+ widget()->Maximize();
+@@ -780,7 +780,7 @@ void NativeWindowViews::SetBounds(const gfx::Rect& bou
+ }
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On Linux and Windows the minimum and maximum size should be updated with
+ // window size when window is not resizable.
+ if (!resizable_) {
+@@ -1040,7 +1040,7 @@ bool NativeWindowViews::IsClosable() const {
+ return false;
+ }
+ return !(info.fState & MFS_DISABLED);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return true;
+ #endif
+ }
+@@ -1080,7 +1080,7 @@ void NativeWindowViews::Center() {
+ // for now to avoid breaking API contract, but should consider the long
+ // term plan for this aligning with upstream.
+ void NativeWindowViews::Center() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto display =
+ display::Screen::GetScreen()->GetDisplayNearestWindow(GetNativeWindow());
+ gfx::Rect window_bounds_in_screen = display.work_area();
+@@ -1303,7 +1303,7 @@ void NativeWindowViews::SetMenu(ElectronMenuModel* men
+ }
+
+ void NativeWindowViews::SetMenu(ElectronMenuModel* menu_model) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Remove global menu bar.
+ if (global_menu_bar_ && menu_model == nullptr) {
+ global_menu_bar_.reset();
+@@ -1358,7 +1358,7 @@ void NativeWindowViews::SetParentWindow(NativeWindow*
+ void NativeWindowViews::SetParentWindow(NativeWindow* parent) {
+ NativeWindow::SetParentWindow(parent);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (IsX11()) {
+ auto* connection = x11::Connection::Get();
+ connection->SetProperty(
+@@ -1404,7 +1404,7 @@ void NativeWindowViews::SetProgressBar(double progress
+ NativeWindow::ProgressState state) {
+ #if BUILDFLAG(IS_WIN)
+ taskbar_host_.SetProgressBar(GetAcceleratedWidget(), progress, state);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (unity::IsRunning()) {
+ unity::SetProgressFraction(progress);
+ }
+@@ -1475,7 +1475,7 @@ bool NativeWindowViews::IsVisibleOnAllWorkspaces() con
+ }
+
+ bool NativeWindowViews::IsVisibleOnAllWorkspaces() const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (IsX11()) {
+ // Use the presence/absence of _NET_WM_STATE_STICKY in _NET_WM_STATE to
+ // determine whether the current window is visible on all workspaces.
+@@ -1498,7 +1498,7 @@ content::DesktopMediaID NativeWindowViews::GetDesktopM
+ #if BUILDFLAG(IS_WIN)
+ window_handle =
+ reinterpret_cast<content::DesktopMediaID::Id>(accelerated_widget);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ window_handle = static_cast<uint32_t>(accelerated_widget);
+ #endif
+ aura::WindowTreeHost* const host =
+@@ -1596,7 +1596,7 @@ void NativeWindowViews::SetIcon(HICON window_icon, HIC
+ SendMessage(hwnd, WM_SETICON, ICON_BIG,
+ reinterpret_cast<LPARAM>(app_icon_.get()));
+ }
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void NativeWindowViews::SetIcon(const gfx::ImageSkia& icon) {
+ auto* tree_host = views::DesktopWindowTreeHostLinux::GetHostForWidget(
+ GetAcceleratedWidget());
+@@ -1674,7 +1674,7 @@ bool NativeWindowViews::CanMinimize() const {
+ bool NativeWindowViews::CanMinimize() const {
+ #if BUILDFLAG(IS_WIN)
+ return minimizable_;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return true;
+ #endif
+ }
+@@ -1730,7 +1730,7 @@ void NativeWindowViews::HandleKeyboardEvent(
+ if (widget_destroyed_)
+ return;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (event.windows_key_code == ui::VKEY_BROWSER_BACK)
+ NotifyWindowExecuteAppCommand(kBrowserBackward);
+ else if (event.windows_key_code == ui::VKEY_BROWSER_FORWARD)
+@@ -1749,7 +1749,7 @@ void NativeWindowViews::OnMouseEvent(ui::MouseEvent* e
+ // Alt+Click should not toggle menu bar.
+ root_view_.ResetAltState();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (event->changed_button_flags() == ui::EF_BACK_MOUSE_BUTTON)
+ NotifyWindowExecuteAppCommand(kBrowserBackward);
+ else if (event->changed_button_flags() == ui::EF_FORWARD_MOUSE_BUTTON)
diff --git a/devel/electron31/files/patch-electron_shell_browser_native__window__views.h b/devel/electron31/files/patch-electron_shell_browser_native__window__views.h
new file mode 100644
index 000000000000..ca06303f8f39
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_native__window__views.h
@@ -0,0 +1,29 @@
+--- electron/shell/browser/native_window_views.h.orig 2024-07-15 15:22:56 UTC
++++ electron/shell/browser/native_window_views.h
+@@ -25,7 +25,7 @@ namespace electron {
+
+ namespace electron {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ class GlobalMenuBarX11;
+ #endif
+
+@@ -161,7 +161,7 @@ class NativeWindowViews : public NativeWindow,
+ LPARAM l_param,
+ LRESULT* result);
+ void SetIcon(HICON small_icon, HICON app_icon);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SetIcon(const gfx::ImageSkia& icon);
+ #endif
+
+@@ -248,7 +248,7 @@ class NativeWindowViews : public NativeWindow,
+ // events from resizing the window.
+ extensions::SizeConstraints old_size_constraints_;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<GlobalMenuBarX11> global_menu_bar_;
+ #endif
+
diff --git a/devel/electron31/files/patch-electron_shell_browser_net_system__network__context__manager.cc b/devel/electron31/files/patch-electron_shell_browser_net_system__network__context__manager.cc
new file mode 100644
index 000000000000..9a324567ff54
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_net_system__network__context__manager.cc
@@ -0,0 +1,11 @@
+--- electron/shell/browser/net/system_network_context_manager.cc.orig 2023-08-14 18:19:06 UTC
++++ electron/shell/browser/net/system_network_context_manager.cc
+@@ -42,7 +42,7 @@
+ #include "shell/common/options_switches.h"
+ #include "url/gurl.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "components/os_crypt/sync/key_storage_config_linux.h"
+ #endif
+
diff --git a/devel/electron31/files/patch-electron_shell_browser_osr_osr__host__display__client.cc b/devel/electron31/files/patch-electron_shell_browser_osr_osr__host__display__client.cc
new file mode 100644
index 000000000000..bd1e1964984e
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_osr_osr__host__display__client.cc
@@ -0,0 +1,11 @@
+--- electron/shell/browser/osr/osr_host_display_client.cc.orig 2023-10-20 08:29:17 UTC
++++ electron/shell/browser/osr/osr_host_display_client.cc
+@@ -96,7 +96,7 @@ void OffScreenHostDisplayClient::CreateLayeredWindowUp
+ layered_window_updater_->SetActive(active_);
+ }
+
+-#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)) || BUILDFLAG(IS_BSD)
+ void OffScreenHostDisplayClient::DidCompleteSwapWithNewSize(
+ const gfx::Size& size) {}
+ #endif
diff --git a/devel/electron31/files/patch-electron_shell_browser_osr_osr__host__display__client.h b/devel/electron31/files/patch-electron_shell_browser_osr_osr__host__display__client.h
new file mode 100644
index 000000000000..2c08a68bc878
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_osr_osr__host__display__client.h
@@ -0,0 +1,11 @@
+--- electron/shell/browser/osr/osr_host_display_client.h.orig 2022-05-18 15:31:32 UTC
++++ electron/shell/browser/osr/osr_host_display_client.h
+@@ -72,7 +72,7 @@ class OffScreenHostDisplayClient : public viz::HostDis
+ mojo::PendingReceiver<viz::mojom::LayeredWindowUpdater> receiver)
+ override;
+
+-#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)) || BUILDFLAG(IS_BSD)
+ void DidCompleteSwapWithNewSize(const gfx::Size& size) override;
+ #endif
+
diff --git a/devel/electron31/files/patch-electron_shell_browser_printing_printing__utils.cc b/devel/electron31/files/patch-electron_shell_browser_printing_printing__utils.cc
new file mode 100644
index 000000000000..887b92fbeaef
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_printing_printing__utils.cc
@@ -0,0 +1,11 @@
+--- electron/shell/browser/printing/printing_utils.cc.orig 2024-04-19 08:41:45 UTC
++++ electron/shell/browser/printing/printing_utils.cc
+@@ -20,7 +20,7 @@
+ #include <ApplicationServices/ApplicationServices.h>
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include <gtk/gtk.h>
+ #endif
+
diff --git a/devel/electron31/files/patch-electron_shell_browser_relauncher__linux.cc b/devel/electron31/files/patch-electron_shell_browser_relauncher__linux.cc
new file mode 100644
index 000000000000..e5f44888577e
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_relauncher__linux.cc
@@ -0,0 +1,32 @@
+--- electron/shell/browser/relauncher_linux.cc.orig 2023-01-24 16:58:16 UTC
++++ electron/shell/browser/relauncher_linux.cc
+@@ -6,8 +6,10 @@
+
+ #include <fcntl.h>
+ #include <signal.h>
++#if !defined(__FreeBSD__)
+ #include <sys/prctl.h>
+ #include <sys/signalfd.h>
++#endif
+
+ #include "base/files/file_util.h"
+ #include "base/files/scoped_file.h"
+@@ -24,6 +26,10 @@ void RelauncherSynchronizeWithParent() {
+ base::ScopedFD relauncher_sync_fd(kRelauncherSyncFD);
+ static const auto signum = SIGUSR2;
+
++#if defined(__FreeBSD__)
++ PLOG(ERROR) << "signalfd & prctl";
++ fprintf(stderr, "Not Implemented signalfd & prctl in atom/browser/relauncher_linux.cc");
++#else
+ // send signum to current process when parent process ends.
+ if (HANDLE_EINTR(prctl(PR_SET_PDEATHSIG, signum)) != 0) {
+ PLOG(ERROR) << "prctl";
+@@ -48,6 +54,7 @@ void RelauncherSynchronizeWithParent() {
+
+ // Wait for the parent to exit
+ parentWaiter.Wait();
++#endif
+ }
+
+ int LaunchProgram(const StringVector& relauncher_args,
diff --git a/devel/electron31/files/patch-electron_shell_browser_ui_inspectable__web__contents__view.cc b/devel/electron31/files/patch-electron_shell_browser_ui_inspectable__web__contents__view.cc
new file mode 100644
index 000000000000..f1107bbff093
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_ui_inspectable__web__contents__view.cc
@@ -0,0 +1,11 @@
+--- electron/shell/browser/ui/inspectable_web_contents_view.cc.orig 2024-06-24 09:53:23 UTC
++++ electron/shell/browser/ui/inspectable_web_contents_view.cc
+@@ -175,7 +175,7 @@ void InspectableWebContentsView::SetIsDocked(bool dock
+ params.delegate = devtools_window_delegate_;
+ params.bounds = inspectable_web_contents()->dev_tools_bounds();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ params.wm_role_name = "devtools";
+ if (GetDelegate())
+ GetDelegate()->GetDevToolsWindowWMClass(&params.wm_class_name,
diff --git a/devel/electron31/files/patch-electron_shell_browser_ui_inspectable__web__contents__view__delegate.h b/devel/electron31/files/patch-electron_shell_browser_ui_inspectable__web__contents__view__delegate.h
new file mode 100644
index 000000000000..36fa491f6daa
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_ui_inspectable__web__contents__view__delegate.h
@@ -0,0 +1,11 @@
+--- electron/shell/browser/ui/inspectable_web_contents_view_delegate.h.orig 2022-05-18 15:31:32 UTC
++++ electron/shell/browser/ui/inspectable_web_contents_view_delegate.h
+@@ -24,7 +24,7 @@ class InspectableWebContentsViewDelegate {
+ // Returns the icon of devtools window.
+ virtual ui::ImageModel GetDevToolsWindowIcon();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Called when creating devtools window.
+ virtual void GetDevToolsWindowWMClass(std::string* name,
+ std::string* class_name) {}
diff --git a/devel/electron31/files/patch-electron_shell_browser_ui_views_electron__views__delegate.cc b/devel/electron31/files/patch-electron_shell_browser_ui_views_electron__views__delegate.cc
new file mode 100644
index 000000000000..21bc4a31c5f9
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_ui_views_electron__views__delegate.cc
@@ -0,0 +1,38 @@
+--- electron/shell/browser/ui/views/electron_views_delegate.cc.orig 2023-01-24 16:58:16 UTC
++++ electron/shell/browser/ui/views/electron_views_delegate.cc
+@@ -9,7 +9,7 @@
+ #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
+ #include "ui/views/widget/native_widget_aura.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/environment.h"
+ #include "base/nix/xdg_util.h"
+ #include "ui/linux/linux_ui.h"
+@@ -17,7 +17,7 @@
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool IsDesktopEnvironmentUnity() {
+ auto env = base::Environment::Create();
+ base::nix::DesktopEnvironment desktop_env =
+@@ -53,7 +53,7 @@ void ViewsDelegate::NotifyMenuItemFocused(const std::u
+ int item_count,
+ bool has_submenu) {}
+
+-#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)) || BUILDFLAG(IS_BSD)
+ gfx::ImageSkia* ViewsDelegate::GetDefaultWindowIcon() const {
+ return nullptr;
+ }
+@@ -85,7 +85,7 @@ void ViewsDelegate::OnBeforeWidgetInit(
+ }
+
+ bool ViewsDelegate::WindowManagerProvidesTitleBar(bool maximized) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On Ubuntu Unity, the system always provides a title bar for maximized
+ // windows.
+ if (!maximized)
diff --git a/devel/electron31/files/patch-electron_shell_browser_ui_views_electron__views__delegate.h b/devel/electron31/files/patch-electron_shell_browser_ui_views_electron__views__delegate.h
new file mode 100644
index 000000000000..19ff8533f684
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_ui_views_electron__views__delegate.h
@@ -0,0 +1,11 @@
+--- electron/shell/browser/ui/views/electron_views_delegate.h.orig 2023-08-14 18:19:06 UTC
++++ electron/shell/browser/ui/views/electron_views_delegate.h
+@@ -44,7 +44,7 @@ class ViewsDelegate : public views::ViewsDelegate {
+ HICON GetSmallWindowIcon() const override;
+ int GetAppbarAutohideEdges(HMONITOR monitor,
+ base::OnceClosure callback) override;
+-#elif BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#elif (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)) || BUILDFLAG(IS_BSD)
+ gfx::ImageSkia* GetDefaultWindowIcon() const override;
+ #endif
+ std::unique_ptr<views::NonClientFrameView> CreateDefaultNonClientFrameView(
diff --git a/devel/electron31/files/patch-electron_shell_browser_ui_views_menu__bar.cc b/devel/electron31/files/patch-electron_shell_browser_ui_views_menu__bar.cc
new file mode 100644
index 000000000000..095da0a6edd4
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_ui_views_menu__bar.cc
@@ -0,0 +1,38 @@
+--- electron/shell/browser/ui/views/menu_bar.cc.orig 2024-04-16 14:29:17 UTC
++++ electron/shell/browser/ui/views/menu_bar.cc
+@@ -13,7 +13,7 @@
+ #include "ui/views/background.h"
+ #include "ui/views/layout/box_layout.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/gtk/gtk_util.h" // nogncheck
+ #endif
+
+@@ -212,7 +212,7 @@ void MenuBar::RefreshColorCache(const ui::NativeTheme*
+
+ void MenuBar::RefreshColorCache(const ui::NativeTheme* theme) {
+ if (theme) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ background_color_ = gtk::GetBgColor("GtkMenuBar#menubar");
+ enabled_color_ =
+ gtk::GetFgColor("GtkMenuBar#menubar GtkMenuItem#menuitem GtkLabel");
+@@ -237,7 +237,7 @@ void MenuBar::UpdateViewColors() {
+ }
+
+ void MenuBar::UpdateViewColors() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // set menubar background color
+ SetBackground(views::CreateSolidBackground(background_color_));
+ #endif
+@@ -245,7 +245,7 @@ void MenuBar::UpdateViewColors() {
+ // set child colors
+ if (menu_model_ == nullptr)
+ return;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const auto& textColor =
+ window_->IsFocused() ? enabled_color_ : disabled_color_;
+ for (views::View* child : GetChildrenInZOrder()) {
diff --git a/devel/electron31/files/patch-electron_shell_browser_ui_views_menu__bar.h b/devel/electron31/files/patch-electron_shell_browser_ui_views_menu__bar.h
new file mode 100644
index 000000000000..93d18ea5f9f5
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_ui_views_menu__bar.h
@@ -0,0 +1,11 @@
+--- electron/shell/browser/ui/views/menu_bar.h.orig 2024-04-16 14:29:17 UTC
++++ electron/shell/browser/ui/views/menu_bar.h
+@@ -84,7 +84,7 @@ class MenuBar : public views::AccessiblePaneView,
+ View* FindAccelChild(char16_t key);
+
+ SkColor background_color_;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ SkColor enabled_color_;
+ SkColor disabled_color_;
+ #endif
diff --git a/devel/electron31/files/patch-electron_shell_browser_ui_views_submenu__button.cc b/devel/electron31/files/patch-electron_shell_browser_ui_views_submenu__button.cc
new file mode 100644
index 000000000000..4012c3957da3
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_browser_ui_views_submenu__button.cc
@@ -0,0 +1,11 @@
+--- electron/shell/browser/ui/views/submenu_button.cc.orig 2024-02-21 16:26:48 UTC
++++ electron/shell/browser/ui/views/submenu_button.cc
+@@ -22,7 +22,7 @@ SubmenuButton::SubmenuButton(PressedCallback callback,
+ const SkColor& background_color)
+ : views::MenuButton(std::move(callback), gfx::RemoveAccelerator(title)),
+ background_color_(background_color) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Dont' use native style border.
+ SetBorder(CreateDefaultBorder());
+ #endif
diff --git a/devel/electron31/files/patch-electron_shell_common_api_electron__api__clipboard.cc b/devel/electron31/files/patch-electron_shell_common_api_electron__api__clipboard.cc
new file mode 100644
index 000000000000..dad30bfa0dcd
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_common_api_electron__api__clipboard.cc
@@ -0,0 +1,20 @@
+--- electron/shell/common/api/electron_api_clipboard.cc.orig 2024-04-16 14:29:17 UTC
++++ electron/shell/common/api/electron_api_clipboard.cc
+@@ -58,7 +58,7 @@ std::string Clipboard::Read(const std::string& format_
+ ui::ClipboardFormatType::CustomPlatformType(format_string));
+ bool rawFormatAvailable = clipboard->IsFormatAvailable(
+ rawFormat, ui::ClipboardBuffer::kCopyPaste, /* data_dst = */ nullptr);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!rawFormatAvailable) {
+ rawFormatAvailable = clipboard->IsFormatAvailable(
+ rawFormat, ui::ClipboardBuffer::kSelection, /* data_dst = */ nullptr);
+@@ -74,7 +74,7 @@ std::string Clipboard::Read(const std::string& format_
+ custom_format_names =
+ clipboard->ExtractCustomPlatformNames(ui::ClipboardBuffer::kCopyPaste,
+ /* data_dst = */ nullptr);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!base::Contains(custom_format_names, format_string)) {
+ custom_format_names =
+ clipboard->ExtractCustomPlatformNames(ui::ClipboardBuffer::kSelection,
diff --git a/devel/electron31/files/patch-electron_shell_common_api_electron__api__native__image.cc b/devel/electron31/files/patch-electron_shell_common_api_electron__api__native__image.cc
new file mode 100644
index 000000000000..2336c87d38fe
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_common_api_electron__api__native__image.cc
@@ -0,0 +1,11 @@
+--- electron/shell/common/api/electron_api_native_image.cc.orig 2024-06-24 09:53:23 UTC
++++ electron/shell/common/api/electron_api_native_image.cc
+@@ -646,7 +646,7 @@ void Initialize(v8::Local<v8::Object> exports,
+ native_image.SetMethod("createFromDataURL", &NativeImage::CreateFromDataURL);
+ native_image.SetMethod("createFromNamedImage",
+ &NativeImage::CreateFromNamedImage);
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ native_image.SetMethod("createThumbnailFromPath",
+ &NativeImage::CreateThumbnailFromPath);
+ #endif
diff --git a/devel/electron31/files/patch-electron_shell_common_api_electron__api__native__image.h b/devel/electron31/files/patch-electron_shell_common_api_electron__api__native__image.h
new file mode 100644
index 000000000000..a92f3e17e880
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_common_api_electron__api__native__image.h
@@ -0,0 +1,11 @@
+--- electron/shell/common/api/electron_api_native_image.h.orig 2023-08-14 18:19:06 UTC
++++ electron/shell/common/api/electron_api_native_image.h
+@@ -78,7 +78,7 @@ class NativeImage : public gin::Wrappable<NativeImage>
+ const GURL& url);
+ static gin::Handle<NativeImage> CreateFromNamedImage(gin::Arguments* args,
+ std::string name);
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ static v8::Local<v8::Promise> CreateThumbnailFromPath(
+ v8::Isolate* isolate,
+ const base::FilePath& path,
diff --git a/devel/electron31/files/patch-electron_shell_common_api_electron__bindings.cc b/devel/electron31/files/patch-electron_shell_common_api_electron__bindings.cc
new file mode 100644
index 000000000000..94fccd180528
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_common_api_electron__bindings.cc
@@ -0,0 +1,11 @@
+--- electron/shell/common/api/electron_bindings.cc.orig 2024-04-16 14:29:17 UTC
++++ electron/shell/common/api/electron_bindings.cc
+@@ -255,7 +255,7 @@ void ElectronBindings::DidReceiveMemoryDump(
+ if (target_pid == dump.pid()) {
+ auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
+ const auto& osdump = dump.os_dump();
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ dict.Set("residentSet", osdump.resident_set_kb);
+ #endif
+ dict.Set("private", osdump.private_footprint_kb);
diff --git a/devel/electron31/files/patch-electron_shell_common_electron__command__line.cc b/devel/electron31/files/patch-electron_shell_common_electron__command__line.cc
new file mode 100644
index 000000000000..10eb673c987e
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_common_electron__command__line.cc
@@ -0,0 +1,11 @@
+--- electron/shell/common/electron_command_line.cc.orig 2022-05-18 15:31:32 UTC
++++ electron/shell/common/electron_command_line.cc
+@@ -26,7 +26,7 @@ void ElectronCommandLine::Init(int argc, base::Command
+ argv_.assign(argv, argv + argc);
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // static
+ void ElectronCommandLine::InitializeFromCommandLine() {
+ argv_ = base::CommandLine::ForCurrentProcess()->argv();
diff --git a/devel/electron31/files/patch-electron_shell_common_electron__command__line.h b/devel/electron31/files/patch-electron_shell_common_electron__command__line.h
new file mode 100644
index 000000000000..faf234d31c46
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_common_electron__command__line.h
@@ -0,0 +1,11 @@
+--- electron/shell/common/electron_command_line.h.orig 2022-05-18 15:31:32 UTC
++++ electron/shell/common/electron_command_line.h
+@@ -22,7 +22,7 @@ class ElectronCommandLine {
+
+ static void Init(int argc, base::CommandLine::CharType** argv);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On Linux the command line has to be read from base::CommandLine since
+ // it is using zygote.
+ static void InitializeFromCommandLine();
diff --git a/devel/electron31/files/patch-electron_shell_common_electron__paths.h b/devel/electron31/files/patch-electron_shell_common_electron__paths.h
new file mode 100644
index 000000000000..5ca6a126e4b3
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_common_electron__paths.h
@@ -0,0 +1,11 @@
+--- electron/shell/common/electron_paths.h.orig 2022-08-03 15:31:32 UTC
++++ electron/shell/common/electron_paths.h
+@@ -30,7 +30,7 @@ enum {
+ DIR_RECENT, // Directory where recent files live
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ DIR_APP_DATA, // Application Data directory under the user profile.
+ #endif
+
diff --git a/devel/electron31/files/patch-electron_shell_common_gin__converters_std__converter.h b/devel/electron31/files/patch-electron_shell_common_gin__converters_std__converter.h
new file mode 100644
index 000000000000..8fb16f713e95
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_common_gin__converters_std__converter.h
@@ -0,0 +1,11 @@
+--- electron/shell/common/gin_converters/std_converter.h.orig 2023-08-14 18:19:06 UTC
++++ electron/shell/common/gin_converters/std_converter.h
+@@ -28,7 +28,7 @@ v8::Local<v8::Value> ConvertToV8(v8::Isolate* isolate,
+ isolate, std::forward<T>(input));
+ }
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ template <>
+ struct Converter<unsigned long> { // NOLINT(runtime/int)
+ static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
diff --git a/devel/electron31/files/patch-electron_shell_common_node__bindings.cc b/devel/electron31/files/patch-electron_shell_common_node__bindings.cc
new file mode 100644
index 000000000000..941d9502fb74
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_common_node__bindings.cc
@@ -0,0 +1,29 @@
+--- electron/shell/common/node_bindings.cc.orig 2024-06-24 09:53:23 UTC
++++ electron/shell/common/node_bindings.cc
+@@ -43,7 +43,7 @@
+ #include "third_party/electron_node/src/debug_utils.h"
+ #include "third_party/electron_node/src/module_wrap.h"
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ #include "shell/common/crash_keys.h"
+ #endif
+
+@@ -157,7 +157,7 @@ void V8FatalErrorCallback(const char* location, const
+ void V8FatalErrorCallback(const char* location, const char* message) {
+ LOG(ERROR) << "Fatal error in V8: " << location << " " << message;
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ electron::crash_keys::SetCrashKey("electron.v8-fatal.message", message);
+ electron::crash_keys::SetCrashKey("electron.v8-fatal.location", location);
+ #endif
+@@ -517,7 +517,7 @@ void NodeBindings::Initialize(v8::Local<v8::Context> c
+ TRACE_EVENT0("electron", "NodeBindings::Initialize");
+ // Open node's error reporting system for browser process.
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Get real command line in renderer process forked by zygote.
+ if (browser_env_ != BrowserEnvironment::kBrowser)
+ ElectronCommandLine::InitializeFromCommandLine();
diff --git a/devel/electron31/files/patch-electron_shell_common_node__bindings__linux.cc b/devel/electron31/files/patch-electron_shell_common_node__bindings__linux.cc
new file mode 100644
index 000000000000..0dabd6390a8d
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_common_node__bindings__linux.cc
@@ -0,0 +1,69 @@
+--- electron/shell/common/node_bindings_linux.cc.orig 2023-10-20 08:29:17 UTC
++++ electron/shell/common/node_bindings_linux.cc
+@@ -4,12 +4,25 @@
+
+ #include "shell/common/node_bindings_linux.h"
+
++#if !defined(OS_BSD)
+ #include <sys/epoll.h>
++#else
++#include <errno.h>
++#include <sys/select.h>
++#include <sys/sysctl.h>
++#include <sys/time.h>
++#include <sys/types.h>
++#endif
+
+ namespace electron {
+
+ NodeBindingsLinux::NodeBindingsLinux(BrowserEnvironment browser_env)
++#if !defined(OS_BSD)
+ : NodeBindings(browser_env), epoll_(epoll_create(1)) {
++#else
++ : NodeBindings(browser_env) {
++#endif
++#if !defined(OS_BSD)
+ auto* const event_loop = uv_loop();
+
+ int backend_fd = uv_backend_fd(event_loop);
+@@ -17,11 +30,13 @@ NodeBindingsLinux::NodeBindingsLinux(BrowserEnvironmen
+ ev.events = EPOLLIN;
+ ev.data.fd = backend_fd;
+ epoll_ctl(epoll_, EPOLL_CTL_ADD, backend_fd, &ev);
++#endif
+ }
+
+ void NodeBindingsLinux::PollEvents() {
+ auto* const event_loop = uv_loop();
+
++#if !defined(OS_BSD)
+ int timeout = uv_backend_timeout(event_loop);
+
+ // Wait for new libuv events.
+@@ -30,6 +45,26 @@ void NodeBindingsLinux::PollEvents() {
+ struct epoll_event ev;
+ r = epoll_wait(epoll_, &ev, 1, timeout);
+ } while (r == -1 && errno == EINTR);
++#else
++ struct timeval tv;
++ int timeout = uv_backend_timeout(event_loop);
++ if (timeout != -1) {
++ tv.tv_sec = timeout / 1000;
++ tv.tv_usec = (timeout % 1000) * 1000;
++ }
++
++ fd_set readset;
++ int fd = uv_backend_fd(event_loop);
++ FD_ZERO(&readset);
++ FD_SET(fd, &readset);
++
++ // Wait for new libuv events.
++ int r;
++ do {
++ r = select(fd + 1, &readset, nullptr, nullptr,
++ timeout == -1 ? nullptr : &tv);
++ } while (r == -1 && errno == EINTR);
++#endif
+ }
+
+ // static
diff --git a/devel/electron31/files/patch-electron_shell_common_platform__util.h b/devel/electron31/files/patch-electron_shell_common_platform__util.h
new file mode 100644
index 000000000000..ab0d33da03d6
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_common_platform__util.h
@@ -0,0 +1,11 @@
+--- electron/shell/common/platform_util.h.orig 2024-02-21 16:26:48 UTC
++++ electron/shell/common/platform_util.h
+@@ -56,7 +56,7 @@ bool SetLoginItemEnabled(const std::string& type,
+ bool enabled);
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Returns a success flag.
+ // Unlike libgtkui, does *not* use "chromium-browser.desktop" as a fallback.
+ bool GetDesktopName(std::string* setme);
diff --git a/devel/electron31/files/patch-electron_shell_renderer_api_electron__api__crash__reporter__renderer.cc b/devel/electron31/files/patch-electron_shell_renderer_api_electron__api__crash__reporter__renderer.cc
new file mode 100644
index 000000000000..56b9420c6ec8
--- /dev/null
+++ b/devel/electron31/files/patch-electron_shell_renderer_api_electron__api__crash__reporter__renderer.cc
@@ -0,0 +1,36 @@
+--- electron/shell/renderer/api/electron_api_crash_reporter_renderer.cc.orig 2023-02-06 19:29:11 UTC
++++ electron/shell/renderer/api/electron_api_crash_reporter_renderer.cc
+@@ -6,7 +6,7 @@
+ #include "shell/common/gin_helper/dictionary.h"
+ #include "shell/common/node_includes.h"
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ #include "shell/common/crash_keys.h"
+ #endif
+
+@@ -14,13 +14,13 @@ namespace {
+
+ v8::Local<v8::Value> GetParameters(v8::Isolate* isolate) {
+ std::map<std::string, std::string> keys;
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ electron::crash_keys::GetCrashKeys(&keys);
+ #endif
+ return gin::ConvertToV8(isolate, keys);
+ }
+
+-#if IS_MAS_BUILD()
++#if IS_MAS_BUILD() || BUILDFLAG(IS_BSD)
+ void SetCrashKeyStub(const std::string& key, const std::string& value) {}
+ void ClearCrashKeyStub(const std::string& key) {}
+ #endif
+@@ -30,7 +30,7 @@ void Initialize(v8::Local<v8::Object> exports,
+ v8::Local<v8::Context> context,
+ void* priv) {
+ gin_helper::Dictionary dict(context->GetIsolate(), exports);
+-#if IS_MAS_BUILD()
++#if IS_MAS_BUILD() || BUILDFLAG(IS_BSD)
+ dict.SetMethod("addExtraParameter", &SetCrashKeyStub);
+ dict.SetMethod("removeExtraParameter", &ClearCrashKeyStub);
+ #else
diff --git a/devel/electron31/files/patch-electron_spec_api-app-spec.ts b/devel/electron31/files/patch-electron_spec_api-app-spec.ts
new file mode 100644
index 000000000000..b6c5a356aa18
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-app-spec.ts
@@ -0,0 +1,124 @@
+--- electron/spec/api-app-spec.ts.orig 2024-07-15 15:22:56 UTC
++++ electron/spec/api-app-spec.ts
+@@ -123,11 +123,11 @@ describe('app module', () => {
+ });
+
+ describe('app.getPreferredSystemLanguages()', () => {
+- ifit(process.platform !== 'linux')('should not be empty', () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('should not be empty', () => {
+ expect(app.getPreferredSystemLanguages().length).to.not.equal(0);
+ });
+
+- ifit(process.platform === 'linux')('should be empty or contain C entry', () => {
++ ifit(process.platform === 'linux' || process.platform === 'freebsd')('should be empty or contain C entry', () => {
+ const languages = app.getPreferredSystemLanguages();
+ if (languages.length) {
+ expect(languages).to.not.include('C');
+@@ -190,7 +190,7 @@ describe('app module', () => {
+ expect(code).to.equal(123, 'exit code should be 123, if you see this please tag @MarshallOfSound');
+ });
+
+- ifit(['darwin', 'linux'].includes(process.platform))('exits gracefully', async function () {
++ ifit(['darwin', 'linux', 'freebsd'].includes(process.platform))('exits gracefully', async function () {
+ const electronPath = process.execPath;
+ const appPath = path.join(fixturesPath, 'api', 'singleton');
+ appProcess = cp.spawn(electronPath, [appPath]);
+@@ -444,7 +444,7 @@ describe('app module', () => {
+ // let w = null
+
+ // before(function () {
+- // if (process.platform !== 'linux') {
++ // if (process.platform !== 'linux' && process.platform !== 'freebsd') {
+ // this.skip()
+ // }
+ // })
+@@ -551,7 +551,7 @@ describe('app module', () => {
+ describe('app.badgeCount', () => {
+ const platformIsNotSupported =
+ (process.platform === 'win32') ||
+- (process.platform === 'linux' && !app.isUnityRunning());
++ ((process.platform === 'linux' || process.platform === 'freebsd') && !app.isUnityRunning());
+
+ const expectedBadgeCount = 42;
+
+@@ -595,7 +595,7 @@ describe('app module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux' && !process.mas && (process.platform !== 'darwin' || process.arch === 'arm64'))('app.get/setLoginItemSettings API', function () {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' && !process.mas && (process.platform !== 'darwin' || process.arch === 'arm64'))('app.get/setLoginItemSettings API', function () {
+ const isMac = process.platform === 'darwin';
+ const isWin = process.platform === 'win32';
+
+@@ -975,7 +975,7 @@ describe('app module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('accessibilitySupportEnabled property', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd')('accessibilitySupportEnabled property', () => {
+ it('with properties', () => {
+ it('can set accessibility support enabled', () => {
+ expect(app.accessibilitySupportEnabled).to.eql(false);
+@@ -1175,7 +1175,7 @@ describe('app module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('select-client-certificate event', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd')('select-client-certificate event', () => {
+ let w: BrowserWindow;
+
+ before(function () {
+@@ -1310,7 +1310,7 @@ describe('app module', () => {
+
+ describe('getApplicationNameForProtocol()', () => {
+ // TODO: Linux CI doesn't have registered http & https handlers
+- ifit(!(process.env.CI && process.platform === 'linux'))('returns application names for common protocols', function () {
++ ifit(!(process.env.CI && (process.platform === 'linux' || process.platform === 'freebsd')))('returns application names for common protocols', function () {
+ // We can't expect particular app names here, but these protocols should
+ // at least have _something_ registered. Except on our Linux CI
+ // environment apparently.
+@@ -1328,7 +1328,7 @@ describe('app module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('getApplicationInfoForProtocol()', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd')('getApplicationInfoForProtocol()', () => {
+ it('returns promise rejection for a bogus protocol', async function () {
+ await expect(
+ app.getApplicationInfoForProtocol('bogus-protocol://')
+@@ -1378,7 +1378,7 @@ describe('app module', () => {
+ });
+
+ // FIXME Get these specs running on Linux CI
+- ifdescribe(process.platform !== 'linux')('getFileIcon() API', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd')('getFileIcon() API', () => {
+ const iconPath = path.join(__dirname, 'fixtures/assets/icon.ico');
+ const sizes = {
+ small: 16,
+@@ -1459,7 +1459,7 @@ describe('app module', () => {
+ expect(entry.memory).to.have.property('privateBytes').that.is.greaterThan(0);
+ }
+
+- if (process.platform !== 'linux') {
++ if (process.platform !== 'linux' && process.platform !== 'freebsd') {
+ expect(entry.sandboxed).to.be.a('boolean');
+ }
+
+@@ -1533,7 +1533,7 @@ describe('app module', () => {
+
+ it('succeeds with complete GPUInfo', async () => {
+ const completeInfo = await getGPUInfo('complete');
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd') {
+ // For linux and macOS complete info is same as basic info
+ await verifyBasicGPUInfo(completeInfo);
+ const basicInfo = await getGPUInfo('basic');
+@@ -1557,7 +1557,7 @@ describe('app module', () => {
+ });
+ });
+
+- ifdescribe(!(process.platform === 'linux' && (process.arch === 'arm64' || process.arch === 'arm')))('sandbox options', () => {
++ ifdescribe(!((process.platform === 'linux' || process.platform === 'freebsd') && (process.arch === 'arm64' || process.arch === 'arm')))('sandbox options', () => {
+ // Our ARM tests are run on VSTS rather than CircleCI, and the Docker
+ // setup on VSTS disallows syscalls that Chrome requires for setting up
+ // sandboxing.
diff --git a/devel/electron31/files/patch-electron_spec_api-browser-window-spec.ts b/devel/electron31/files/patch-electron_spec_api-browser-window-spec.ts
new file mode 100644
index 000000000000..e808d5dc9b27
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-browser-window-spec.ts
@@ -0,0 +1,173 @@
+--- electron/spec/api-browser-window-spec.ts.orig 2024-07-15 15:22:56 UTC
++++ electron/spec/api-browser-window-spec.ts
+@@ -65,7 +65,7 @@ describe('BrowserWindow module', () => {
+ }).not.to.throw();
+ });
+
+- ifit(process.platform === 'linux')('does not crash when setting large window icons', async () => {
++ ifit(process.platform === 'linux' || process.platform === 'freebsd')('does not crash when setting large window icons', async () => {
+ const appPath = path.join(fixtures, 'apps', 'xwindow-icon');
+ const appProcess = childProcess.spawn(process.execPath, [appPath]);
+ await once(appProcess, 'exit');
+@@ -1114,7 +1114,7 @@ describe('BrowserWindow module', () => {
+
+ describe('BrowserWindow.minimize()', () => {
+ // TODO(codebytere): Enable for Linux once maximize/minimize events work in CI.
+- ifit(process.platform !== 'linux')('should not be visible when the window is minimized', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('should not be visible when the window is minimized', async () => {
+ const minimize = once(w, 'minimize');
+ w.minimize();
+ await minimize;
+@@ -1131,7 +1131,7 @@ describe('BrowserWindow module', () => {
+ });
+
+ // TODO(dsanders11): Enable for Linux once CI plays nice with these kinds of tests
+- ifit(process.platform !== 'linux')('should not restore maximized windows', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('should not restore maximized windows', async () => {
+ const maximize = once(w, 'maximize');
+ const shown = once(w, 'show');
+ w.maximize();
+@@ -1196,7 +1196,7 @@ describe('BrowserWindow module', () => {
+ expect(w.isFocused()).to.equal(true);
+ });
+
+- ifit(process.platform !== 'linux')('acquires focus status from the other windows', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('acquires focus status from the other windows', async () => {
+ const w1 = new BrowserWindow({ show: false });
+ const w2 = new BrowserWindow({ show: false });
+ const w3 = new BrowserWindow({ show: false });
+@@ -1297,7 +1297,7 @@ describe('BrowserWindow module', () => {
+ expect(w.isFocused()).to.equal(false);
+ });
+
+- ifit(process.platform !== 'linux')('transfers focus status to the next window', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('transfers focus status to the next window', async () => {
+ const w1 = new BrowserWindow({ show: false });
+ const w2 = new BrowserWindow({ show: false });
+ const w3 = new BrowserWindow({ show: false });
+@@ -1715,7 +1715,7 @@ describe('BrowserWindow module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('Maximized state', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd')('Maximized state', () => {
+ it('checks normal bounds when maximized', async () => {
+ const bounds = w.getBounds();
+ const maximize = once(w, 'maximize');
+@@ -1925,7 +1925,7 @@ describe('BrowserWindow module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('Minimized state', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd')('Minimized state', () => {
+ it('checks normal bounds when minimized', async () => {
+ const bounds = w.getBounds();
+ const minimize = once(w, 'minimize');
+@@ -2872,7 +2872,7 @@ describe('BrowserWindow module', () => {
+ describe('BrowserWindow.setOpacity(opacity)', () => {
+ afterEach(closeAllWindows);
+
+- ifdescribe(process.platform !== 'linux')(('Windows and Mac'), () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd')(('Windows and Mac'), () => {
+ it('make window with initial opacity', () => {
+ const w = new BrowserWindow({ show: false, opacity: 0.5 });
+ expect(w.getOpacity()).to.equal(0.5);
+@@ -2898,7 +2898,7 @@ describe('BrowserWindow module', () => {
+ });
+ });
+
+- ifdescribe(process.platform === 'linux')(('Linux'), () => {
++ ifdescribe(process.platform === 'linux' || process.platform === 'freebsd')(('Linux'), () => {
+ it('sets 1 regardless of parameter', () => {
+ const w = new BrowserWindow({ show: false });
+ w.setOpacity(0);
+@@ -3109,7 +3109,7 @@ describe('BrowserWindow module', () => {
+ expect(overlayRectPreMax.height).to.equal(size);
+
+ // 'maximize' event is not emitted on Linux in CI.
+- if (process.platform !== 'linux' && !w.isMaximized()) {
++ if ((process.platform !== 'linux' && process.platform !== 'freebsd') && !w.isMaximized()) {
+ const maximize = once(w, 'maximize');
+ w.show();
+ w.maximize();
+@@ -3175,7 +3175,7 @@ describe('BrowserWindow module', () => {
+ expect(preMaxHeight).to.equal(size);
+
+ // 'maximize' event is not emitted on Linux in CI.
+- if (process.platform !== 'linux' && !w.isMaximized()) {
++ if ((process.platform !== 'linux' && process.platform !== 'freebsd') && !w.isMaximized()) {
+ const maximize = once(w, 'maximize');
+ w.show();
+ w.maximize();
+@@ -3840,7 +3840,7 @@ describe('BrowserWindow module', () => {
+ expect(test.nodeTimers).to.equal(true);
+ expect(test.nodeUrl).to.equal(true);
+
+- if (process.platform === 'linux' && test.osSandbox) {
++ if ((process.platform === 'linux' || process.platform === 'freebsd') && test.osSandbox) {
+ expect(test.creationTime).to.be.null('creation time');
+ expect(test.systemMemoryInfo).to.be.null('system memory info');
+ } else {
+@@ -4345,7 +4345,7 @@ describe('BrowserWindow module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('max/minimize events', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd')('max/minimize events', () => {
+ afterEach(closeAllWindows);
+ it('emits an event when window is maximized', async () => {
+ const w = new BrowserWindow({ show: false });
+@@ -4616,7 +4616,7 @@ describe('BrowserWindow module', () => {
+ // TODO(zcbenz):
+ // This test does not run on Linux CI. See:
+ // https://github.com/electron/electron/issues/28699
+- ifit(process.platform === 'linux' && !process.env.CI)('should bring a minimized maximized window back to maximized state', async () => {
++ ifit((process.platform === 'linux' || process.platform === 'freebsd') && !process.env.CI)('should bring a minimized maximized window back to maximized state', async () => {
+ const w = new BrowserWindow({});
+ const maximize = once(w, 'maximize');
+ w.maximize();
+@@ -4633,7 +4633,7 @@ describe('BrowserWindow module', () => {
+ });
+
+ // TODO(dsanders11): Enable once maximize event works on Linux again on CI
+- ifdescribe(process.platform !== 'linux')('BrowserWindow.maximize()', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd')('BrowserWindow.maximize()', () => {
+ afterEach(closeAllWindows);
+ it('should show the window if it is not currently shown', async () => {
+ const w = new BrowserWindow({ show: false });
+@@ -4670,7 +4670,7 @@ describe('BrowserWindow module', () => {
+
+ // TODO(dsanders11): Enable once minimize event works on Linux again.
+ // See https://github.com/electron/electron/issues/28699
+- ifit(process.platform !== 'linux')('should not restore a minimized window', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('should not restore a minimized window', async () => {
+ const w = new BrowserWindow();
+ const minimize = once(w, 'minimize');
+ w.minimize();
+@@ -5144,7 +5144,7 @@ describe('BrowserWindow module', () => {
+ });
+
+ // On Linux there is no "resizable" property of a window.
+- ifit(process.platform !== 'linux')('does affect maximizability when disabled and enabled', () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('does affect maximizability when disabled and enabled', () => {
+ const w = new BrowserWindow({ show: false });
+ expect(w.resizable).to.be.true('resizable');
+
+@@ -5283,7 +5283,7 @@ describe('BrowserWindow module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('window states (excluding Linux)', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd')('window states (excluding Linux)', () => {
+ // Not implemented on Linux.
+ afterEach(closeAllWindows);
+
+@@ -6448,7 +6448,7 @@ describe('BrowserWindow module', () => {
+ describe('"transparent" option', () => {
+ afterEach(closeAllWindows);
+
+- ifit(process.platform !== 'linux')('correctly returns isMaximized() when the window is maximized then minimized', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('correctly returns isMaximized() when the window is maximized then minimized', async () => {
+ const w = new BrowserWindow({
+ frame: false,
+ transparent: true
diff --git a/devel/electron31/files/patch-electron_spec_api-clipboard-spec.ts b/devel/electron31/files/patch-electron_spec_api-clipboard-spec.ts
new file mode 100644
index 000000000000..8ae8e641d2f2
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-clipboard-spec.ts
@@ -0,0 +1,29 @@
+--- electron/spec/api-clipboard-spec.ts.orig 2024-06-24 09:53:23 UTC
++++ electron/spec/api-clipboard-spec.ts
+@@ -51,7 +51,7 @@ ifdescribe(process.platform !== 'win32' || process.arc
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('clipboard.readBookmark', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd')('clipboard.readBookmark', () => {
+ it('returns title and url', () => {
+ clipboard.writeBookmark('a title', 'https://electronjs.org');
+
+@@ -70,7 +70,7 @@ ifdescribe(process.platform !== 'win32' || process.arc
+ });
+
+ describe('clipboard.read()', () => {
+- ifit(process.platform !== 'linux')('does not crash when reading various custom clipboard types', () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('does not crash when reading various custom clipboard types', () => {
+ const type = process.platform === 'darwin' ? 'NSFilenamesPboardType' : 'FileNameW';
+
+ expect(() => {
+@@ -111,7 +111,7 @@ ifdescribe(process.platform !== 'win32' || process.arc
+ const readImage = clipboard.readImage();
+ expect(readImage.toDataURL()).to.equal(i.toDataURL());
+
+- if (process.platform !== 'linux') {
++ if (process.platform !== 'linux' && process.platform !== 'freebsd') {
+ if (process.platform !== 'win32') {
+ expect(clipboard.readBookmark()).to.deep.equal(bookmark);
+ } else {
diff --git a/devel/electron31/files/patch-electron_spec_api-content-tracing-spec.ts b/devel/electron31/files/patch-electron_spec_api-content-tracing-spec.ts
new file mode 100644
index 000000000000..526dde3fc788
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-content-tracing-spec.ts
@@ -0,0 +1,11 @@
+--- electron/spec/api-content-tracing-spec.ts.orig 2023-09-16 04:46:51 UTC
++++ electron/spec/api-content-tracing-spec.ts
+@@ -6,7 +6,7 @@ import { setTimeout } from 'timers/promises';
+ import { ifdescribe } from './lib/spec-helpers';
+
+ // FIXME: The tests are skipped on linux arm/arm64
+-ifdescribe(!(['arm', 'arm64'].includes(process.arch)) || (process.platform !== 'linux'))('contentTracing', () => {
++ifdescribe(!(['arm', 'arm64'].includes(process.arch)) || (process.platform !== 'linux' && process.platform !== 'freebsd'))('contentTracing', () => {
+ const record = async (options: TraceConfig | TraceCategoriesAndOptions, outputFilePath: string | undefined, recordTimeInMilliseconds = 1e1) => {
+ await app.whenReady();
+
diff --git a/devel/electron31/files/patch-electron_spec_api-crash-reporter-spec.ts b/devel/electron31/files/patch-electron_spec_api-crash-reporter-spec.ts
new file mode 100644
index 000000000000..3f0149ee4234
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-crash-reporter-spec.ts
@@ -0,0 +1,56 @@
+--- electron/spec/api-crash-reporter-spec.ts.orig 2024-01-23 19:02:02 UTC
++++ electron/spec/api-crash-reporter-spec.ts
+@@ -11,7 +11,7 @@ const isWindowsOnArm = process.platform === 'win32' &&
+ import { setTimeout } from 'node:timers/promises';
+
+ const isWindowsOnArm = process.platform === 'win32' && process.arch === 'arm64';
+-const isLinuxOnArm = process.platform === 'linux' && process.arch.includes('arm');
++const isLinuxOnArm = ((process.platform === 'linux' || process.platform === 'freebsd') && process.arch.includes('arm'));
+
+ type CrashInfo = {
+ prod: string
+@@ -44,7 +44,7 @@ function checkCrash (expectedProcessType: string, fiel
+
+ // TODO(nornagon): minidumps are sometimes (not always) turning up empty on
+ // 32-bit Linux. Figure out why.
+- if (!(process.platform === 'linux' && process.arch === 'ia32')) {
++ if (!((process.platform === 'linux' || process.platform === 'freebsd') && process.arch === 'ia32')) {
+ expect(fields.upload_file_minidump.length).to.be.greaterThan(0);
+ }
+ }
+@@ -181,7 +181,7 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.e
+
+ // Ensures that passing in crashpadHandlerPID flag for Linx child processes
+ // does not affect child proocess args.
+- ifit(process.platform === 'linux')('ensure linux child process args are not modified', async () => {
++ ifit(process.platform === 'linux' || process.platform === 'freebsd')('ensure linux child process args are not modified', async () => {
+ const { port, waitForCrash } = await startServer();
+ let exitCode: number | null = null;
+ const appPath = path.join(__dirname, 'fixtures', 'apps', 'crash');
+@@ -530,7 +530,7 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.e
+ }
+ }
+
+- const processList = process.platform === 'linux' ? ['main', 'renderer', 'sandboxed-renderer']
++ const processList = (process.platform === 'linux' || process.platform === 'freebsd') ? ['main', 'renderer', 'sandboxed-renderer']
+ : ['main', 'renderer', 'sandboxed-renderer', 'node'];
+ for (const crashingProcess of processList) {
+ describe(`when ${crashingProcess} crashes`, () => {
+@@ -542,7 +542,7 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.e
+ return app.getPath('crashDumps');
+ });
+ let reportsDir = crashesDir;
+- if (process.platform === 'darwin' || process.platform === 'linux') {
++ if (process.platform === 'darwin' || process.platform === 'linux' || process.platform === 'freebsd') {
+ reportsDir = path.join(crashesDir, 'completed');
+ } else if (process.platform === 'win32') {
+ reportsDir = path.join(crashesDir, 'reports');
+@@ -566,7 +566,7 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.e
+ expect(remoteCrashesDir).to.equal(crashesDir);
+
+ let reportsDir = crashesDir;
+- if (process.platform === 'darwin' || process.platform === 'linux') {
++ if (process.platform === 'darwin' || process.platform === 'linux' || process.platform === 'freebsd') {
+ reportsDir = path.join(crashesDir, 'completed');
+ } else if (process.platform === 'win32') {
+ reportsDir = path.join(crashesDir, 'reports');
diff --git a/devel/electron31/files/patch-electron_spec_api-desktop-capturer-spec.ts b/devel/electron31/files/patch-electron_spec_api-desktop-capturer-spec.ts
new file mode 100644
index 000000000000..7001a56b8b90
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-desktop-capturer-spec.ts
@@ -0,0 +1,47 @@
+--- electron/spec/api-desktop-capturer-spec.ts.orig 2023-08-14 18:19:06 UTC
++++ electron/spec/api-desktop-capturer-spec.ts
+@@ -43,7 +43,7 @@ ifdescribe(!process.arch.includes('arm') && process.pl
+ });
+
+ // Linux doesn't return any window sources.
+- ifit(process.platform !== 'linux')('returns an empty display_id for window sources', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('returns an empty display_id for window sources', async () => {
+ const w = new BrowserWindow({ width: 200, height: 200 });
+ await w.loadURL('about:blank');
+
+@@ -55,7 +55,7 @@ ifdescribe(!process.arch.includes('arm') && process.pl
+ }
+ });
+
+- ifit(process.platform !== 'linux')('returns display_ids matching the Screen API', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('returns display_ids matching the Screen API', async () => {
+ const displays = screen.getAllDisplays();
+ const sources = await desktopCapturer.getSources({ types: ['screen'] });
+ expect(sources).to.be.an('array').of.length(displays.length);
+@@ -100,7 +100,7 @@ ifdescribe(!process.arch.includes('arm') && process.pl
+ // TODO(julien.isorce): investigate why |sources| is empty on the linux
+ // bots while it is not on my workstation, as expected, with and without
+ // the --ci parameter.
+- if (process.platform === 'linux' && sources.length === 0) {
++ if ((process.platform === 'linux' || process.platform === 'freebsd') && sources.length === 0) {
+ it.skip('desktopCapturer.getSources returned an empty source list');
+ return;
+ }
+@@ -136,7 +136,7 @@ ifdescribe(!process.arch.includes('arm') && process.pl
+ // TODO(julien.isorce): investigate why |sources| is empty on the linux
+ // bots while it is not on my workstation, as expected, with and without
+ // the --ci parameter.
+- if (process.platform === 'linux' && sources.length === 0) {
++ if ((process.platform === 'linux' || process.platform === 'freebsd') && sources.length === 0) {
+ it.skip('desktopCapturer.getSources returned an empty source list');
+ return;
+ }
+@@ -191,7 +191,7 @@ ifdescribe(!process.arch.includes('arm') && process.pl
+ // TODO(julien.isorce): investigate why |sources| is empty on the linux
+ // bots while it is not on my workstation, as expected, with and without
+ // the --ci parameter.
+- if (process.platform === 'linux' && sources.length === 0) {
++ if ((process.platform === 'linux' || process.platform === 'freebsd') && sources.length === 0) {
+ destroyWindows();
+ it.skip('desktopCapturer.getSources returned an empty source list');
+ return;
diff --git a/devel/electron31/files/patch-electron_spec_api-menu-spec.ts b/devel/electron31/files/patch-electron_spec_api-menu-spec.ts
new file mode 100644
index 000000000000..968e47dfb9c0
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-menu-spec.ts
@@ -0,0 +1,11 @@
+--- electron/spec/api-menu-spec.ts.orig 2023-12-04 18:19:02 UTC
++++ electron/spec/api-menu-spec.ts
+@@ -887,7 +887,7 @@ describe('Menu module', function () {
+ // https://github.com/electron/electron/issues/35724
+ // Maximizing window is enough to trigger the bug
+ // FIXME(dsanders11): Test always passes on CI, even pre-fix
+- ifit(process.platform === 'linux' && !process.env.CI)('does not trigger issue #35724', (done) => {
++ ifit((process.platform === 'linux' || process.platform === 'freebsd') && !process.env.CI)('does not trigger issue #35724', (done) => {
+ const showAndCloseMenu = async () => {
+ await setTimeout(1000);
+ menu.popup({ window: w, x: 50, y: 50 });
diff --git a/devel/electron31/files/patch-electron_spec_api-native-image-spec.ts b/devel/electron31/files/patch-electron_spec_api-native-image-spec.ts
new file mode 100644
index 000000000000..d6f71078550f
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-native-image-spec.ts
@@ -0,0 +1,11 @@
+--- electron/spec/api-native-image-spec.ts.orig 2024-06-24 09:53:23 UTC
++++ electron/spec/api-native-image-spec.ts
+@@ -425,7 +425,7 @@ describe('nativeImage module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('createThumbnailFromPath(path, size)', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd')('createThumbnailFromPath(path, size)', () => {
+ useRemoteContext({ webPreferences: { contextIsolation: false, nodeIntegration: true } });
+
+ it('throws when invalid size is passed', async () => {
diff --git a/devel/electron31/files/patch-electron_spec_api-net-log-spec.ts b/devel/electron31/files/patch-electron_spec_api-net-log-spec.ts
new file mode 100644
index 000000000000..b20241e2213d
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-net-log-spec.ts
@@ -0,0 +1,29 @@
+--- electron/spec/api-net-log-spec.ts.orig 2023-05-31 14:28:29 UTC
++++ electron/spec/api-net-log-spec.ts
+@@ -118,7 +118,7 @@ describe('netLog module', () => {
+ expect(JSON.parse(dump).events.some((x: any) => x.params && x.params.bytes && Buffer.from(x.params.bytes, 'base64').includes(unique))).to.be.true('uuid present in dump');
+ });
+
+- ifit(process.platform !== 'linux')('should begin and end logging automatically when --log-net-log is passed', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('should begin and end logging automatically when --log-net-log is passed', async () => {
+ const appProcess = ChildProcess.spawn(process.execPath,
+ [appPath], {
+ env: {
+@@ -131,7 +131,7 @@ describe('netLog module', () => {
+ expect(fs.existsSync(dumpFile)).to.be.true('dump file exists');
+ });
+
+- ifit(process.platform !== 'linux')('should begin and end logging automatically when --log-net-log is passed, and behave correctly when .startLogging() and .stopLogging() is called', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('should begin and end logging automatically when --log-net-log is passed, and behave correctly when .startLogging() and .stopLogging() is called', async () => {
+ const appProcess = ChildProcess.spawn(process.execPath,
+ [appPath], {
+ env: {
+@@ -147,7 +147,7 @@ describe('netLog module', () => {
+ expect(fs.existsSync(dumpFileDynamic)).to.be.true('dynamic dump file exists');
+ });
+
+- ifit(process.platform !== 'linux')('should end logging automatically when only .startLogging() is called', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('should end logging automatically when only .startLogging() is called', async () => {
+ const appProcess = ChildProcess.spawn(process.execPath,
+ [appPath], {
+ env: {
diff --git a/devel/electron31/files/patch-electron_spec_api-notification-dbus-spec.ts b/devel/electron31/files/patch-electron_spec_api-notification-dbus-spec.ts
new file mode 100644
index 000000000000..fe6b085a28f6
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-notification-dbus-spec.ts
@@ -0,0 +1,11 @@
+--- electron/spec/api-notification-dbus-spec.ts.orig 2023-10-20 08:29:17 UTC
++++ electron/spec/api-notification-dbus-spec.ts
+@@ -12,7 +12,7 @@ import { app } from 'electron/main';
+ import { ifdescribe } from './lib/spec-helpers';
+ import { promisify } from 'node:util';
+
+-const skip = process.platform !== 'linux' ||
++const skip = (process.platform !== 'linux' && process.platform !== 'freebsd') ||
+ process.arch === 'ia32' ||
+ process.arch.indexOf('arm') === 0 ||
+ !process.env.DBUS_SESSION_BUS_ADDRESS;
diff --git a/devel/electron31/files/patch-electron_spec_api-power-monitor-spec.ts b/devel/electron31/files/patch-electron_spec_api-power-monitor-spec.ts
new file mode 100644
index 000000000000..423afdf5f6d6
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-power-monitor-spec.ts
@@ -0,0 +1,11 @@
+--- electron/spec/api-power-monitor-spec.ts.orig 2024-02-21 16:26:48 UTC
++++ electron/spec/api-power-monitor-spec.ts
+@@ -16,7 +16,7 @@ describe('powerMonitor', () => {
+ describe('powerMonitor', () => {
+ let logindMock: any, dbusMockPowerMonitor: any, getCalls: any, emitSignal: any, reset: any;
+
+- ifdescribe(process.platform === 'linux' && process.env.DBUS_SYSTEM_BUS_ADDRESS != null)('when powerMonitor module is loaded with dbus mock', () => {
++ ifdescribe((process.platform === 'linux' || process.platform === 'freebsd') && process.env.DBUS_SYSTEM_BUS_ADDRESS != null)('when powerMonitor module is loaded with dbus mock', () => {
+ before(async () => {
+ const systemBus = dbus.systemBus();
+ const loginService = systemBus.getService('org.freedesktop.login1');
diff --git a/devel/electron31/files/patch-electron_spec_api-process-spec.ts b/devel/electron31/files/patch-electron_spec_api-process-spec.ts
new file mode 100644
index 000000000000..78bf9846661f
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-process-spec.ts
@@ -0,0 +1,20 @@
+--- electron/spec/api-process-spec.ts.orig 2024-04-16 14:29:17 UTC
++++ electron/spec/api-process-spec.ts
+@@ -42,7 +42,7 @@ describe('process module', () => {
+ it('resolves promise successfully with valid data', async () => {
+ const memoryInfo = await w.webContents.executeJavaScript('process.getProcessMemoryInfo()');
+ expect(memoryInfo).to.be.an('object');
+- if (process.platform === 'linux' || process.platform === 'win32') {
++ if (process.platform === 'linux' || process.platform === 'win32' || process.platform === 'freebsd') {
+ expect(memoryInfo.residentSet).to.be.a('number').greaterThan(0);
+ }
+ expect(memoryInfo.private).to.be.a('number').greaterThan(0);
+@@ -140,7 +140,7 @@ describe('process module', () => {
+ it('resolves promise successfully with valid data', async () => {
+ const memoryInfo = await process.getProcessMemoryInfo();
+ expect(memoryInfo).to.be.an('object');
+- if (process.platform === 'linux' || process.platform === 'win32') {
++ if (process.platform === 'linux' || process.platform === 'win32' || process.platform === 'freebsd') {
+ expect(memoryInfo.residentSet).to.be.a('number').greaterThan(0);
+ }
+ expect(memoryInfo.private).to.be.a('number').greaterThan(0);
diff --git a/devel/electron31/files/patch-electron_spec_api-protocol-spec.ts b/devel/electron31/files/patch-electron_spec_api-protocol-spec.ts
new file mode 100644
index 000000000000..29238b03385b
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-protocol-spec.ts
@@ -0,0 +1,11 @@
+--- electron/spec/api-protocol-spec.ts.orig 2024-04-29 23:06:40 UTC
++++ electron/spec/api-protocol-spec.ts
+@@ -1710,7 +1710,7 @@ describe('protocol module', () => {
+ });
+
+ // TODO(nornagon): this test doesn't pass on Linux currently, investigate.
+- ifit(process.platform !== 'linux')('is fast', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('is fast', async () => {
+ // 128 MB of spaces.
+ const chunk = new Uint8Array(128 * 1024 * 1024);
+ chunk.fill(' '.charCodeAt(0));
diff --git a/devel/electron31/files/patch-electron_spec_api-safe-storage-spec.ts b/devel/electron31/files/patch-electron_spec_api-safe-storage-spec.ts
new file mode 100644
index 000000000000..e491b37ce996
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-safe-storage-spec.ts
@@ -0,0 +1,20 @@
+--- electron/spec/api-safe-storage-spec.ts.orig 2023-08-09 14:05:20 UTC
++++ electron/spec/api-safe-storage-spec.ts
+@@ -26,7 +26,7 @@ describe('safeStorage module', () => {
+
+ describe('safeStorage module', () => {
+ before(() => {
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd') {
+ safeStorage.setUsePlainTextEncryption(true);
+ }
+ });
+@@ -44,7 +44,7 @@ describe('safeStorage module', () => {
+ });
+ });
+
+- ifdescribe(process.platform === 'linux')('SafeStorage.getSelectedStorageBackend()', () => {
++ ifdescribe(process.platform === 'linux' || process.platform === 'freebsd')('SafeStorage.getSelectedStorageBackend()', () => {
+ it('should return a valid backend', () => {
+ expect(safeStorage.getSelectedStorageBackend()).to.equal('basic_text');
+ });
diff --git a/devel/electron31/files/patch-electron_spec_api-screen-spec.ts b/devel/electron31/files/patch-electron_spec_api-screen-spec.ts
new file mode 100644
index 000000000000..ac1c5faafafe
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-screen-spec.ts
@@ -0,0 +1,29 @@
+--- electron/spec/api-screen-spec.ts.orig 2024-07-15 15:22:56 UTC
++++ electron/spec/api-screen-spec.ts
+@@ -94,7 +94,7 @@ describe('screen module', () => {
+
+ const { size } = display!;
+
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd') {
+ expect(size).to.have.property('width').that.is.a('number');
+ expect(size).to.have.property('height').that.is.a('number');
+ } else {
+@@ -108,7 +108,7 @@ describe('screen module', () => {
+
+ const { workAreaSize } = display!;
+
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd') {
+ expect(workAreaSize).to.have.property('width').that.is.a('number');
+ expect(workAreaSize).to.have.property('height').that.is.a('number');
+ } else {
+@@ -124,7 +124,7 @@ describe('screen module', () => {
+ expect(bounds).to.have.property('x').that.is.a('number');
+ expect(bounds).to.have.property('y').that.is.a('number');
+
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd') {
+ expect(bounds).to.have.property('width').that.is.a('number');
+ expect(bounds).to.have.property('height').that.is.a('number');
+ } else {
diff --git a/devel/electron31/files/patch-electron_spec_api-shell-spec.ts b/devel/electron31/files/patch-electron_spec_api-shell-spec.ts
new file mode 100644
index 000000000000..61a222b481bb
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-shell-spec.ts
@@ -0,0 +1,23 @@
+--- electron/spec/api-shell-spec.ts.orig 2023-05-31 14:28:29 UTC
++++ electron/spec/api-shell-spec.ts
+@@ -23,7 +23,7 @@ describe('shell module', () => {
+
+ afterEach(async () => {
+ // reset env vars to prevent side effects
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd') {
+ process.env.DE = envVars.de;
+ process.env.BROWSER = envVars.browser;
+ process.env.DISPLAY = envVars.display;
+@@ -36,6 +36,11 @@ describe('shell module', () => {
+ let requestReceived: Promise<any>;
+ if (process.platform === 'linux') {
+ process.env.BROWSER = '/bin/true';
++ process.env.DE = 'generic';
++ process.env.DISPLAY = '';
++ requestReceived = Promise.resolve();
++ } else if (process.platform === 'freebsd') {
++ process.env.BROWSER = '/usr/bin/true';
+ process.env.DE = 'generic';
+ process.env.DISPLAY = '';
+ requestReceived = Promise.resolve();
diff --git a/devel/electron31/files/patch-electron_spec_api-subframe-spec.ts b/devel/electron31/files/patch-electron_spec_api-subframe-spec.ts
new file mode 100644
index 000000000000..87352017d992
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-subframe-spec.ts
@@ -0,0 +1,11 @@
+--- electron/spec/api-subframe-spec.ts.orig 2023-12-04 18:19:02 UTC
++++ electron/spec/api-subframe-spec.ts
+@@ -215,7 +215,7 @@ describe('renderer nodeIntegrationInSubFrames', () =>
+ });
+
+ // app.getAppMetrics() does not return sandbox information on Linux.
+-ifdescribe(process.platform !== 'linux')('cross-site frame sandboxing', () => {
++ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd')('cross-site frame sandboxing', () => {
+ let server: http.Server;
+ let crossSiteUrl: string;
+ let serverUrl: string;
diff --git a/devel/electron31/files/patch-electron_spec_api-tray-spec.ts b/devel/electron31/files/patch-electron_spec_api-tray-spec.ts
new file mode 100644
index 000000000000..3cd3905614ca
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-tray-spec.ts
@@ -0,0 +1,11 @@
+--- electron/spec/api-tray-spec.ts.orig 2023-12-04 18:19:02 UTC
++++ electron/spec/api-tray-spec.ts
+@@ -128,7 +128,7 @@ describe('tray module', () => {
+ describe('tray.getBounds()', () => {
+ afterEach(() => { tray.destroy(); });
+
+- ifit(process.platform !== 'linux')('returns a bounds object', function () {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('returns a bounds object', function () {
+ const bounds = tray.getBounds();
+ expect(bounds).to.be.an('object').and.to.have.all.keys('x', 'y', 'width', 'height');
+ });
diff --git a/devel/electron31/files/patch-electron_spec_api-utility-process-spec.ts b/devel/electron31/files/patch-electron_spec_api-utility-process-spec.ts
new file mode 100644
index 000000000000..a288c83a0945
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-utility-process-spec.ts
@@ -0,0 +1,20 @@
+--- electron/spec/api-utility-process-spec.ts.orig 2024-06-24 09:53:23 UTC
++++ electron/spec/api-utility-process-spec.ts
+@@ -405,7 +405,7 @@ describe('utilityProcess module', () => {
+ expect(output).to.include(result);
+ });
+
+- ifit(process.platform !== 'linux')('can access exposed main process modules from the utility process', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('can access exposed main process modules from the utility process', async () => {
+ const message = 'Message from utility process';
+ const child = utilityProcess.fork(path.join(fixturesPath, 'expose-main-process-module.js'));
+ await once(child, 'spawn');
+@@ -442,7 +442,7 @@ describe('utilityProcess module', () => {
+ await closeWindow(w);
+ });
+
+- ifit(process.platform === 'linux')('allows executing a setuid binary with child_process', async () => {
++ ifit(process.platform === 'linux' || process.platform === 'freebsd')('allows executing a setuid binary with child_process', async () => {
+ const child = utilityProcess.fork(path.join(fixturesPath, 'suid.js'));
+ await once(child, 'spawn');
+ const [data] = await once(child, 'message');
diff --git a/devel/electron31/files/patch-electron_spec_api-web-frame-main-spec.ts b/devel/electron31/files/patch-electron_spec_api-web-frame-main-spec.ts
new file mode 100644
index 000000000000..f6167c9b5419
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_api-web-frame-main-spec.ts
@@ -0,0 +1,11 @@
+--- electron/spec/api-web-frame-main-spec.ts.orig 2023-05-31 14:28:29 UTC
++++ electron/spec/api-web-frame-main-spec.ts
+@@ -289,7 +289,7 @@ describe('webFrameMain module', () => {
+ });
+
+ // TODO(jkleinsc) fix this flaky test on linux
+- ifit(process.platform !== 'linux')('throws upon accessing properties when disposed', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('throws upon accessing properties when disposed', async () => {
+ await w.loadFile(path.join(subframesPath, 'frame-with-frame-container.html'));
+ const { mainFrame } = w.webContents;
+ w.destroy();
diff --git a/devel/electron31/files/patch-electron_spec_chromium-spec.ts b/devel/electron31/files/patch-electron_spec_chromium-spec.ts
new file mode 100644
index 000000000000..0f59410ec0ef
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_chromium-spec.ts
@@ -0,0 +1,44 @@
+--- electron/spec/chromium-spec.ts.orig 2024-07-15 15:22:56 UTC
++++ electron/spec/chromium-spec.ts
+@@ -471,13 +471,13 @@ describe('command line switches', () => {
+ it('should not set an invalid locale', async () => testLocale('asdfkl', `${currentLocale}|${currentSystemLocale}|${currentPreferredLanguages}`));
+
+ const lcAll = String(process.env.LC_ALL);
+- ifit(process.platform === 'linux')('current process has a valid LC_ALL env', async () => {
++ ifit(process.platform === 'linux' || process.platform === 'freebsd')('current process has a valid LC_ALL env', async () => {
+ // The LC_ALL env should not be set to DOM locale string.
+ expect(lcAll).to.not.equal(app.getLocale());
+ });
+- ifit(process.platform === 'linux')('should not change LC_ALL', async () => testLocale('fr', lcAll, true));
+- ifit(process.platform === 'linux')('should not change LC_ALL when setting invalid locale', async () => testLocale('asdfkl', lcAll, true));
+- ifit(process.platform === 'linux')('should not change LC_ALL when --lang is not set', async () => testLocale('', lcAll, true));
++ ifit(process.platform === 'linux' || process.platform === 'freebsd')('should not change LC_ALL', async () => testLocale('fr', lcAll, true));
++ ifit(process.platform === 'linux' || process.platform === 'freebsd')('should not change LC_ALL when setting invalid locale', async () => testLocale('asdfkl', lcAll, true));
++ ifit(process.platform === 'linux' || process.platform === 'freebsd')('should not change LC_ALL when --lang is not set', async () => testLocale('', lcAll, true));
+ });
+
+ describe('--remote-debugging-pipe switch', () => {
+@@ -2808,12 +2808,12 @@ describe('font fallback', () => {
+ expect(fonts[0].familyName).to.equal('Arial');
+ } else if (process.platform === 'darwin') {
+ expect(fonts[0].familyName).to.equal('Helvetica');
+- } else if (process.platform === 'linux') {
++ } else if (process.platform === 'linux' || process.platform === 'freebsd') {
+ expect(fonts[0].familyName).to.equal('DejaVu Sans');
+ } // I think this depends on the distro? We don't specify a default.
+ });
+
+- ifit(process.platform !== 'linux')('should fall back to Japanese font for sans-serif Japanese script', async function () {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('should fall back to Japanese font for sans-serif Japanese script', async function () {
+ const html = `
+ <html lang="ja-JP">
+ <head>
+@@ -3207,7 +3207,7 @@ describe('navigator.clipboard.write', () => {
+ });
+ });
+
+-ifdescribe((process.platform !== 'linux' || app.isUnityRunning()))('navigator.setAppBadge/clearAppBadge', () => {
++ifdescribe(((process.platform !== 'linux' && process.platform !== 'freebsd') || app.isUnityRunning()))('navigator.setAppBadge/clearAppBadge', () => {
+ let w: BrowserWindow;
+
+ const expectedBadgeCount = 42;
diff --git a/devel/electron31/files/patch-electron_spec_crash-spec.ts b/devel/electron31/files/patch-electron_spec_crash-spec.ts
new file mode 100644
index 000000000000..50e0b5e82e73
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_crash-spec.ts
@@ -0,0 +1,11 @@
+--- electron/spec/crash-spec.ts.orig 2024-03-13 18:15:29 UTC
++++ electron/spec/crash-spec.ts
+@@ -45,7 +45,7 @@ const shouldRunCase = (crashCase: string) => {
+ if (process.platform === 'win32') {
+ return process.arch !== 'ia32';
+ } else {
+- return (process.platform !== 'linux' || (process.arch !== 'arm64' && process.arch !== 'arm'));
++ return ((process.platform !== 'linux' && process.platform !== 'freebsd') || (process.arch !== 'arm64' && process.arch !== 'arm'));
+ }
+ }
+ default: {
diff --git a/devel/electron31/files/patch-electron_spec_fixtures_api_safe-storage_decrypt-app_main.js b/devel/electron31/files/patch-electron_spec_fixtures_api_safe-storage_decrypt-app_main.js
new file mode 100644
index 000000000000..12b51534b625
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_fixtures_api_safe-storage_decrypt-app_main.js
@@ -0,0 +1,11 @@
+--- electron/spec/fixtures/api/safe-storage/decrypt-app/main.js.orig 2023-08-12 11:44:47 UTC
++++ electron/spec/fixtures/api/safe-storage/decrypt-app/main.js
+@@ -6,7 +6,7 @@ const pathToEncryptedString = path.resolve(__dirname,
+ const readFile = fs.readFile;
+
+ app.whenReady().then(async () => {
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd') {
+ safeStorage.setUsePlainTextEncryption(true);
+ }
+ const encryptedString = await readFile(pathToEncryptedString);
diff --git a/devel/electron31/files/patch-electron_spec_fixtures_api_safe-storage_encrypt-app_main.js b/devel/electron31/files/patch-electron_spec_fixtures_api_safe-storage_encrypt-app_main.js
new file mode 100644
index 000000000000..119940f8b89f
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_fixtures_api_safe-storage_encrypt-app_main.js
@@ -0,0 +1,11 @@
+--- electron/spec/fixtures/api/safe-storage/encrypt-app/main.js.orig 2023-08-12 11:45:22 UTC
++++ electron/spec/fixtures/api/safe-storage/encrypt-app/main.js
+@@ -6,7 +6,7 @@ const pathToEncryptedString = path.resolve(__dirname,
+ const writeFile = fs.writeFile;
+
+ app.whenReady().then(async () => {
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd') {
+ safeStorage.setUsePlainTextEncryption(true);
+ }
+ const encrypted = safeStorage.encryptString('plaintext');
diff --git a/devel/electron31/files/patch-electron_spec_fixtures_crash-cases_safe-storage_index.js b/devel/electron31/files/patch-electron_spec_fixtures_crash-cases_safe-storage_index.js
new file mode 100644
index 000000000000..a15503e9df07
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_fixtures_crash-cases_safe-storage_index.js
@@ -0,0 +1,11 @@
+--- electron/spec/fixtures/crash-cases/safe-storage/index.js.orig 2022-05-18 15:31:32 UTC
++++ electron/spec/fixtures/crash-cases/safe-storage/index.js
+@@ -21,7 +21,7 @@ const { expect } = require('chai');
+ await app.whenReady();
+ // isEncryptionAvailable() will always return false on CI due to a mocked
+ // dbus as mentioned above.
+- expect(safeStorage.isEncryptionAvailable()).to.equal(process.platform !== 'linux');
++ expect(safeStorage.isEncryptionAvailable()).to.equal(process.platform !== 'linux' && process.platform !== 'freebsd');
+ if (safeStorage.isEncryptionAvailable()) {
+ const plaintext = 'plaintext';
+ const ciphertext = safeStorage.encryptString(plaintext);
diff --git a/devel/electron31/files/patch-electron_spec_fixtures_native-addon_uv-dlopen_index.js b/devel/electron31/files/patch-electron_spec_fixtures_native-addon_uv-dlopen_index.js
new file mode 100644
index 000000000000..eb0f4828be47
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_fixtures_native-addon_uv-dlopen_index.js
@@ -0,0 +1,11 @@
+--- electron/spec/fixtures/native-addon/uv-dlopen/index.js.orig 2021-01-25 12:27:55 UTC
++++ electron/spec/fixtures/native-addon/uv-dlopen/index.js
+@@ -2,7 +2,7 @@ const testLoadLibrary = require('./build/Release/test_
+
+ const lib = (() => {
+ switch (process.platform) {
+- case 'linux':
++ case 'linux': case 'freebsd':
+ return `${__dirname}/build/Release/foo.so`;
+ case 'darwin':
+ return `${__dirname}/build/Release/foo.dylib`;
diff --git a/devel/electron31/files/patch-electron_spec_node-spec.ts b/devel/electron31/files/patch-electron_spec_node-spec.ts
new file mode 100644
index 000000000000..df4d4f4e7a7a
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_node-spec.ts
@@ -0,0 +1,11 @@
+--- electron/spec/node-spec.ts.orig 2024-05-15 08:18:48 UTC
++++ electron/spec/node-spec.ts
+@@ -145,7 +145,7 @@ describe('node feature', () => {
+ });
+
+ describe('child_process.exec', () => {
+- ifit(process.platform === 'linux')('allows executing a setuid binary from non-sandboxed renderer', async () => {
++ ifit(process.platform === 'linux' || process.platform === 'freebsd')('allows executing a setuid binary from non-sandboxed renderer', async () => {
+ // Chrome uses prctl(2) to set the NO_NEW_PRIVILEGES flag on Linux (see
+ // https://github.com/torvalds/linux/blob/40fde647cc/Documentation/userspace-api/no_new_privs.rst).
+ // We disable this for unsandboxed processes, which the renderer tests
diff --git a/devel/electron31/files/patch-electron_spec_version-bump-spec.ts b/devel/electron31/files/patch-electron_spec_version-bump-spec.ts
new file mode 100644
index 000000000000..b21840512b7c
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_version-bump-spec.ts
@@ -0,0 +1,11 @@
+--- electron/spec/version-bump-spec.ts.orig 2023-01-24 16:58:16 UTC
++++ electron/spec/version-bump-spec.ts
+@@ -92,7 +92,7 @@ describe('version-bumper', () => {
+
+ // On macOS Circle CI we don't have a real git environment due to running
+ // gclient sync on a linux machine. These tests therefore don't run as expected.
+- ifdescribe(!(process.platform === 'linux' && process.arch.indexOf('arm') === 0) && process.platform !== 'darwin')('nextVersion', () => {
++ ifdescribe(!((process.platform === 'linux' || process.platform === 'freebsd') && process.arch.indexOf('arm') === 0) && process.platform !== 'darwin')('nextVersion', () => {
+ describe('bump versions', () => {
+ const nightlyPattern = /[0-9.]*(-nightly.(\d{4})(\d{2})(\d{2}))$/g;
+ const betaPattern = /[0-9.]*(-beta[0-9.]*)/g;
diff --git a/devel/electron31/files/patch-electron_spec_visibility-state-spec.ts b/devel/electron31/files/patch-electron_spec_visibility-state-spec.ts
new file mode 100644
index 000000000000..255bb5bb99dd
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_visibility-state-spec.ts
@@ -0,0 +1,11 @@
+--- electron/spec/visibility-state-spec.ts.orig 2024-04-16 14:29:17 UTC
++++ electron/spec/visibility-state-spec.ts
+@@ -10,7 +10,7 @@ import { setTimeout } from 'node:timers/promises';
+
+ // visibilityState specs pass on linux with a real window manager but on CI
+ // the environment does not let these specs pass
+-ifdescribe(process.platform !== 'linux')('document.visibilityState', () => {
++ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd')('document.visibilityState', () => {
+ let w: BaseWindow & {webContents: WebContents};
+
+ afterEach(() => {
diff --git a/devel/electron31/files/patch-electron_spec_webview-spec.ts b/devel/electron31/files/patch-electron_spec_webview-spec.ts
new file mode 100644
index 000000000000..c43813ee2057
--- /dev/null
+++ b/devel/electron31/files/patch-electron_spec_webview-spec.ts
@@ -0,0 +1,11 @@
+--- electron/spec/webview-spec.ts.orig 2024-04-16 14:29:17 UTC
++++ electron/spec/webview-spec.ts
+@@ -556,7 +556,7 @@ describe('<webview> tag', function () {
+ });
+
+ // FIXME(zcbenz): Fullscreen events do not work on Linux.
+- ifit(process.platform !== 'linux')('exiting fullscreen should unfullscreen window', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd')('exiting fullscreen should unfullscreen window', async () => {
+ const [w, webview] = await loadWebViewWindow();
+ const enterFullScreen = once(w, 'enter-full-screen');
+ await webview.executeJavaScript('document.getElementById("div").requestFullscreen()', true);
diff --git a/devel/electron31/files/patch-extensions_browser_api_api__browser__context__keyed__service__factories.cc b/devel/electron31/files/patch-extensions_browser_api_api__browser__context__keyed__service__factories.cc
new file mode 100644
index 000000000000..90212c6a41db
--- /dev/null
+++ b/devel/electron31/files/patch-extensions_browser_api_api__browser__context__keyed__service__factories.cc
@@ -0,0 +1,11 @@
+--- extensions/browser/api/api_browser_context_keyed_service_factories.cc.orig 2024-04-15 20:33:59 UTC
++++ extensions/browser/api/api_browser_context_keyed_service_factories.cc
+@@ -102,7 +102,7 @@ void EnsureApiBrowserContextKeyedServiceFactoriesBuilt
+ #endif
+ MessageService::GetFactoryInstance();
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ NetworkingPrivateEventRouterFactory::GetInstance();
+ #endif
+ OffscreenDocumentManager::GetFactory();
diff --git a/devel/electron31/files/patch-extensions_browser_api_management_management__api.cc b/devel/electron31/files/patch-extensions_browser_api_management_management__api.cc
new file mode 100644
index 000000000000..48467ffa24fa
--- /dev/null
+++ b/devel/electron31/files/patch-extensions_browser_api_management_management__api.cc
@@ -0,0 +1,11 @@
+--- extensions/browser/api/management/management_api.cc.orig 2024-04-15 20:33:59 UTC
++++ extensions/browser/api/management/management_api.cc
+@@ -280,7 +280,7 @@ bool PlatformSupportsApprovalFlowForExtensions() {
+ #if BUILDFLAG(IS_CHROMEOS)
+ // ChromeOS devices have this feature already shipped.
+ return true;
+-#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ return base::FeatureList::IsEnabled(
+ supervised_user::kEnableExtensionsPermissionsForSupervisedUsersOnDesktop);
+ #else
diff --git a/devel/electron31/files/patch-extensions_browser_api_messaging_message__service.cc b/devel/electron31/files/patch-extensions_browser_api_messaging_message__service.cc
new file mode 100644
index 000000000000..5bfa682263e5
--- /dev/null
+++ b/devel/electron31/files/patch-extensions_browser_api_messaging_message__service.cc
@@ -0,0 +1,20 @@
+--- extensions/browser/api/messaging/message_service.cc.orig 2024-04-15 20:33:59 UTC
++++ extensions/browser/api/messaging/message_service.cc
+@@ -71,7 +71,7 @@ const char kReceivingEndDoesntExistError[] =
+ const char kReceivingEndDoesntExistError[] =
+ "Could not establish connection. Receiving end does not exist.";
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kMissingPermissionError[] =
+ "Access to native messaging requires nativeMessaging permission.";
+ const char kProhibitedByPoliciesError[] =
+@@ -541,7 +541,7 @@ void MessageService::OpenChannelToNativeAppImpl(
+ return;
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool has_permission = extension->permissions_data()->HasAPIPermission(
+ mojom::APIPermissionID::kNativeMessaging);
+ if (!has_permission) {
diff --git a/devel/electron31/files/patch-extensions_browser_api_networking__private_networking__private__delegate__factory.cc b/devel/electron31/files/patch-extensions_browser_api_networking__private_networking__private__delegate__factory.cc
new file mode 100644
index 000000000000..18aba68d624b
--- /dev/null
+++ b/devel/electron31/files/patch-extensions_browser_api_networking__private_networking__private__delegate__factory.cc
@@ -0,0 +1,20 @@
+--- extensions/browser/api/networking_private/networking_private_delegate_factory.cc.orig 2023-10-19 19:58:24 UTC
++++ extensions/browser/api/networking_private/networking_private_delegate_factory.cc
+@@ -14,7 +14,7 @@
+ #include "extensions/browser/api/networking_private/networking_private_chromeos.h"
+ #elif BUILDFLAG(IS_CHROMEOS_LACROS)
+ #include "extensions/browser/api/networking_private/networking_private_lacros.h"
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "extensions/browser/api/networking_private/networking_private_linux.h"
+ #elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
+ #include "components/wifi/wifi_service.h"
+@@ -67,7 +67,7 @@ NetworkingPrivateDelegateFactory::BuildServiceInstance
+ delegate = std::make_unique<NetworkingPrivateChromeOS>(browser_context);
+ #elif BUILDFLAG(IS_CHROMEOS_LACROS)
+ delegate = std::make_unique<NetworkingPrivateLacros>(browser_context);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ delegate = std::make_unique<NetworkingPrivateLinux>();
+ #elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
+ std::unique_ptr<wifi::WiFiService> wifi_service(wifi::WiFiService::Create());
diff --git a/devel/electron31/files/patch-extensions_common_api___permission__features.json b/devel/electron31/files/patch-extensions_common_api___permission__features.json
new file mode 100644
index 000000000000..51f6457cb14c
--- /dev/null
+++ b/devel/electron31/files/patch-extensions_common_api___permission__features.json
@@ -0,0 +1,29 @@
+--- extensions/common/api/_permission_features.json.orig 2023-11-29 21:40:03 UTC
++++ extensions/common/api/_permission_features.json
+@@ -138,7 +138,7 @@
+ {
+ "channel": "stable",
+ "extension_types": ["platform_app"],
+- "platforms": ["chromeos", "lacros", "win", "mac", "linux"],
++ "platforms": ["chromeos", "lacros", "win", "mac", "linux", "openbsd", "freebsd"],
+ "allowlist": [
+ "1C93BD3CF875F4A73C0B2A163BB8FBDA8B8B3D80", // http://crbug.com/387169
+ "A3BC37E2148AC4E99BE4B16AF9D42DD1E592BBBE", // http://crbug.com/387169
+@@ -432,7 +432,7 @@
+ }, {
+ "channel": "stable",
+ "extension_types": ["extension", "legacy_packaged_app", "platform_app"],
+- "platforms": ["chromeos", "mac", "win", "linux", "fuchsia"],
++ "platforms": ["chromeos", "mac", "win", "linux", "fuchsia", "openbsd", "freebsd"],
+ "allowlist": [
+ "0DE0F05680A4A056BCEC864ED8DDA84296F82B40", // http://crbug.com/434651
+ "1C93BD3CF875F4A73C0B2A163BB8FBDA8B8B3D80", // http://crbug.com/293683
+@@ -476,7 +476,7 @@
+ "networkingPrivate": {
+ "channel": "stable",
+ "extension_types": ["extension", "legacy_packaged_app", "platform_app"],
+- "platforms": ["chromeos", "lacros", "mac", "win", "linux", "fuchsia"],
++ "platforms": ["chromeos", "lacros", "mac", "win", "linux", "fuchsia", "openbsd", "freebsd"],
+ "allowlist": [
+ // DO NOT ADD ANY MORE ENTRIES HERE.
+ // networkingPrivate is being migrated to networking.onc.
diff --git a/devel/electron31/files/patch-extensions_common_api_runtime.json b/devel/electron31/files/patch-extensions_common_api_runtime.json
new file mode 100644
index 000000000000..a62b91540fcb
--- /dev/null
+++ b/devel/electron31/files/patch-extensions_common_api_runtime.json
@@ -0,0 +1,10 @@
+--- extensions/common/api/runtime.json.orig 2024-02-21 00:20:46 UTC
++++ extensions/common/api/runtime.json
+@@ -86,6 +86,7 @@
+ {"name": "cros", "description": "Specifies the Chrome operating system."},
+ {"name": "linux", "description": "Specifies the Linux operating system."},
+ {"name": "openbsd", "description": "Specifies the OpenBSD operating system."},
++ {"name": "freebsd", "description": "Specifies the FreeBSD operating system."},
+ {"name": "fuchsia", "description": "Specifies the Fuchsia operating system."}
+ ]
+ },
diff --git a/devel/electron31/files/patch-extensions_common_command.cc b/devel/electron31/files/patch-extensions_common_command.cc
new file mode 100644
index 000000000000..0b52b639abbc
--- /dev/null
+++ b/devel/electron31/files/patch-extensions_common_command.cc
@@ -0,0 +1,11 @@
+--- extensions/common/command.cc.orig 2024-06-18 21:43:33 UTC
++++ extensions/common/command.cc
+@@ -283,7 +283,7 @@ std::string Command::CommandPlatform() {
+ return values::kKeybindingPlatformMac;
+ #elif BUILDFLAG(IS_CHROMEOS)
+ return values::kKeybindingPlatformChromeOs;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return values::kKeybindingPlatformLinux;
+ #elif BUILDFLAG(IS_FUCHSIA)
+ // TODO(crbug.com/40220501): Change this once we decide what string should be
diff --git a/devel/electron31/files/patch-extensions_common_features_feature.cc b/devel/electron31/files/patch-extensions_common_features_feature.cc
new file mode 100644
index 000000000000..b729c127c3cd
--- /dev/null
+++ b/devel/electron31/files/patch-extensions_common_features_feature.cc
@@ -0,0 +1,11 @@
+--- extensions/common/features/feature.cc.orig 2023-10-19 19:58:24 UTC
++++ extensions/common/features/feature.cc
+@@ -34,6 +34,8 @@ Feature::Platform Feature::GetCurrentPlatform() {
+ return WIN_PLATFORM;
+ #elif BUILDFLAG(IS_FUCHSIA)
+ return FUCHSIA_PLATFORM;
++#elif BUILDFLAG(IS_BSD)
++ return LINUX_PLATFORM;
+ #else
+ return UNSPECIFIED_PLATFORM;
+ #endif
diff --git a/devel/electron31/files/patch-extensions_renderer_bindings_api__binding__util.cc b/devel/electron31/files/patch-extensions_renderer_bindings_api__binding__util.cc
new file mode 100644
index 000000000000..80e3d05fea23
--- /dev/null
+++ b/devel/electron31/files/patch-extensions_renderer_bindings_api__binding__util.cc
@@ -0,0 +1,11 @@
+--- extensions/renderer/bindings/api_binding_util.cc.orig 2022-02-28 16:54:41 UTC
++++ extensions/renderer/bindings/api_binding_util.cc
+@@ -132,7 +132,7 @@ std::string GetPlatformString() {
+ return "lacros";
+ #elif BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_CHROMEOS_LACROS)
+ return "chromeos";
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return "linux";
+ #elif BUILDFLAG(IS_MAC)
+ return "mac";
diff --git a/devel/electron31/files/patch-extensions_renderer_bindings_argument__spec.cc b/devel/electron31/files/patch-extensions_renderer_bindings_argument__spec.cc
new file mode 100644
index 000000000000..13961c2dfbe9
--- /dev/null
+++ b/devel/electron31/files/patch-extensions_renderer_bindings_argument__spec.cc
@@ -0,0 +1,11 @@
+--- extensions/renderer/bindings/argument_spec.cc.orig 2022-11-30 08:12:58 UTC
++++ extensions/renderer/bindings/argument_spec.cc
+@@ -18,6 +18,8 @@
+ #include "gin/data_object_builder.h"
+ #include "gin/dictionary.h"
+
++#include <cmath>
++
+ namespace extensions {
+
+ namespace {
diff --git a/devel/electron31/files/patch-extensions_shell_app_shell__main__delegate.cc b/devel/electron31/files/patch-extensions_shell_app_shell__main__delegate.cc
new file mode 100644
index 000000000000..e0d7853d636b
--- /dev/null
+++ b/devel/electron31/files/patch-extensions_shell_app_shell__main__delegate.cc
@@ -0,0 +1,20 @@
+--- extensions/shell/app/shell_main_delegate.cc.orig 2024-04-15 20:33:59 UTC
++++ extensions/shell/app/shell_main_delegate.cc
+@@ -43,7 +43,7 @@
+ #if BUILDFLAG(IS_WIN)
+ #include "base/base_paths_win.h"
+ #include "base/process/process_info.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/nix/xdg_util.h"
+ #elif BUILDFLAG(IS_MAC)
+ #include "base/base_paths_mac.h"
+@@ -63,7 +63,7 @@ base::FilePath GetDataPath() {
+ }
+
+ base::FilePath data_dir;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
+ data_dir = base::nix::GetXDGDirectory(
+ env.get(), base::nix::kXdgConfigHomeEnvVar, base::nix::kDotConfigDir);
diff --git a/devel/electron31/files/patch-extensions_shell_browser_api_runtime_shell__runtime__api__delegate.cc b/devel/electron31/files/patch-extensions_shell_browser_api_runtime_shell__runtime__api__delegate.cc
new file mode 100644
index 000000000000..7dbbe632990e
--- /dev/null
+++ b/devel/electron31/files/patch-extensions_shell_browser_api_runtime_shell__runtime__api__delegate.cc
@@ -0,0 +1,11 @@
+--- extensions/shell/browser/api/runtime/shell_runtime_api_delegate.cc.orig 2023-05-25 00:41:56 UTC
++++ extensions/shell/browser/api/runtime/shell_runtime_api_delegate.cc
+@@ -44,7 +44,7 @@ void ShellRuntimeAPIDelegate::OpenURL(const GURL& unin
+ bool ShellRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) {
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ info->os = api::runtime::PlatformOs::kCros;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ info->os = api::runtime::PlatformOs::kLinux;
+ #endif
+ return true;
diff --git a/devel/electron31/files/patch-extensions_shell_browser_shell__browser__main__parts.cc b/devel/electron31/files/patch-extensions_shell_browser_shell__browser__main__parts.cc
new file mode 100644
index 000000000000..77da3a83720f
--- /dev/null
+++ b/devel/electron31/files/patch-extensions_shell_browser_shell__browser__main__parts.cc
@@ -0,0 +1,11 @@
+--- extensions/shell/browser/shell_browser_main_parts.cc.orig 2022-09-24 10:57:32 UTC
++++ extensions/shell/browser/shell_browser_main_parts.cc
+@@ -150,7 +150,7 @@ void ShellBrowserMainParts::PostCreateMainMessageLoop(
+ switches::kAppShellAllowRoaming)) {
+ network_controller_->SetCellularAllowRoaming(true);
+ }
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // app_shell doesn't need GTK, so the fake input method context can work.
+ // See crbug.com/381852 and revision fb69f142.
+ // TODO(michaelpg): Verify this works for target environments.
diff --git a/devel/electron31/files/patch-extensions_shell_browser_shell__extensions__api__client.cc b/devel/electron31/files/patch-extensions_shell_browser_shell__extensions__api__client.cc
new file mode 100644
index 000000000000..59d2980f8d14
--- /dev/null
+++ b/devel/electron31/files/patch-extensions_shell_browser_shell__extensions__api__client.cc
@@ -0,0 +1,11 @@
+--- extensions/shell/browser/shell_extensions_api_client.cc.orig 2024-06-18 21:43:33 UTC
++++ extensions/shell/browser/shell_extensions_api_client.cc
+@@ -58,7 +58,7 @@ ShellExtensionsAPIClient::CreateDisplayInfoProvider()
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ FileSystemDelegate* ShellExtensionsAPIClient::GetFileSystemDelegate() {
+ if (!file_system_delegate_)
+ file_system_delegate_ = std::make_unique<ShellFileSystemDelegate>();
diff --git a/devel/electron31/files/patch-extensions_shell_browser_shell__extensions__api__client.h b/devel/electron31/files/patch-extensions_shell_browser_shell__extensions__api__client.h
new file mode 100644
index 000000000000..193b483076f2
--- /dev/null
+++ b/devel/electron31/files/patch-extensions_shell_browser_shell__extensions__api__client.h
@@ -0,0 +1,20 @@
+--- extensions/shell/browser/shell_extensions_api_client.h.orig 2024-06-18 21:43:33 UTC
++++ extensions/shell/browser/shell_extensions_api_client.h
+@@ -36,7 +36,7 @@ class ShellExtensionsAPIClient : public ExtensionsAPIC
+ const override;
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ FileSystemDelegate* GetFileSystemDelegate() override;
+ #endif
+ MessagingDelegate* GetMessagingDelegate() override;
+@@ -45,7 +45,7 @@ class ShellExtensionsAPIClient : public ExtensionsAPIC
+ private:
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<FileSystemDelegate> file_system_delegate_;
+ #endif
+ std::unique_ptr<MessagingDelegate> messaging_delegate_;
diff --git a/devel/electron31/files/patch-google__apis_gcm_engine_heartbeat__manager.cc b/devel/electron31/files/patch-google__apis_gcm_engine_heartbeat__manager.cc
new file mode 100644
index 000000000000..49299d817e4c
--- /dev/null
+++ b/devel/electron31/files/patch-google__apis_gcm_engine_heartbeat__manager.cc
@@ -0,0 +1,29 @@
+--- google_apis/gcm/engine/heartbeat_manager.cc.orig 2023-05-25 00:41:56 UTC
++++ google_apis/gcm/engine/heartbeat_manager.cc
+@@ -32,7 +32,7 @@ const int kMinClientHeartbeatIntervalMs = 1000 * 30;
+ // Minimum time spent sleeping before we force a new heartbeat.
+ const int kMinSuspendTimeMs = 1000 * 10; // 10 seconds.
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // The period at which to check if the heartbeat time has passed. Used to
+ // protect against platforms where the timer is delayed by the system being
+ // suspended. Only needed on linux because the other OSes provide a standard
+@@ -191,7 +191,7 @@ void HeartbeatManager::RestartTimer() {
+ base::BindRepeating(&HeartbeatManager::OnHeartbeatTriggered,
+ weak_ptr_factory_.GetWeakPtr()));
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Windows, Mac, Android, iOS, and Chrome OS all provide a way to be notified
+ // when the system is suspending or resuming. The only one that does not is
+ // Linux so we need to poll to check for missed heartbeats.
+@@ -214,7 +214,7 @@ void HeartbeatManager::CheckForMissedHeartbeat() {
+ return;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Otherwise check again later.
+ io_task_runner_->PostDelayedTask(
+ FROM_HERE,
diff --git a/devel/electron31/files/patch-gpu_command__buffer_common_gpu__memory__buffer__support.cc b/devel/electron31/files/patch-gpu_command__buffer_common_gpu__memory__buffer__support.cc
new file mode 100644
index 000000000000..9044572b8ee5
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_command__buffer_common_gpu__memory__buffer__support.cc
@@ -0,0 +1,20 @@
+--- gpu/command_buffer/common/gpu_memory_buffer_support.cc.orig 2024-04-15 20:33:59 UTC
++++ gpu/command_buffer/common/gpu_memory_buffer_support.cc
+@@ -182,7 +182,7 @@ uint32_t GetPlatformSpecificTextureTarget() {
+ #if BUILDFLAG(IS_MAC)
+ return macos_specific_texture_target;
+ #elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ return GL_TEXTURE_EXTERNAL_OES;
+ #elif BUILDFLAG(IS_IOS)
+ return GL_TEXTURE_2D;
+@@ -209,7 +209,7 @@ GPU_EXPORT bool NativeBufferNeedsPlatformSpecificTextu
+ gfx::BufferFormat format,
+ gfx::BufferPlane plane) {
+ #if BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Always use GL_TEXTURE_2D as the target for RGB textures.
+ // https://crbug.com/916728
+ if (format == gfx::BufferFormat::R_8 || format == gfx::BufferFormat::RG_88 ||
diff --git a/devel/electron31/files/patch-gpu_command__buffer_service_dawn__context__provider.cc b/devel/electron31/files/patch-gpu_command__buffer_service_dawn__context__provider.cc
new file mode 100644
index 000000000000..b22323001759
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_command__buffer_service_dawn__context__provider.cc
@@ -0,0 +1,11 @@
+--- gpu/command_buffer/service/dawn_context_provider.cc.orig 2024-06-18 21:43:33 UTC
++++ gpu/command_buffer/service/dawn_context_provider.cc
+@@ -163,7 +163,7 @@ wgpu::BackendType DawnContextProvider::GetDefaultBacke
+ return base::FeatureList::IsEnabled(features::kSkiaGraphiteDawnUseD3D12)
+ ? wgpu::BackendType::D3D12
+ : wgpu::BackendType::D3D11;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ return wgpu::BackendType::Vulkan;
+ #elif BUILDFLAG(IS_APPLE)
+ return wgpu::BackendType::Metal;
diff --git a/devel/electron31/files/patch-gpu_command__buffer_service_gles2__cmd__decoder.cc b/devel/electron31/files/patch-gpu_command__buffer_service_gles2__cmd__decoder.cc
new file mode 100644
index 000000000000..c35f637223ee
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_command__buffer_service_gles2__cmd__decoder.cc
@@ -0,0 +1,11 @@
+--- gpu/command_buffer/service/gles2_cmd_decoder.cc.orig 2024-06-18 21:43:33 UTC
++++ gpu/command_buffer/service/gles2_cmd_decoder.cc
+@@ -2955,7 +2955,7 @@ GLES2Decoder* GLES2Decoder::Create(
+ }
+
+ // Allow linux to run fuzzers.
+-#if BUILDFLAG(ENABLE_VALIDATING_COMMAND_DECODER) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(ENABLE_VALIDATING_COMMAND_DECODER) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return new GLES2DecoderImpl(client, command_buffer_service, outputter, group);
+ #else
+ LOG(FATAL) << "Validating command decoder is not supported.";
diff --git a/devel/electron31/files/patch-gpu_command__buffer_service_shared__image_angle__vulkan__image__backing__factory.cc b/devel/electron31/files/patch-gpu_command__buffer_service_shared__image_angle__vulkan__image__backing__factory.cc
new file mode 100644
index 000000000000..4a3cddd161e8
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_command__buffer_service_shared__image_angle__vulkan__image__backing__factory.cc
@@ -0,0 +1,11 @@
+--- gpu/command_buffer/service/shared_image/angle_vulkan_image_backing_factory.cc.orig 2024-02-21 00:20:47 UTC
++++ gpu/command_buffer/service/shared_image/angle_vulkan_image_backing_factory.cc
+@@ -21,7 +21,7 @@ constexpr uint32_t kSupportedUsage =
+ // TODO(penghuang): verify the scanout is the right usage for video playback.
+ // crbug.com/1280798
+ constexpr uint32_t kSupportedUsage =
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ SHARED_IMAGE_USAGE_SCANOUT |
+ #endif
+ SHARED_IMAGE_USAGE_GLES2_READ | SHARED_IMAGE_USAGE_GLES2_WRITE |
diff --git a/devel/electron31/files/patch-gpu_command__buffer_service_shared__image_external__vk__image__backing.cc b/devel/electron31/files/patch-gpu_command__buffer_service_shared__image_external__vk__image__backing.cc
new file mode 100644
index 000000000000..5bbfaea41fb6
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_command__buffer_service_shared__image_external__vk__image__backing.cc
@@ -0,0 +1,20 @@
+--- gpu/command_buffer/service/shared_image/external_vk_image_backing.cc.orig 2024-06-18 21:43:33 UTC
++++ gpu/command_buffer/service/shared_image/external_vk_image_backing.cc
+@@ -50,7 +50,7 @@
+ #include "ui/gl/gl_version_info.h"
+ #include "ui/gl/scoped_binders.h"
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_DAWN)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(USE_DAWN)
+ #include "gpu/command_buffer/service/shared_image/external_vk_image_dawn_representation.h"
+ #if BUILDFLAG(DAWN_ENABLE_BACKEND_OPENGLES)
+ #include "gpu/command_buffer/service/shared_image/dawn_gl_texture_representation.h"
+@@ -695,7 +695,7 @@ std::unique_ptr<DawnImageRepresentation> ExternalVkIma
+ wgpu::BackendType backend_type,
+ std::vector<wgpu::TextureFormat> view_formats,
+ scoped_refptr<SharedContextState> context_state) {
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_DAWN)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(USE_DAWN)
+ auto wgpu_format = ToDawnFormat(format());
+
+ if (wgpu_format == wgpu::TextureFormat::Undefined) {
diff --git a/devel/electron31/files/patch-gpu_command__buffer_service_shared__image_external__vk__image__backing__factory.cc b/devel/electron31/files/patch-gpu_command__buffer_service_shared__image_external__vk__image__backing__factory.cc
new file mode 100644
index 000000000000..dca2165618c7
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_command__buffer_service_shared__image_external__vk__image__backing__factory.cc
@@ -0,0 +1,11 @@
+--- gpu/command_buffer/service/shared_image/external_vk_image_backing_factory.cc.orig 2024-04-15 20:33:59 UTC
++++ gpu/command_buffer/service/shared_image/external_vk_image_backing_factory.cc
+@@ -147,7 +147,7 @@ constexpr uint32_t kSupportedUsage =
+ } // namespace
+
+ constexpr uint32_t kSupportedUsage =
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_DAWN)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(USE_DAWN)
+ SHARED_IMAGE_USAGE_WEBGPU_READ | SHARED_IMAGE_USAGE_WEBGPU_WRITE |
+ SHARED_IMAGE_USAGE_WEBGPU_SWAP_CHAIN_TEXTURE |
+ SHARED_IMAGE_USAGE_WEBGPU_STORAGE_TEXTURE |
diff --git a/devel/electron31/files/patch-gpu_command__buffer_service_shared__image_shared__image__factory.cc b/devel/electron31/files/patch-gpu_command__buffer_service_shared__image_shared__image__factory.cc
new file mode 100644
index 000000000000..8dd577310a9a
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_command__buffer_service_shared__image_shared__image__factory.cc
@@ -0,0 +1,11 @@
+--- gpu/command_buffer/service/shared_image/shared_image_factory.cc.orig 2024-04-15 20:33:59 UTC
++++ gpu/command_buffer/service/shared_image/shared_image_factory.cc
+@@ -144,7 +144,7 @@ gfx::GpuMemoryBufferType GetNativeBufferType() {
+ return gfx::GpuMemoryBufferType::IO_SURFACE_BUFFER;
+ #elif BUILDFLAG(IS_ANDROID)
+ return gfx::GpuMemoryBufferType::ANDROID_HARDWARE_BUFFER;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ return gfx::GpuMemoryBufferType::NATIVE_PIXMAP;
+ #elif BUILDFLAG(IS_WIN)
+ return gfx::GpuMemoryBufferType::DXGI_SHARED_HANDLE;
diff --git a/devel/electron31/files/patch-gpu_command__buffer_service_shared__image_shared__image__manager.cc b/devel/electron31/files/patch-gpu_command__buffer_service_shared__image_shared__image__manager.cc
new file mode 100644
index 000000000000..73cb93a6b349
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_command__buffer_service_shared__image_shared__image__manager.cc
@@ -0,0 +1,11 @@
+--- gpu/command_buffer/service/shared_image/shared_image_manager.cc.orig 2024-06-18 21:43:33 UTC
++++ gpu/command_buffer/service/shared_image/shared_image_manager.cc
+@@ -570,7 +570,7 @@ bool SharedImageManager::SupportsScanoutImages() {
+ return true;
+ #elif BUILDFLAG(IS_ANDROID)
+ return base::AndroidHardwareBufferCompat::IsSupportAvailable();
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ return ui::OzonePlatform::GetInstance()
+ ->GetPlatformRuntimeProperties()
+ .supports_native_pixmaps;
diff --git a/devel/electron31/files/patch-gpu_command__buffer_service_shared__image_wrapped__sk__image__backing.cc b/devel/electron31/files/patch-gpu_command__buffer_service_shared__image_wrapped__sk__image__backing.cc
new file mode 100644
index 000000000000..071883e56db5
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_command__buffer_service_shared__image_wrapped__sk__image__backing.cc
@@ -0,0 +1,11 @@
+--- gpu/command_buffer/service/shared_image/wrapped_sk_image_backing.cc.orig 2024-04-15 20:33:59 UTC
++++ gpu/command_buffer/service/shared_image/wrapped_sk_image_backing.cc
+@@ -214,7 +214,7 @@ bool WrappedSkImageBacking::Initialize(const std::stri
+
+ constexpr GrRenderable is_renderable = GrRenderable::kYes;
+ constexpr GrProtected is_protected = GrProtected::kNo;
+-#if DCHECK_IS_ON() && !BUILDFLAG(IS_LINUX)
++#if DCHECK_IS_ON() && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ // Blue for single-planar and magenta-ish for multi-planar.
+ SkColor4f fallback_color =
+ format().is_single_plane() ? SkColors::kBlue : SkColors::kWhite;
diff --git a/devel/electron31/files/patch-gpu_command__buffer_service_webgpu__decoder__impl.cc b/devel/electron31/files/patch-gpu_command__buffer_service_webgpu__decoder__impl.cc
new file mode 100644
index 000000000000..7392cbed9fbe
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_command__buffer_service_webgpu__decoder__impl.cc
@@ -0,0 +1,20 @@
+--- gpu/command_buffer/service/webgpu_decoder_impl.cc.orig 2024-06-18 21:43:33 UTC
++++ gpu/command_buffer/service/webgpu_decoder_impl.cc
+@@ -1249,7 +1249,7 @@ void WebGPUDecoderImpl::RequestAdapterImpl(
+ force_fallback_adapter = true;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!shared_context_state_->GrContextIsVulkan() &&
+ !shared_context_state_->IsGraphiteDawnVulkan() &&
+ use_webgpu_adapter_ != WebGPUAdapterName::kOpenGLES) {
+@@ -1915,7 +1915,7 @@ WebGPUDecoderImpl::AssociateMailboxDawn(
+ }
+
+ #if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_APPLE) && \
+- !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_LINUX)
++ !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ if (usage & wgpu::TextureUsage::StorageBinding) {
+ LOG(ERROR) << "AssociateMailbox: wgpu::TextureUsage::StorageBinding is NOT "
+ "supported yet on this platform.";
diff --git a/devel/electron31/files/patch-gpu_command__buffer_tests_gl__gpu__memory__buffer__unittest.cc b/devel/electron31/files/patch-gpu_command__buffer_tests_gl__gpu__memory__buffer__unittest.cc
new file mode 100644
index 000000000000..b2162e0a9eda
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_command__buffer_tests_gl__gpu__memory__buffer__unittest.cc
@@ -0,0 +1,20 @@
+--- gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc.orig 2023-05-25 00:41:56 UTC
++++ gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc
+@@ -27,7 +27,7 @@
+ #include "ui/gfx/half_float.h"
+ #include "ui/gl/test/gl_test_support.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "gpu/ipc/common/gpu_memory_buffer_impl_native_pixmap.h"
+ #include "ui/gfx/linux/client_native_pixmap_factory_dmabuf.h"
+ #endif
+@@ -70,7 +70,7 @@ class GpuMemoryBufferTest : public testing::TestWithPa
+ GLManager gl_;
+ };
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ class GpuMemoryBufferTestEGL : public testing::Test,
+ public gpu::GpuCommandBufferTestEGL {
+ public:
diff --git a/devel/electron31/files/patch-gpu_config_gpu__control__list.cc b/devel/electron31/files/patch-gpu_config_gpu__control__list.cc
new file mode 100644
index 000000000000..ba7a8500bb13
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_config_gpu__control__list.cc
@@ -0,0 +1,20 @@
+--- gpu/config/gpu_control_list.cc.orig 2024-02-21 00:20:47 UTC
++++ gpu/config/gpu_control_list.cc
+@@ -276,7 +276,7 @@ GpuControlList::GLType GpuControlList::More::GetDefaul
+ GpuControlList::GLType GpuControlList::More::GetDefaultGLType() {
+ #if BUILDFLAG(IS_CHROMEOS)
+ return kGLTypeGL;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_OPENBSD)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return kGLTypeGL;
+ #elif BUILDFLAG(IS_MAC)
+ return kGLTypeGL;
+@@ -811,7 +811,7 @@ GpuControlList::OsType GpuControlList::GetOsType() {
+ return kOsAndroid;
+ #elif BUILDFLAG(IS_FUCHSIA)
+ return kOsFuchsia;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_OPENBSD)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return kOsLinux;
+ #elif BUILDFLAG(IS_MAC)
+ return kOsMacosx;
diff --git a/devel/electron31/files/patch-gpu_config_gpu__finch__features.cc b/devel/electron31/files/patch-gpu_config_gpu__finch__features.cc
new file mode 100644
index 000000000000..29eca441c92b
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_config_gpu__finch__features.cc
@@ -0,0 +1,20 @@
+--- gpu/config/gpu_finch_features.cc.orig 2024-06-18 21:43:33 UTC
++++ gpu/config/gpu_finch_features.cc
+@@ -137,7 +137,7 @@ BASE_FEATURE(kDefaultEnableGpuRasterization,
+ BASE_FEATURE(kDefaultEnableGpuRasterization,
+ "DefaultEnableGpuRasterization",
+ #if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -150,7 +150,7 @@ BASE_FEATURE(kCanvasOopRasterization,
+ "CanvasOopRasterization",
+ #if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_WIN) || \
+ (BUILDFLAG(IS_MAC) && defined(ARCH_CPU_ARM64)) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
diff --git a/devel/electron31/files/patch-gpu_config_gpu__info__collector.cc b/devel/electron31/files/patch-gpu_config_gpu__info__collector.cc
new file mode 100644
index 000000000000..cad54d11ab10
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_config_gpu__info__collector.cc
@@ -0,0 +1,11 @@
+--- gpu/config/gpu_info_collector.cc.orig 2024-02-21 00:20:47 UTC
++++ gpu/config/gpu_info_collector.cc
+@@ -364,7 +364,7 @@ void ReportWebGPUSupportMetrics(dawn::native::Instance
+ void ReportWebGPUSupportMetrics(dawn::native::Instance* instance) {
+ static BASE_FEATURE(kCollectWebGPUSupportMetrics,
+ "CollectWebGPUSupportMetrics",
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_DISABLED_BY_DEFAULT);
+ #else
+ base::FEATURE_ENABLED_BY_DEFAULT);
diff --git a/devel/electron31/files/patch-gpu_config_gpu__test__config.cc b/devel/electron31/files/patch-gpu_config_gpu__test__config.cc
new file mode 100644
index 000000000000..86cc37845dcf
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_config_gpu__test__config.cc
@@ -0,0 +1,11 @@
+--- gpu/config/gpu_test_config.cc.orig 2022-02-28 16:54:41 UTC
++++ gpu/config/gpu_test_config.cc
+@@ -29,7 +29,7 @@ GPUTestConfig::OS GetCurrentOS() {
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ return GPUTestConfig::kOsChromeOS;
+ #elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || \
+- BUILDFLAG(IS_OPENBSD)
++ BUILDFLAG(IS_BSD)
+ return GPUTestConfig::kOsLinux;
+ #elif BUILDFLAG(IS_WIN)
+ int32_t major_version = 0;
diff --git a/devel/electron31/files/patch-gpu_ipc_common_gpu__memory__buffer__support.cc b/devel/electron31/files/patch-gpu_ipc_common_gpu__memory__buffer__support.cc
new file mode 100644
index 000000000000..2878982e6d9c
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_ipc_common_gpu__memory__buffer__support.cc
@@ -0,0 +1,20 @@
+--- gpu/ipc/common/gpu_memory_buffer_support.cc.orig 2023-08-10 01:48:45 UTC
++++ gpu/ipc/common/gpu_memory_buffer_support.cc
+@@ -26,7 +26,7 @@
+ #include "ui/ozone/public/ozone_platform.h"
+ #endif
+
+-#if BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "gpu/ipc/common/gpu_memory_buffer_impl_native_pixmap.h"
+ #endif
+
+@@ -56,7 +56,7 @@ GpuMemoryBufferSupport::GetNativeGpuMemoryBufferType()
+ return gfx::IO_SURFACE_BUFFER;
+ #elif BUILDFLAG(IS_ANDROID)
+ return gfx::ANDROID_HARDWARE_BUFFER;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OZONE)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_BSD)
+ return gfx::NATIVE_PIXMAP;
+ #elif BUILDFLAG(IS_WIN)
+ return gfx::DXGI_SHARED_HANDLE;
diff --git a/devel/electron31/files/patch-gpu_ipc_common_gpu__memory__buffer__support.h b/devel/electron31/files/patch-gpu_ipc_common_gpu__memory__buffer__support.h
new file mode 100644
index 000000000000..2ab58073a4b1
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_ipc_common_gpu__memory__buffer__support.h
@@ -0,0 +1,11 @@
+--- gpu/ipc/common/gpu_memory_buffer_support.h.orig 2023-08-10 01:48:45 UTC
++++ gpu/ipc/common/gpu_memory_buffer_support.h
+@@ -21,7 +21,7 @@
+ #include "ui/gfx/geometry/size.h"
+ #include "ui/gfx/gpu_memory_buffer.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OZONE)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_BSD)
+ namespace gfx {
+ class ClientNativePixmapFactory;
+ } // namespace gfx
diff --git a/devel/electron31/files/patch-gpu_ipc_service_gpu__init.cc b/devel/electron31/files/patch-gpu_ipc_service_gpu__init.cc
new file mode 100644
index 000000000000..bc8c4f63faee
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_ipc_service_gpu__init.cc
@@ -0,0 +1,74 @@
+--- gpu/ipc/service/gpu_init.cc.orig 2024-06-18 21:43:33 UTC
++++ gpu/ipc/service/gpu_init.cc
+@@ -398,7 +398,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandL
+ enable_watchdog = false;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool gpu_sandbox_start_early = gpu_preferences_.gpu_sandbox_start_early;
+ #else // !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
+ // For some reasons MacOSX's VideoToolbox might crash when called after
+@@ -435,7 +435,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandL
+ }
+
+ bool attempted_startsandbox = false;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On Chrome OS ARM Mali, GPU driver userspace creates threads when
+ // initializing a GL context, so start the sandbox early.
+ // TODO(zmo): Need to collect OS version before this.
+@@ -544,7 +544,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandL
+ gpu_preferences_.gr_context_type = GrContextType::kGL;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // The ContentSandboxHelper is currently the only one implementation of
+ // GpuSandboxHelper and it has no dependency. Except on Linux where
+ // VaapiWrapper checks the GL implementation to determine which display
+@@ -626,7 +626,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandL
+ command_line, gpu_feature_info_,
+ gpu_preferences_.disable_software_rasterizer, false);
+ if (gl_use_swiftshader_) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ VLOG(1) << "Quit GPU process launch to fallback to SwiftShader cleanly "
+ << "on Linux";
+ return false;
+@@ -782,7 +782,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandL
+
+ InitializePlatformOverlaySettings(&gpu_info_, gpu_feature_info_);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Driver may create a compatibility profile context when collect graphics
+ // information on Linux platform. Try to collect graphics information
+ // based on core profile context after disabling platform extensions.
+@@ -837,7 +837,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandL
+ }
+ }
+ }
+-#if BUILDFLAG(IS_LINUX) || \
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_CHROMEOS_DEVICE))
+ if (!gl_disabled && !gl_use_swiftshader_ && std::getenv("RUNNING_UNDER_RR")) {
+ // https://rr-project.org/ is a Linux-only record-and-replay debugger that
+@@ -1025,7 +1025,7 @@ void GpuInit::InitializeInProcess(base::CommandLine* c
+ }
+ bool gl_disabled = gl::GetGLImplementation() == gl::kGLImplementationDisabled;
+
+-#if BUILDFLAG(IS_LINUX) || \
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_CHROMEOS_DEVICE))
+ if (!gl_disabled && !gl_use_swiftshader_ && std::getenv("RUNNING_UNDER_RR")) {
+ // https://rr-project.org/ is a Linux-only record-and-replay debugger that
+@@ -1085,7 +1085,7 @@ void GpuInit::InitializeInProcess(base::CommandLine* c
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Driver may create a compatibility profile context when collect graphics
+ // information on Linux platform. Try to collect graphics information
+ // based on core profile context after disabling platform extensions.
diff --git a/devel/electron31/files/patch-gpu_ipc_service_gpu__memory__buffer__factory.cc b/devel/electron31/files/patch-gpu_ipc_service_gpu__memory__buffer__factory.cc
new file mode 100644
index 000000000000..ca21ea726636
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_ipc_service_gpu__memory__buffer__factory.cc
@@ -0,0 +1,20 @@
+--- gpu/ipc/service/gpu_memory_buffer_factory.cc.orig 2023-03-30 00:33:52 UTC
++++ gpu/ipc/service/gpu_memory_buffer_factory.cc
+@@ -13,7 +13,7 @@
+ #include "gpu/ipc/service/gpu_memory_buffer_factory_io_surface.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ #include "gpu/ipc/service/gpu_memory_buffer_factory_native_pixmap.h"
+ #endif
+
+@@ -36,7 +36,7 @@ GpuMemoryBufferFactory::CreateNativeType(
+ return std::make_unique<GpuMemoryBufferFactoryIOSurface>();
+ #elif BUILDFLAG(IS_ANDROID)
+ return std::make_unique<GpuMemoryBufferFactoryAndroidHardwareBuffer>();
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ return std::make_unique<GpuMemoryBufferFactoryNativePixmap>(
+ vulkan_context_provider);
+ #elif BUILDFLAG(IS_WIN)
diff --git a/devel/electron31/files/patch-gpu_ipc_service_x__util.h b/devel/electron31/files/patch-gpu_ipc_service_x__util.h
new file mode 100644
index 000000000000..a981513535b7
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_ipc_service_x__util.h
@@ -0,0 +1,11 @@
+--- gpu/ipc/service/x_util.h.orig 2024-02-21 00:20:47 UTC
++++ gpu/ipc/service/x_util.h
+@@ -12,7 +12,7 @@
+ #include "gpu/ipc/service/gpu_config.h"
+ #include "ui/base/ozone_buildflags.h"
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+
+ namespace gpu {
+
diff --git a/devel/electron31/files/patch-gpu_vulkan_generate__bindings.py b/devel/electron31/files/patch-gpu_vulkan_generate__bindings.py
new file mode 100644
index 000000000000..01082cafad43
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_vulkan_generate__bindings.py
@@ -0,0 +1,11 @@
+--- gpu/vulkan/generate_bindings.py.orig 2024-06-18 21:43:33 UTC
++++ gpu/vulkan/generate_bindings.py
+@@ -271,7 +271,7 @@ VULKAN_DEVICE_FUNCTIONS = [
+ ]
+ },
+ {
+- 'ifdef': 'BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)',
++ 'ifdef': 'BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)',
+ 'extension': 'VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME',
+ 'functions': [
+ 'vkGetImageDrmFormatModifierPropertiesEXT',
diff --git a/devel/electron31/files/patch-gpu_vulkan_semaphore__handle.cc b/devel/electron31/files/patch-gpu_vulkan_semaphore__handle.cc
new file mode 100644
index 000000000000..a95de189e1fc
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_vulkan_semaphore__handle.cc
@@ -0,0 +1,20 @@
+--- gpu/vulkan/semaphore_handle.cc.orig 2023-11-29 21:40:03 UTC
++++ gpu/vulkan/semaphore_handle.cc
+@@ -39,7 +39,7 @@ SemaphoreHandle::SemaphoreHandle(gfx::GpuFenceHandle f
+ // https://fuchsia.dev/reference/fidl/fuchsia.ui.scenic.
+ Init(VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_ZIRCON_EVENT_BIT_FUCHSIA,
+ fence_handle.Release());
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ Init(VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR,
+ fence_handle.Release());
+ #elif BUILDFLAG(IS_POSIX)
+@@ -64,7 +64,7 @@ gfx::GpuFenceHandle SemaphoreHandle::ToGpuFenceHandle(
+ // VkSemaphore, which can then be used to submit present work, see
+ // https://fuchsia.dev/reference/fidl/fuchsia.ui.scenic.
+ fence_handle.Adopt(TakeHandle());
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ if (type_ == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR) {
+ fence_handle.Adopt(TakeHandle());
+ } else {
diff --git a/devel/electron31/files/patch-gpu_vulkan_vulkan__device__queue.cc b/devel/electron31/files/patch-gpu_vulkan_vulkan__device__queue.cc
new file mode 100644
index 000000000000..95dc16ee29e4
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_vulkan_vulkan__device__queue.cc
@@ -0,0 +1,20 @@
+--- gpu/vulkan/vulkan_device_queue.cc.orig 2024-06-18 21:43:33 UTC
++++ gpu/vulkan/vulkan_device_queue.cc
+@@ -125,7 +125,7 @@ bool VulkanDeviceQueue::Initialize(
+
+ // In dual-CPU cases, we cannot detect the active GPU correctly on Linux,
+ // so don't select GPU device based on the |gpu_info|.
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ // If gpu_info is provided, the device should match it.
+ if (gpu_info && (device_properties.vendorID != gpu_info->gpu.vendor_id ||
+ device_properties.deviceID != gpu_info->gpu.device_id)) {
+@@ -268,7 +268,7 @@ bool VulkanDeviceQueue::Initialize(
+ // Android, Fuchsia, Linux, and CrOS (VaapiVideoDecoder) need YCbCr sampler
+ // support.
+ #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (!physical_device_info.feature_sampler_ycbcr_conversion) {
+ LOG(ERROR) << "samplerYcbcrConversion is not supported.";
+ return false;
diff --git a/devel/electron31/files/patch-gpu_vulkan_vulkan__device__queue.h b/devel/electron31/files/patch-gpu_vulkan_vulkan__device__queue.h
new file mode 100644
index 000000000000..5a8a5d8980fe
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_vulkan_vulkan__device__queue.h
@@ -0,0 +1,11 @@
+--- gpu/vulkan/vulkan_device_queue.h.orig 2024-02-21 00:20:47 UTC
++++ gpu/vulkan/vulkan_device_queue.h
+@@ -169,7 +169,7 @@ class COMPONENT_EXPORT(VULKAN) VulkanDeviceQueue
+ bool allow_protected_memory_ = false;
+
+ #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ VkPhysicalDeviceSamplerYcbcrConversionFeatures
+ sampler_ycbcr_conversion_features_{
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES};
diff --git a/devel/electron31/files/patch-gpu_vulkan_vulkan__function__pointers.cc b/devel/electron31/files/patch-gpu_vulkan_vulkan__function__pointers.cc
new file mode 100644
index 000000000000..1127953e0d97
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_vulkan_vulkan__function__pointers.cc
@@ -0,0 +1,20 @@
+--- gpu/vulkan/vulkan_function_pointers.cc.orig 2024-06-18 21:43:33 UTC
++++ gpu/vulkan/vulkan_function_pointers.cc
+@@ -1297,7 +1297,7 @@ bool VulkanFunctionPointers::BindDeviceFunctionPointer
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (gfx::HasExtension(enabled_extensions,
+ VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME)) {
+ constexpr char kvkGetImageDrmFormatModifierPropertiesEXT[] =
+@@ -1498,7 +1498,7 @@ void VulkanFunctionPointers::ResetForTesting() {
+ vkGetSwapchainImagesKHR = nullptr;
+ vkQueuePresentKHR = nullptr;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ vkGetImageDrmFormatModifierPropertiesEXT = nullptr;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ }
diff --git a/devel/electron31/files/patch-gpu_vulkan_vulkan__function__pointers.h b/devel/electron31/files/patch-gpu_vulkan_vulkan__function__pointers.h
new file mode 100644
index 000000000000..bd1db19c462e
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_vulkan_vulkan__function__pointers.h
@@ -0,0 +1,27 @@
+--- gpu/vulkan/vulkan_function_pointers.h.orig 2024-06-18 21:43:33 UTC
++++ gpu/vulkan/vulkan_function_pointers.h
+@@ -322,7 +322,7 @@ struct COMPONENT_EXPORT(VULKAN) VulkanFunctionPointers
+ VulkanFunction<PFN_vkGetSwapchainImagesKHR> vkGetSwapchainImagesKHR;
+ VulkanFunction<PFN_vkQueuePresentKHR> vkQueuePresentKHR;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ VulkanFunction<PFN_vkGetImageDrmFormatModifierPropertiesEXT>
+ vkGetImageDrmFormatModifierPropertiesEXT;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+@@ -1336,7 +1336,7 @@ ALWAYS_INLINE VkResult vkQueuePresentKHR(VkQueue queue
+ pPresentInfo);
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ALWAYS_INLINE VkResult vkGetImageDrmFormatModifierPropertiesEXT(
+ VkDevice device,
+ VkImage image,
+@@ -1346,4 +1346,4 @@ ALWAYS_INLINE VkResult vkGetImageDrmFormatModifierProp
+ }
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+-#endif // GPU_VULKAN_VULKAN_FUNCTION_POINTERS_H_
+\ No newline at end of file
++#endif // GPU_VULKAN_VULKAN_FUNCTION_POINTERS_H_
diff --git a/devel/electron31/files/patch-gpu_vulkan_vulkan__image.h b/devel/electron31/files/patch-gpu_vulkan_vulkan__image.h
new file mode 100644
index 000000000000..7960e8e43873
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_vulkan_vulkan__image.h
@@ -0,0 +1,20 @@
+--- gpu/vulkan/vulkan_image.h.orig 2023-02-01 18:43:21 UTC
++++ gpu/vulkan/vulkan_image.h
+@@ -87,7 +87,7 @@ class COMPONENT_EXPORT(VULKAN) VulkanImage {
+ VkImageUsageFlags usage,
+ VkImageCreateFlags flags);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ static std::unique_ptr<VulkanImage> CreateWithExternalMemoryAndModifiers(
+ VulkanDeviceQueue* device_queue,
+ const gfx::Size& size,
+@@ -199,7 +199,7 @@ class COMPONENT_EXPORT(VULKAN) VulkanImage {
+ VkImageTiling image_tiling,
+ uint32_t queue_family_index);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool InitializeWithExternalMemoryAndModifiers(VulkanDeviceQueue* device_queue,
+ const gfx::Size& size,
+ VkFormat format,
diff --git a/devel/electron31/files/patch-gpu_vulkan_vulkan__util.cc b/devel/electron31/files/patch-gpu_vulkan_vulkan__util.cc
new file mode 100644
index 000000000000..1cea99349da6
--- /dev/null
+++ b/devel/electron31/files/patch-gpu_vulkan_vulkan__util.cc
@@ -0,0 +1,11 @@
+--- gpu/vulkan/vulkan_util.cc.orig 2024-06-18 21:43:33 UTC
++++ gpu/vulkan/vulkan_util.cc
+@@ -468,7 +468,7 @@ bool CheckVulkanCompatibilities(
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX) && !defined(OZONE_PLATFORM_IS_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && !defined(OZONE_PLATFORM_IS_X11)
+ // Vulkan is only supported with X11 on Linux for now.
+ return false;
+ #else
diff --git a/devel/electron31/files/patch-headless_lib_browser_headless__browser__main__parts__posix.cc b/devel/electron31/files/patch-headless_lib_browser_headless__browser__main__parts__posix.cc
new file mode 100644
index 000000000000..5b0861b003d6
--- /dev/null
+++ b/devel/electron31/files/patch-headless_lib_browser_headless__browser__main__parts__posix.cc
@@ -0,0 +1,39 @@
+--- headless/lib/browser/headless_browser_main_parts_posix.cc.orig 2023-10-19 19:58:24 UTC
++++ headless/lib/browser/headless_browser_main_parts_posix.cc
+@@ -21,13 +21,13 @@
+ #include "content/public/browser/browser_thread.h"
+ #include "headless/lib/browser/headless_browser_impl.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/command_line.h"
+ #include "components/os_crypt/sync/key_storage_config_linux.h"
+ #include "components/os_crypt/sync/os_crypt.h"
+ #include "headless/public/switches.h"
+
+-#if defined(USE_DBUS)
++#if defined(USE_DBUS) && !BUILDFLAG(IS_BSD)
+ #include "device/bluetooth/dbus/bluez_dbus_manager.h"
+ #endif
+
+@@ -161,7 +161,7 @@ class BrowserShutdownHandler {
+
+ } // namespace
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ constexpr char kProductName[] = "HeadlessChrome";
+ #endif
+
+@@ -169,9 +169,9 @@ void HeadlessBrowserMainParts::PostCreateMainMessageLo
+ BrowserShutdownHandler::Install(base::BindOnce(
+ &HeadlessBrowserImpl::ShutdownWithExitCode, browser_->GetWeakPtr()));
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+-#if defined(USE_DBUS)
++#if defined(USE_DBUS) && !BUILDFLAG(IS_BSD)
+ bluez::BluezDBusManager::Initialize(/*system_bus=*/nullptr);
+ #endif
+
diff --git a/devel/electron31/files/patch-headless_lib_browser_headless__content__browser__client.h b/devel/electron31/files/patch-headless_lib_browser_headless__content__browser__client.h
new file mode 100644
index 000000000000..0322c0b43d71
--- /dev/null
+++ b/devel/electron31/files/patch-headless_lib_browser_headless__content__browser__client.h
@@ -0,0 +1,11 @@
+--- headless/lib/browser/headless_content_browser_client.h.orig 2023-02-01 18:43:21 UTC
++++ headless/lib/browser/headless_content_browser_client.h
+@@ -45,7 +45,7 @@ class HeadlessContentBrowserClient : public content::C
+ CreateDevToolsManagerDelegate() override;
+ content::GeneratedCodeCacheSettings GetGeneratedCodeCacheSettings(
+ content::BrowserContext* context) override;
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD)
+ void GetAdditionalMappedFilesForChildProcess(
+ const base::CommandLine& command_line,
+ int child_process_id,
diff --git a/devel/electron31/files/patch-headless_lib_browser_headless__request__context__manager.cc b/devel/electron31/files/patch-headless_lib_browser_headless__request__context__manager.cc
new file mode 100644
index 000000000000..ddfaf98e3b6b
--- /dev/null
+++ b/devel/electron31/files/patch-headless_lib_browser_headless__request__context__manager.cc
@@ -0,0 +1,11 @@
+--- headless/lib/browser/headless_request_context_manager.cc.orig 2024-06-18 21:43:33 UTC
++++ headless/lib/browser/headless_request_context_manager.cc
+@@ -66,7 +66,7 @@ void SetCryptKeyOnce(const base::FilePath& user_data_p
+ return;
+ done_once = true;
+
+-#if (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)) && defined(HEADLESS_USE_PREFS)
++#if (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(HEADLESS_USE_PREFS)
+ // The OSCrypt keys are process bound, so if network service is out of
+ // process, send it the required key if it is available.
+ if (content::IsOutOfProcessNetworkService()
diff --git a/devel/electron31/files/patch-headless_lib_browser_headless__web__contents__impl.cc b/devel/electron31/files/patch-headless_lib_browser_headless__web__contents__impl.cc
new file mode 100644
index 000000000000..5d0967fc0cd8
--- /dev/null
+++ b/devel/electron31/files/patch-headless_lib_browser_headless__web__contents__impl.cc
@@ -0,0 +1,11 @@
+--- headless/lib/browser/headless_web_contents_impl.cc.orig 2024-06-30 11:48:29 UTC
++++ headless/lib/browser/headless_web_contents_impl.cc
+@@ -62,7 +62,7 @@ void UpdatePrefsFromSystemSettings(blink::RendererPref
+ namespace {
+
+ void UpdatePrefsFromSystemSettings(blink::RendererPreferences* prefs) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ content::UpdateFontRendererPreferencesFromSystemSettings(prefs);
+ #endif
+
diff --git a/devel/electron31/files/patch-headless_lib_headless__content__main__delegate.cc b/devel/electron31/files/patch-headless_lib_headless__content__main__delegate.cc
new file mode 100644
index 000000000000..a5da924b93f5
--- /dev/null
+++ b/devel/electron31/files/patch-headless_lib_headless__content__main__delegate.cc
@@ -0,0 +1,11 @@
+--- headless/lib/headless_content_main_delegate.cc.orig 2024-06-18 21:43:33 UTC
++++ headless/lib/headless_content_main_delegate.cc
+@@ -371,7 +371,7 @@ void HeadlessContentMainDelegate::InitCrashReporter(
+ if (process_type != ::switches::kZygoteProcess) {
+ g_headless_crash_client.Pointer()->set_crash_dumps_dir(
+ command_line.GetSwitchValuePath(switches::kCrashDumpsDir));
+-#if !BUILDFLAG(IS_WIN)
++#if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_BSD)
+ crash_reporter::InitializeCrashpad(process_type.empty(), process_type);
+ #endif // !BUILDFLAG(IS_WIN)
+ crash_keys::SetSwitchesFromCommandLine(command_line, nullptr);
diff --git a/devel/electron31/files/patch-ipc_ipc__channel.h b/devel/electron31/files/patch-ipc_ipc__channel.h
new file mode 100644
index 000000000000..7404b35c1391
--- /dev/null
+++ b/devel/electron31/files/patch-ipc_ipc__channel.h
@@ -0,0 +1,11 @@
+--- ipc/ipc_channel.h.orig 2024-06-18 21:43:35 UTC
++++ ipc/ipc_channel.h
+@@ -218,7 +218,7 @@ class COMPONENT_EXPORT(IPC) Channel : public Sender {
+ static std::string GenerateUniqueRandomChannelID();
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Sandboxed processes live in a PID namespace, so when sending the IPC hello
+ // message from client to server we need to send the PID from the global
+ // PID namespace.
diff --git a/devel/electron31/files/patch-ipc_ipc__channel__common.cc b/devel/electron31/files/patch-ipc_ipc__channel__common.cc
new file mode 100644
index 000000000000..c68294ff75b0
--- /dev/null
+++ b/devel/electron31/files/patch-ipc_ipc__channel__common.cc
@@ -0,0 +1,11 @@
+--- ipc/ipc_channel_common.cc.orig 2023-02-01 18:43:22 UTC
++++ ipc/ipc_channel_common.cc
+@@ -10,7 +10,7 @@
+
+ namespace IPC {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ namespace {
+ int g_global_pid = 0;
diff --git a/devel/electron31/files/patch-ipc_ipc__channel__mojo.cc b/devel/electron31/files/patch-ipc_ipc__channel__mojo.cc
new file mode 100644
index 000000000000..aad0bd25fa8f
--- /dev/null
+++ b/devel/electron31/files/patch-ipc_ipc__channel__mojo.cc
@@ -0,0 +1,11 @@
+--- ipc/ipc_channel_mojo.cc.orig 2023-02-01 18:43:22 UTC
++++ ipc/ipc_channel_mojo.cc
+@@ -105,7 +105,7 @@ class ThreadSafeChannelProxy : public mojo::ThreadSafe
+ };
+
+ base::ProcessId GetSelfPID() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (int global_pid = Channel::GetGlobalPid())
+ return global_pid;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
diff --git a/devel/electron31/files/patch-ipc_ipc__message__utils.cc b/devel/electron31/files/patch-ipc_ipc__message__utils.cc
new file mode 100644
index 000000000000..a023c2e07f47
--- /dev/null
+++ b/devel/electron31/files/patch-ipc_ipc__message__utils.cc
@@ -0,0 +1,11 @@
+--- ipc/ipc_message_utils.cc.orig 2024-06-18 21:43:35 UTC
++++ ipc/ipc_message_utils.cc
+@@ -395,7 +395,7 @@ void ParamTraits<unsigned int>::Log(const param_type&
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_FUCHSIA) || \
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_ANDROID) && defined(ARCH_CPU_64_BITS))
+ void ParamTraits<long>::Log(const param_type& p, std::string* l) {
+ l->append(base::NumberToString(p));
diff --git a/devel/electron31/files/patch-ipc_ipc__message__utils.h b/devel/electron31/files/patch-ipc_ipc__message__utils.h
new file mode 100644
index 000000000000..0b1c49c55797
--- /dev/null
+++ b/devel/electron31/files/patch-ipc_ipc__message__utils.h
@@ -0,0 +1,11 @@
+--- ipc/ipc_message_utils.h.orig 2022-09-24 10:57:32 UTC
++++ ipc/ipc_message_utils.h
+@@ -214,7 +214,7 @@ struct ParamTraits<unsigned int> {
+ // Since we want to support Android 32<>64 bit IPC, as long as we don't have
+ // these traits for 32 bit ARM then that'll catch any errors.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_FUCHSIA) || \
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_ANDROID) && defined(ARCH_CPU_64_BITS))
+ template <>
+ struct ParamTraits<long> {
diff --git a/devel/electron31/files/patch-media_BUILD.gn b/devel/electron31/files/patch-media_BUILD.gn
new file mode 100644
index 000000000000..14887c61b163
--- /dev/null
+++ b/devel/electron31/files/patch-media_BUILD.gn
@@ -0,0 +1,12 @@
+--- media/BUILD.gn.orig 2024-02-21 00:20:48 UTC
++++ media/BUILD.gn
+@@ -96,6 +96,9 @@ config("media_config") {
+ defines += [ "DLOPEN_PULSEAUDIO" ]
+ }
+ }
++ if (use_sndio) {
++ defines += [ "USE_SNDIO" ]
++ }
+ if (use_cras) {
+ defines += [ "USE_CRAS" ]
+ }
diff --git a/devel/electron31/files/patch-media_audio_BUILD.gn b/devel/electron31/files/patch-media_audio_BUILD.gn
new file mode 100644
index 000000000000..d1abfaf6bb92
--- /dev/null
+++ b/devel/electron31/files/patch-media_audio_BUILD.gn
@@ -0,0 +1,24 @@
+--- media/audio/BUILD.gn.orig 2024-02-27 21:36:00 UTC
++++ media/audio/BUILD.gn
+@@ -271,9 +271,20 @@ source_set("audio") {
+ deps += [ "//media/base/android:media_jni_headers" ]
+ }
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !use_sndio) {
+ sources += [ "linux/audio_manager_linux.cc" ]
+ }
++
++ if (use_sndio) {
++ libs += [ "sndio" ]
++ sources += [
++ "sndio/audio_manager_sndio.cc",
++ "sndio/sndio_input.cc",
++ "sndio/sndio_input.h",
++ "sndio/sndio_output.cc",
++ "sndio/sndio_output.h"
++ ]
++ }
+
+ if (use_alsa) {
+ libs += [ "asound" ]
diff --git a/devel/electron31/files/patch-media_audio_alsa_audio__manager__alsa.cc b/devel/electron31/files/patch-media_audio_alsa_audio__manager__alsa.cc
new file mode 100644
index 000000000000..a26dd20d89cf
--- /dev/null
+++ b/devel/electron31/files/patch-media_audio_alsa_audio__manager__alsa.cc
@@ -0,0 +1,54 @@
+--- media/audio/alsa/audio_manager_alsa.cc.orig 2022-04-21 18:48:31 UTC
++++ media/audio/alsa/audio_manager_alsa.cc
+@@ -88,7 +88,9 @@ void AudioManagerAlsa::GetAlsaAudioDevices(StreamType
+ int card = -1;
+
+ // Loop through the sound cards to get ALSA device hints.
++#if !BUILDFLAG(IS_BSD)
+ while (!wrapper_->CardNext(&card) && card >= 0) {
++#endif
+ void** hints = NULL;
+ int error = wrapper_->DeviceNameHint(card, kPcmInterfaceName, &hints);
+ if (!error) {
+@@ -100,7 +102,9 @@ void AudioManagerAlsa::GetAlsaAudioDevices(StreamType
+ DLOG(WARNING) << "GetAlsaAudioDevices: unable to get device hints: "
+ << wrapper_->StrError(error);
+ }
++#if !BUILDFLAG(IS_BSD)
+ }
++#endif
+ }
+
+ void AudioManagerAlsa::GetAlsaDevicesInfo(AudioManagerAlsa::StreamType type,
+@@ -183,7 +187,11 @@ bool AudioManagerAlsa::IsAlsaDeviceAvailable(
+ // goes through software conversion if needed (e.g. incompatible
+ // sample rate).
+ // TODO(joi): Should we prefer "hw" instead?
++#if BUILDFLAG(IS_BSD)
++ static const char kDeviceTypeDesired[] = "plug";
++#else
+ static const char kDeviceTypeDesired[] = "plughw";
++#endif
+ return strncmp(kDeviceTypeDesired, device_name,
+ std::size(kDeviceTypeDesired) - 1) == 0;
+ }
+@@ -205,7 +213,9 @@ bool AudioManagerAlsa::HasAnyAlsaAudioDevice(
+ // Loop through the sound cards.
+ // Don't use snd_device_name_hint(-1,..) since there is an access violation
+ // inside this ALSA API with libasound.so.2.0.0.
++#if !BUILDFLAG(IS_BSD)
+ while (!wrapper_->CardNext(&card) && (card >= 0) && !has_device) {
++#endif
+ int error = wrapper_->DeviceNameHint(card, kPcmInterfaceName, &hints);
+ if (!error) {
+ for (void** hint_iter = hints; *hint_iter != NULL; hint_iter++) {
+@@ -229,7 +239,9 @@ bool AudioManagerAlsa::HasAnyAlsaAudioDevice(
+ DLOG(WARNING) << "HasAnyAudioDevice: unable to get device hints: "
+ << wrapper_->StrError(error);
+ }
++#if !BUILDFLAG(IS_BSD)
+ }
++#endif
+
+ return has_device;
+ }
diff --git a/devel/electron31/files/patch-media_audio_audio__input__device.cc b/devel/electron31/files/patch-media_audio_audio__input__device.cc
new file mode 100644
index 000000000000..b99e3ca8acb2
--- /dev/null
+++ b/devel/electron31/files/patch-media_audio_audio__input__device.cc
@@ -0,0 +1,11 @@
+--- media/audio/audio_input_device.cc.orig 2024-04-15 20:34:00 UTC
++++ media/audio/audio_input_device.cc
+@@ -264,7 +264,7 @@ void AudioInputDevice::OnStreamCreated(
+ // here. See comments in AliveChecker and PowerObserverHelper for details and
+ // todos.
+ if (detect_dead_stream_ == DeadStreamDetection::kEnabled) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const bool stop_at_first_alive_notification = true;
+ const bool pause_check_during_suspend = false;
+ #else
diff --git a/devel/electron31/files/patch-media_audio_audio__output__proxy__unittest.cc b/devel/electron31/files/patch-media_audio_audio__output__proxy__unittest.cc
new file mode 100644
index 000000000000..09cfeab169e1
--- /dev/null
+++ b/devel/electron31/files/patch-media_audio_audio__output__proxy__unittest.cc
@@ -0,0 +1,14 @@
+--- media/audio/audio_output_proxy_unittest.cc.orig 2023-03-30 00:33:53 UTC
++++ media/audio/audio_output_proxy_unittest.cc
+@@ -443,7 +443,11 @@ class AudioOutputProxyTest : public testing::Test {
+ // |stream| is closed at this point. Start() should reopen it again.
+ EXPECT_CALL(manager(), MakeAudioOutputStream(_, _, _))
+ .Times(2)
++#if BUILDFLAG(IS_BSD)
++ .WillRepeatedly(Return(static_cast<AudioOutputStream*>(NULL)));
++#else
+ .WillRepeatedly(Return(reinterpret_cast<AudioOutputStream*>(NULL)));
++#endif
+
+ EXPECT_CALL(callback_, OnError(_)).Times(2);
+
diff --git a/devel/electron31/files/patch-media_audio_pulse_pulse__util.cc b/devel/electron31/files/patch-media_audio_pulse_pulse__util.cc
new file mode 100644
index 000000000000..ca2e4d2234de
--- /dev/null
+++ b/devel/electron31/files/patch-media_audio_pulse_pulse__util.cc
@@ -0,0 +1,14 @@
+--- media/audio/pulse/pulse_util.cc.orig 2024-06-18 21:43:35 UTC
++++ media/audio/pulse/pulse_util.cc
+@@ -45,7 +45,11 @@ static const base::FilePath::CharType kPulseLib[] =
+
+ #if defined(DLOPEN_PULSEAUDIO)
+ static const base::FilePath::CharType kPulseLib[] =
++#if BUILDFLAG(IS_BSD)
++ FILE_PATH_LITERAL("libpulse.so");
++#else
+ FILE_PATH_LITERAL("libpulse.so.0");
++#endif
+ #endif
+
+ void DestroyMainloop(pa_threaded_mainloop* mainloop) {
diff --git a/devel/electron31/files/patch-media_audio_sndio_audio__manager__sndio.cc b/devel/electron31/files/patch-media_audio_sndio_audio__manager__sndio.cc
new file mode 100644
index 000000000000..afd1a4dd8a99
--- /dev/null
+++ b/devel/electron31/files/patch-media_audio_sndio_audio__manager__sndio.cc
@@ -0,0 +1,244 @@
+--- media/audio/sndio/audio_manager_sndio.cc.orig 2024-06-30 11:49:01 UTC
++++ media/audio/sndio/audio_manager_sndio.cc
+@@ -0,0 +1,241 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "base/command_line.h"
++#include "base/metrics/histogram_macros.h"
++#include "base/memory/ptr_util.h"
++
++#include "media/audio/sndio/audio_manager_sndio.h"
++
++#include "media/audio/audio_device_description.h"
++#include "media/audio/audio_output_dispatcher.h"
++#if defined(USE_SNDIO)
++#include "media/audio/sndio/sndio_input.h"
++#include "media/audio/sndio/sndio_output.h"
++#endif
++#if defined(USE_PULSEAUDIO)
++#include "media/audio/pulse/audio_manager_pulse.h"
++#include "media/audio/pulse/pulse_util.h"
++#endif
++#if defined(USE_ALSA)
++#include "media/audio/alsa/audio_manager_alsa.h"
++#endif
++#include "media/audio/fake_audio_manager.h"
++#include "media/base/limits.h"
++#include "media/base/media_switches.h"
++
++namespace media {
++
++#if defined(USE_SNDIO)
++// Maximum number of output streams that can be open simultaneously.
++static const int kMaxOutputStreams = 50;
++
++// Default sample rate for input and output streams.
++static const int kDefaultSampleRate = 48000;
++
++#if BUILDFLAG(IS_OPENBSD)
++static const std::string kDefaultAudioBackend = "sndio";
++#else
++static const std::string kDefaultAudioBackend = "auto";
++#endif
++
++void AddDefaultDevice(AudioDeviceNames* device_names) {
++ DCHECK(device_names->empty());
++ device_names->push_front(AudioDeviceName::CreateDefault());
++}
++
++bool AudioManagerSndio::HasAudioOutputDevices() {
++ return true;
++}
++
++bool AudioManagerSndio::HasAudioInputDevices() {
++ return true;
++}
++
++void AudioManagerSndio::GetAudioInputDeviceNames(
++ AudioDeviceNames* device_names) {
++ DCHECK(device_names->empty());
++ AddDefaultDevice(device_names);
++}
++
++void AudioManagerSndio::GetAudioOutputDeviceNames(
++ AudioDeviceNames* device_names) {
++ AddDefaultDevice(device_names);
++}
++
++#if defined(USE_SNDIO)
++const char* AudioManagerSndio::GetName() {
++ return "SNDIO";
++}
++#endif
++
++AudioParameters AudioManagerSndio::GetInputStreamParameters(
++ const std::string& device_id) {
++ static const int kDefaultInputBufferSize = 1024;
++
++ int user_buffer_size = GetUserBufferSize();
++ int buffer_size = user_buffer_size ?
++ user_buffer_size : kDefaultInputBufferSize;
++
++ return AudioParameters(
++ AudioParameters::AUDIO_PCM_LOW_LATENCY, ChannelLayoutConfig::Stereo(),
++ kDefaultSampleRate, buffer_size);
++}
++
++AudioManagerSndio::AudioManagerSndio(std::unique_ptr<AudioThread> audio_thread,
++ AudioLogFactory* audio_log_factory)
++ : AudioManagerBase(std::move(audio_thread),
++ audio_log_factory) {
++ DLOG(WARNING) << "AudioManagerSndio";
++ SetMaxOutputStreamsAllowed(kMaxOutputStreams);
++}
++
++AudioManagerSndio::~AudioManagerSndio() = default;
++
++AudioOutputStream* AudioManagerSndio::MakeLinearOutputStream(
++ const AudioParameters& params,
++ const LogCallback& log_callback) {
++ DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
++ return MakeOutputStream(params);
++}
++
++AudioOutputStream* AudioManagerSndio::MakeLowLatencyOutputStream(
++ const AudioParameters& params,
++ const std::string& device_id,
++ const LogCallback& log_callback) {
++ DLOG_IF(ERROR, !device_id.empty()) << "Not implemented!";
++ DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format());
++ return MakeOutputStream(params);
++}
++
++AudioInputStream* AudioManagerSndio::MakeLinearInputStream(
++ const AudioParameters& params,
++ const std::string& device_id,
++ const LogCallback& log_callback) {
++ DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
++ return MakeInputStream(params);
++}
++
++AudioInputStream* AudioManagerSndio::MakeLowLatencyInputStream(
++ const AudioParameters& params,
++ const std::string& device_id,
++ const LogCallback& log_callback) {
++ DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format());
++ return MakeInputStream(params);
++}
++
++AudioParameters AudioManagerSndio::GetPreferredOutputStreamParameters(
++ const std::string& output_device_id,
++ const AudioParameters& input_params) {
++ // TODO(tommi): Support |output_device_id|.
++ DLOG_IF(ERROR, !output_device_id.empty()) << "Not implemented!";
++ static const int kDefaultOutputBufferSize = 2048;
++
++ ChannelLayoutConfig channel_layout_config = ChannelLayoutConfig::Stereo();
++ int sample_rate = kDefaultSampleRate;
++ int buffer_size = kDefaultOutputBufferSize;
++ if (input_params.IsValid()) {
++ sample_rate = input_params.sample_rate();
++ channel_layout_config = input_params.channel_layout_config();
++ buffer_size = std::min(buffer_size, input_params.frames_per_buffer());
++ }
++
++ int user_buffer_size = GetUserBufferSize();
++ if (user_buffer_size)
++ buffer_size = user_buffer_size;
++
++ return AudioParameters(
++ AudioParameters::AUDIO_PCM_LOW_LATENCY,
++ channel_layout_config, sample_rate, buffer_size);
++}
++
++AudioInputStream* AudioManagerSndio::MakeInputStream(
++ const AudioParameters& params) {
++ DLOG(WARNING) << "MakeInputStream";
++ return new SndioAudioInputStream(this,
++ AudioDeviceDescription::kDefaultDeviceId, params);
++}
++
++AudioOutputStream* AudioManagerSndio::MakeOutputStream(
++ const AudioParameters& params) {
++ DLOG(WARNING) << "MakeOutputStream";
++ return new SndioAudioOutputStream(params, this);
++}
++#endif
++
++std::unique_ptr<media::AudioManager> CreateAudioManager(
++ std::unique_ptr<AudioThread> audio_thread,
++ AudioLogFactory* audio_log_factory) {
++ DLOG(WARNING) << "CreateAudioManager";
++ std::string audio_backend = kDefaultAudioBackend;
++
++ std::vector<std::string> kSupportedAudioBackends = {"auto"};
++
++#if defined(USE_SNDIO)
++ kSupportedAudioBackends.push_back(std::string("sndio"));
++#endif
++#if defined(USE_PULSEAUDIO)
++ kSupportedAudioBackends.push_back(std::string("pulse"));
++#endif
++#if defined(USE_ALSA)
++ kSupportedAudioBackends.push_back(std::string("alsa"));
++#endif
++
++ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
++ switches::kAudioBackend)) {
++ audio_backend = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
++ switches::kAudioBackend);
++ }
++
++ // For testing allow audio output to be disabled.
++ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
++ switches::kDisableAudioOutput)) {
++ return std::make_unique<FakeAudioManager>(std::move(audio_thread),
++ audio_log_factory);
++ }
++
++ if (std::find(std::begin(kSupportedAudioBackends), std::end(kSupportedAudioBackends),
++ audio_backend) == std::end(kSupportedAudioBackends)) {
++ LOG(ERROR) << "Unsupported audio backend specified. Falling back to " << kDefaultAudioBackend;
++ audio_backend = kDefaultAudioBackend;
++ }
++
++#if defined(USE_PULSEAUDIO)
++ pa_threaded_mainloop* pa_mainloop = nullptr;
++ pa_context* pa_context = nullptr;
++ if ((audio_backend != "sndio" && audio_backend != "alsa") &&
++ pulse::InitPulse(&pa_mainloop, &pa_context)) {
++ return std::make_unique<AudioManagerPulse>(
++ std::move(audio_thread), audio_log_factory, pa_mainloop, pa_context);
++ } else if (audio_backend == "auto") {
++ LOG(WARNING) << "Falling back to SNDIO for audio output. PulseAudio is not "
++ "available or could not be initialized.";
++ }
++#endif
++
++#if defined(USE_SNDIO)
++ if (audio_backend != "pulse" && audio_backend != "alsa") {
++ return std::make_unique<AudioManagerSndio>(std::move(audio_thread),
++ audio_log_factory);
++ } else if (audio_backend == "auto") {
++ LOG(WARNING) << "Falling back to ALSA audio output. SNDIO is not "
++ "available or could not be initialized.";
++ }
++#endif
++
++#if defined(USE_ALSA)
++ if (audio_backend != "pulse" && audio_backend != "sndio") {
++ return std::make_unique<AudioManagerAlsa>(std::move(audio_thread),
++ audio_log_factory);
++ } else if (audio_backend == "auto") {
++ LOG(WARNING) << "Falling back to fake audio output. ALSA is not "
++ "available or could not be initialized.";
++ }
++#endif
++
++ return std::make_unique<FakeAudioManager>(std::move(audio_thread),
++ audio_log_factory);
++}
++
++} // namespace media
diff --git a/devel/electron31/files/patch-media_audio_sndio_audio__manager__sndio.h b/devel/electron31/files/patch-media_audio_sndio_audio__manager__sndio.h
new file mode 100644
index 000000000000..33428cfc37d1
--- /dev/null
+++ b/devel/electron31/files/patch-media_audio_sndio_audio__manager__sndio.h
@@ -0,0 +1,69 @@
+--- media/audio/sndio/audio_manager_sndio.h.orig 2022-02-07 13:39:41 UTC
++++ media/audio/sndio/audio_manager_sndio.h
+@@ -0,0 +1,66 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef MEDIA_AUDIO_SNDIO_AUDIO_MANAGER_SNDIO_H_
++#define MEDIA_AUDIO_SNDIO_AUDIO_MANAGER_SNDIO_H_
++
++#include <set>
++
++#include "base/compiler_specific.h"
++#include "base/memory/ref_counted.h"
++#include "base/threading/thread.h"
++#include "media/audio/audio_manager_base.h"
++
++namespace media {
++
++class MEDIA_EXPORT AudioManagerSndio : public AudioManagerBase {
++ public:
++ AudioManagerSndio(std::unique_ptr<AudioThread> audio_thread,
++ AudioLogFactory* audio_log_factory);
++
++ AudioManagerSndio(const AudioManagerSndio&) = delete;
++ AudioManagerSndio& operator=(const AudioManagerSndio&) = delete;
++
++ ~AudioManagerSndio() override;
++
++ // Implementation of AudioManager.
++ bool HasAudioOutputDevices() override;
++ bool HasAudioInputDevices() override;
++ void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
++ void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override;
++ AudioParameters GetInputStreamParameters(
++ const std::string& device_id) override;
++ const char* GetName() override;
++
++ // Implementation of AudioManagerBase.
++ AudioOutputStream* MakeLinearOutputStream(
++ const AudioParameters& params,
++ const LogCallback& log_callback) override;
++ AudioOutputStream* MakeLowLatencyOutputStream(
++ const AudioParameters& params,
++ const std::string& device_id,
++ const LogCallback& log_callback) override;
++ AudioInputStream* MakeLinearInputStream(
++ const AudioParameters& params,
++ const std::string& device_id,
++ const LogCallback& log_callback) override;
++ AudioInputStream* MakeLowLatencyInputStream(
++ const AudioParameters& params,
++ const std::string& device_id,
++ const LogCallback& log_callback) override;
++
++ protected:
++ AudioParameters GetPreferredOutputStreamParameters(
++ const std::string& output_device_id,
++ const AudioParameters& input_params) override;
++
++ private:
++ // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream.
++ AudioOutputStream* MakeOutputStream(const AudioParameters& params);
++ AudioInputStream* MakeInputStream(const AudioParameters& params);
++};
++
++} // namespace media
++
++#endif // MEDIA_AUDIO_SNDIO_AUDIO_MANAGER_SNDIO_H_
diff --git a/devel/electron31/files/patch-media_audio_sndio_sndio__input.cc b/devel/electron31/files/patch-media_audio_sndio_sndio__input.cc
new file mode 100644
index 000000000000..f0c3135e90d2
--- /dev/null
+++ b/devel/electron31/files/patch-media_audio_sndio_sndio__input.cc
@@ -0,0 +1,203 @@
+--- media/audio/sndio/sndio_input.cc.orig 2023-06-07 04:52:29 UTC
++++ media/audio/sndio/sndio_input.cc
+@@ -0,0 +1,200 @@
++// Copyright 2013 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "base/logging.h"
++#include "media/base/audio_timestamp_helper.h"
++#include "media/audio/sndio/audio_manager_sndio.h"
++#include "media/audio/audio_manager.h"
++#include "media/audio/sndio/sndio_input.h"
++
++namespace media {
++
++static const SampleFormat kSampleFormat = kSampleFormatS16;
++
++void SndioAudioInputStream::OnMoveCallback(void *arg, int delta)
++{
++ SndioAudioInputStream* self = static_cast<SndioAudioInputStream*>(arg);
++
++ self->hw_delay += delta;
++}
++
++void *SndioAudioInputStream::ThreadEntry(void *arg) {
++ SndioAudioInputStream* self = static_cast<SndioAudioInputStream*>(arg);
++
++ self->ThreadLoop();
++ return NULL;
++}
++
++SndioAudioInputStream::SndioAudioInputStream(AudioManagerBase* manager,
++ const std::string& device_name,
++ const AudioParameters& params)
++ : manager(manager),
++ params(params),
++ audio_bus(AudioBus::Create(params)),
++ state(kClosed) {
++}
++
++SndioAudioInputStream::~SndioAudioInputStream() {
++ if (state != kClosed)
++ Close();
++}
++
++AudioInputStream::OpenOutcome SndioAudioInputStream::Open() {
++ struct sio_par par;
++ int sig;
++
++ if (state != kClosed)
++ return OpenOutcome::kFailed;
++
++ if (params.format() != AudioParameters::AUDIO_PCM_LINEAR &&
++ params.format() != AudioParameters::AUDIO_PCM_LOW_LATENCY) {
++ LOG(WARNING) << "Unsupported audio format.";
++ return OpenOutcome::kFailed;
++ }
++
++ sio_initpar(&par);
++ par.rate = params.sample_rate();
++ par.rchan = params.channels();
++ par.bits = SampleFormatToBitsPerChannel(kSampleFormat);
++ par.bps = par.bits / 8;
++ par.sig = sig = par.bits != 8 ? 1 : 0;
++ par.le = SIO_LE_NATIVE;
++ par.appbufsz = params.frames_per_buffer();
++
++ hdl = sio_open(SIO_DEVANY, SIO_REC, 0);
++
++ if (hdl == NULL) {
++ LOG(ERROR) << "Couldn't open audio device.";
++ return OpenOutcome::kFailed;
++ }
++
++ if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par)) {
++ LOG(ERROR) << "Couldn't set audio parameters.";
++ goto bad_close;
++ }
++
++ if (par.rate != (unsigned int)params.sample_rate() ||
++ par.rchan != (unsigned int)params.channels() ||
++ par.bits != (unsigned int)SampleFormatToBitsPerChannel(kSampleFormat) ||
++ par.sig != (unsigned int)sig ||
++ (par.bps > 1 && par.le != SIO_LE_NATIVE) ||
++ (par.bits != par.bps * 8)) {
++ LOG(ERROR) << "Unsupported audio parameters.";
++ goto bad_close;
++ }
++ state = kStopped;
++ buffer = new char[audio_bus->frames() * params.GetBytesPerFrame(kSampleFormat)];
++ sio_onmove(hdl, &OnMoveCallback, this);
++ return OpenOutcome::kSuccess;
++bad_close:
++ sio_close(hdl);
++ return OpenOutcome::kFailed;
++}
++
++void SndioAudioInputStream::Start(AudioInputCallback* cb) {
++
++ StartAgc();
++
++ state = kRunning;
++ hw_delay = 0;
++ callback = cb;
++ sio_start(hdl);
++ if (pthread_create(&thread, NULL, &ThreadEntry, this) != 0) {
++ LOG(ERROR) << "Failed to create real-time thread for recording.";
++ sio_stop(hdl);
++ state = kStopped;
++ }
++}
++
++void SndioAudioInputStream::Stop() {
++
++ if (state == kStopped)
++ return;
++
++ state = kStopWait;
++ pthread_join(thread, NULL);
++ sio_stop(hdl);
++ state = kStopped;
++
++ StopAgc();
++}
++
++void SndioAudioInputStream::Close() {
++
++ if (state == kClosed)
++ goto release;
++
++ if (state == kRunning)
++ Stop();
++
++ state = kClosed;
++ delete [] buffer;
++ sio_close(hdl);
++
++release:
++ manager->ReleaseInputStream(this);
++}
++
++double SndioAudioInputStream::GetMaxVolume() {
++ // Not supported
++ return 0.0;
++}
++
++void SndioAudioInputStream::SetVolume(double volume) {
++ // Not supported. Do nothing.
++}
++
++double SndioAudioInputStream::GetVolume() {
++ // Not supported.
++ return 0.0;
++}
++
++bool SndioAudioInputStream::IsMuted() {
++ // Not supported.
++ return false;
++}
++
++void SndioAudioInputStream::SetOutputDeviceForAec(
++ const std::string& output_device_id) {
++ // Not supported.
++}
++
++void SndioAudioInputStream::ThreadLoop(void) {
++ size_t todo, n;
++ char *data;
++ unsigned int nframes;
++ double normalized_volume = 0.0;
++
++ nframes = audio_bus->frames();
++
++ while (state == kRunning && !sio_eof(hdl)) {
++
++ GetAgcVolume(&normalized_volume);
++
++ // read one block
++ todo = nframes * params.GetBytesPerFrame(kSampleFormat);
++ data = buffer;
++ while (todo > 0) {
++ n = sio_read(hdl, data, todo);
++ if (n == 0)
++ return; // unrecoverable I/O error
++ todo -= n;
++ data += n;
++ }
++ hw_delay -= nframes;
++
++ // convert frames count to TimeDelta
++ const base::TimeDelta delay = AudioTimestampHelper::FramesToTime(hw_delay,
++ params.sample_rate());
++
++ // push into bus
++ audio_bus->FromInterleaved<SignedInt16SampleTypeTraits>(reinterpret_cast<int16_t*>(buffer), nframes);
++
++
++ // invoke callback
++ callback->OnData(audio_bus.get(), base::TimeTicks::Now() - delay, 1., {});
++ }
++}
++
++} // namespace media
diff --git a/devel/electron31/files/patch-media_audio_sndio_sndio__input.h b/devel/electron31/files/patch-media_audio_sndio_sndio__input.h
new file mode 100644
index 000000000000..b5684256703a
--- /dev/null
+++ b/devel/electron31/files/patch-media_audio_sndio_sndio__input.h
@@ -0,0 +1,94 @@
+--- media/audio/sndio/sndio_input.h.orig 2022-02-07 13:39:41 UTC
++++ media/audio/sndio/sndio_input.h
+@@ -0,0 +1,91 @@
++// Copyright 2013 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef MEDIA_AUDIO_SNDIO_SNDIO_INPUT_H_
++#define MEDIA_AUDIO_SNDIO_SNDIO_INPUT_H_
++
++#include <stdint.h>
++#include <string>
++#include <sndio.h>
++
++#include "base/compiler_specific.h"
++#include "base/memory/weak_ptr.h"
++#include "base/time/time.h"
++#include "media/audio/agc_audio_stream.h"
++#include "media/audio/audio_io.h"
++#include "media/audio/audio_device_description.h"
++#include "media/base/audio_parameters.h"
++
++namespace media {
++
++class AudioManagerBase;
++
++// Implementation of AudioOutputStream using sndio(7)
++class SndioAudioInputStream : public AgcAudioStream<AudioInputStream> {
++ public:
++ // Pass this to the constructor if you want to attempt auto-selection
++ // of the audio recording device.
++ static const char kAutoSelectDevice[];
++
++ // Create a PCM Output stream for the SNDIO device identified by
++ // |device_name|. If unsure of what to use for |device_name|, use
++ // |kAutoSelectDevice|.
++ SndioAudioInputStream(AudioManagerBase* audio_manager,
++ const std::string& device_name,
++ const AudioParameters& params);
++
++ SndioAudioInputStream(const SndioAudioInputStream&) = delete;
++ SndioAudioInputStream& operator=(const SndioAudioInputStream&) = delete;
++
++ ~SndioAudioInputStream() override;
++
++ // Implementation of AudioInputStream.
++ OpenOutcome Open() override;
++ void Start(AudioInputCallback* callback) override;
++ void Stop() override;
++ void Close() override;
++ double GetMaxVolume() override;
++ void SetVolume(double volume) override;
++ double GetVolume() override;
++ bool IsMuted() override;
++ void SetOutputDeviceForAec(const std::string& output_device_id) override;
++
++ private:
++
++ enum StreamState {
++ kClosed, // Not opened yet
++ kStopped, // Device opened, but not started yet
++ kRunning, // Started, device playing
++ kStopWait // Stopping, waiting for the real-time thread to exit
++ };
++
++ // C-style call-backs
++ static void OnMoveCallback(void *arg, int delta);
++ static void* ThreadEntry(void *arg);
++
++ // Continuously moves data from the device to the consumer
++ void ThreadLoop();
++ // Our creator, the audio manager needs to be notified when we close.
++ AudioManagerBase* manager;
++ // Parameters of the source
++ AudioParameters params;
++ // We store data here for consumer
++ std::unique_ptr<AudioBus> audio_bus;
++ // Call-back that consumes recorded data
++ AudioInputCallback* callback; // Valid during a recording session.
++ // Handle of the audio device
++ struct sio_hdl* hdl;
++ // Current state of the stream
++ enum StreamState state;
++ // High priority thread running ThreadLoop()
++ pthread_t thread;
++ // Number of frames buffered in the hardware
++ int hw_delay;
++ // Temporary buffer where data is stored sndio-compatible format
++ char* buffer;
++};
++
++} // namespace media
++
++#endif // MEDIA_AUDIO_SNDIO_SNDIO_INPUT_H_
diff --git a/devel/electron31/files/patch-media_audio_sndio_sndio__output.cc b/devel/electron31/files/patch-media_audio_sndio_sndio__output.cc
new file mode 100644
index 000000000000..2672bf645702
--- /dev/null
+++ b/devel/electron31/files/patch-media_audio_sndio_sndio__output.cc
@@ -0,0 +1,190 @@
+--- media/audio/sndio/sndio_output.cc.orig 2023-02-15 13:09:00 UTC
++++ media/audio/sndio/sndio_output.cc
+@@ -0,0 +1,187 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "base/logging.h"
++#include "base/time/time.h"
++#include "base/time/default_tick_clock.h"
++#include "media/audio/audio_manager_base.h"
++#include "media/base/audio_timestamp_helper.h"
++#include "media/audio/sndio/sndio_output.h"
++
++namespace media {
++
++static const SampleFormat kSampleFormat = kSampleFormatS16;
++
++void SndioAudioOutputStream::OnMoveCallback(void *arg, int delta) {
++ SndioAudioOutputStream* self = static_cast<SndioAudioOutputStream*>(arg);
++
++ self->hw_delay -= delta;
++}
++
++void SndioAudioOutputStream::OnVolCallback(void *arg, unsigned int vol) {
++ SndioAudioOutputStream* self = static_cast<SndioAudioOutputStream*>(arg);
++
++ self->vol = vol;
++}
++
++void *SndioAudioOutputStream::ThreadEntry(void *arg) {
++ SndioAudioOutputStream* self = static_cast<SndioAudioOutputStream*>(arg);
++
++ self->ThreadLoop();
++ return NULL;
++}
++
++SndioAudioOutputStream::SndioAudioOutputStream(const AudioParameters& params,
++ AudioManagerBase* manager)
++ : manager(manager),
++ params(params),
++ audio_bus(AudioBus::Create(params)),
++ state(kClosed),
++ mutex(PTHREAD_MUTEX_INITIALIZER) {
++}
++
++SndioAudioOutputStream::~SndioAudioOutputStream() {
++ if (state != kClosed)
++ Close();
++}
++
++bool SndioAudioOutputStream::Open() {
++ if (params.format() != AudioParameters::AUDIO_PCM_LINEAR &&
++ params.format() != AudioParameters::AUDIO_PCM_LOW_LATENCY) {
++ LOG(WARNING) << "Unsupported audio format.";
++ return false;
++ }
++ state = kStopped;
++ volpending = 0;
++ vol = SIO_MAXVOL;
++ buffer = new char[audio_bus->frames() * params.GetBytesPerFrame(kSampleFormat)];
++ return true;
++}
++
++void SndioAudioOutputStream::Close() {
++ if (state == kClosed)
++ goto release;
++ if (state == kRunning)
++ Stop();
++ state = kClosed;
++ delete [] buffer;
++release:
++ manager->ReleaseOutputStream(this); // Calls the destructor
++}
++
++void SndioAudioOutputStream::Start(AudioSourceCallback* callback) {
++ struct sio_par par;
++ int sig;
++
++ sio_initpar(&par);
++ par.rate = params.sample_rate();
++ par.pchan = params.channels();
++ par.bits = SampleFormatToBitsPerChannel(kSampleFormat);
++ par.bps = par.bits / 8;
++ par.sig = sig = par.bits != 8 ? 1 : 0;
++ par.le = SIO_LE_NATIVE;
++ par.appbufsz = params.frames_per_buffer();
++
++ hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0);
++ if (hdl == NULL) {
++ LOG(ERROR) << "Couldn't open audio device.";
++ return;
++ }
++ if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par)) {
++ LOG(ERROR) << "Couldn't set audio parameters.";
++ sio_close(hdl);
++ return;
++ }
++ if (par.rate != (unsigned int)params.sample_rate() ||
++ par.pchan != (unsigned int)params.channels() ||
++ par.bits != (unsigned int)SampleFormatToBitsPerChannel(kSampleFormat) ||
++ par.sig != (unsigned int)sig ||
++ (par.bps > 1 && par.le != SIO_LE_NATIVE) ||
++ (par.bits != par.bps * 8)) {
++ LOG(ERROR) << "Unsupported audio parameters.";
++ sio_close(hdl);
++ return;
++ }
++
++ sio_onmove(hdl, &OnMoveCallback, this);
++ sio_onvol(hdl, &OnVolCallback, this);
++
++ state = kRunning;
++ hw_delay = 0;
++ source = callback;
++ sio_start(hdl);
++
++ if (pthread_create(&thread, NULL, &ThreadEntry, this) != 0) {
++ LOG(ERROR) << "Failed to create real-time thread.";
++ sio_stop(hdl);
++ sio_close(hdl);
++ state = kStopped;
++ }
++}
++
++void SndioAudioOutputStream::Stop() {
++ if (state == kStopped)
++ return;
++ state = kStopWait;
++ pthread_join(thread, NULL);
++ sio_stop(hdl);
++ sio_close(hdl);
++ state = kStopped;
++}
++
++void SndioAudioOutputStream::SetVolume(double v) {
++ pthread_mutex_lock(&mutex);
++ vol = v * SIO_MAXVOL;
++ volpending = 1;
++ pthread_mutex_unlock(&mutex);
++}
++
++void SndioAudioOutputStream::GetVolume(double* v) {
++ pthread_mutex_lock(&mutex);
++ *v = vol * (1. / SIO_MAXVOL);
++ pthread_mutex_unlock(&mutex);
++}
++
++// This stream is always used with sub second buffer sizes, where it's
++// sufficient to simply always flush upon Start().
++void SndioAudioOutputStream::Flush() {}
++
++void SndioAudioOutputStream::ThreadLoop(void) {
++ int avail, count, result;
++
++ while (state == kRunning) {
++ // Update volume if needed
++ pthread_mutex_lock(&mutex);
++ if (volpending) {
++ volpending = 0;
++ sio_setvol(hdl, vol);
++ }
++ pthread_mutex_unlock(&mutex);
++
++ // Get data to play
++ const base::TimeDelta delay = AudioTimestampHelper::FramesToTime(hw_delay,
++ params.sample_rate());
++ count = source->OnMoreData(delay, base::TimeTicks::Now(), {}, audio_bus.get());
++ audio_bus->ToInterleaved<SignedInt16SampleTypeTraits>(count, reinterpret_cast<int16_t*>(buffer));
++ if (count == 0) {
++ // We have to submit something to the device
++ count = audio_bus->frames();
++ memset(buffer, 0, count * params.GetBytesPerFrame(kSampleFormat));
++ LOG(WARNING) << "No data to play, running empty cycle.";
++ }
++
++ // Submit data to the device
++ avail = count * params.GetBytesPerFrame(kSampleFormat);
++ result = sio_write(hdl, buffer, avail);
++ if (result == 0) {
++ LOG(WARNING) << "Audio device disconnected.";
++ break;
++ }
++
++ // Update hardware pointer
++ hw_delay += count;
++ }
++}
++
++} // namespace media
diff --git a/devel/electron31/files/patch-media_audio_sndio_sndio__output.h b/devel/electron31/files/patch-media_audio_sndio_sndio__output.h
new file mode 100644
index 000000000000..bb8603b68d9c
--- /dev/null
+++ b/devel/electron31/files/patch-media_audio_sndio_sndio__output.h
@@ -0,0 +1,91 @@
+--- media/audio/sndio/sndio_output.h.orig 2022-02-07 13:39:41 UTC
++++ media/audio/sndio/sndio_output.h
+@@ -0,0 +1,88 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef MEDIA_AUDIO_SNDIO_SNDIO_OUTPUT_H_
++#define MEDIA_AUDIO_SNDIO_SNDIO_OUTPUT_H_
++
++#include <pthread.h>
++#include <sndio.h>
++
++#include "base/time/tick_clock.h"
++#include "base/time/time.h"
++#include "media/audio/audio_io.h"
++
++namespace media {
++
++class AudioManagerBase;
++
++// Implementation of AudioOutputStream using sndio(7)
++class SndioAudioOutputStream : public AudioOutputStream {
++ public:
++ // The manager is creating this object
++ SndioAudioOutputStream(const AudioParameters& params,
++ AudioManagerBase* manager);
++
++ SndioAudioOutputStream(const SndioAudioOutputStream&) = delete;
++ SndioAudioOutputStream& operator=(const SndioAudioOutputStream&) = delete;
++
++ virtual ~SndioAudioOutputStream();
++
++ // Implementation of AudioOutputStream.
++ bool Open() override;
++ void Close() override;
++ void Start(AudioSourceCallback* callback) override;
++ void Stop() override;
++ void SetVolume(double volume) override;
++ void GetVolume(double* volume) override;
++ void Flush() override;
++
++ friend void sndio_onmove(void *arg, int delta);
++ friend void sndio_onvol(void *arg, unsigned int vol);
++ friend void *sndio_threadstart(void *arg);
++
++ private:
++ enum StreamState {
++ kClosed, // Not opened yet
++ kStopped, // Device opened, but not started yet
++ kRunning, // Started, device playing
++ kStopWait // Stopping, waiting for the real-time thread to exit
++ };
++
++ // C-style call-backs
++ static void OnMoveCallback(void *arg, int delta);
++ static void OnVolCallback(void *arg, unsigned int vol);
++ static void* ThreadEntry(void *arg);
++
++ // Continuously moves data from the producer to the device
++ void ThreadLoop(void);
++
++ // Our creator, the audio manager needs to be notified when we close.
++ AudioManagerBase* manager;
++ // Parameters of the source
++ AudioParameters params;
++ // Source stores data here
++ std::unique_ptr<AudioBus> audio_bus;
++ // Call-back that produces data to play
++ AudioSourceCallback* source;
++ // Handle of the audio device
++ struct sio_hdl* hdl;
++ // Current state of the stream
++ enum StreamState state;
++ // High priority thread running ThreadLoop()
++ pthread_t thread;
++ // Protects vol, volpending and hw_delay
++ pthread_mutex_t mutex;
++ // Current volume in the 0..SIO_MAXVOL range
++ int vol;
++ // Set to 1 if volumes must be refreshed in the realtime thread
++ int volpending;
++ // Number of frames buffered in the hardware
++ int hw_delay;
++ // Temporary buffer where data is stored sndio-compatible format
++ char* buffer;
++};
++
++} // namespace media
++
++#endif // MEDIA_AUDIO_SNDIO_SNDIO_OUTPUT_H_
diff --git a/devel/electron31/files/patch-media_base_audio__latency.cc b/devel/electron31/files/patch-media_base_audio__latency.cc
new file mode 100644
index 000000000000..0efa4319f0ee
--- /dev/null
+++ b/devel/electron31/files/patch-media_base_audio__latency.cc
@@ -0,0 +1,11 @@
+--- media/base/audio_latency.cc.orig 2023-03-30 00:33:53 UTC
++++ media/base/audio_latency.cc
+@@ -147,7 +147,7 @@ int AudioLatency::GetRtcBufferSize(int sample_rate, in
+ }
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_APPLE) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // On Linux, MacOS and Fuchsia, the low level IO implementations on the
+ // browser side supports all buffer size the clients want. We use the native
+ // peer connection buffer size (10ms) to achieve best possible performance.
diff --git a/devel/electron31/files/patch-media_base_libaom__thread__wrapper.cc b/devel/electron31/files/patch-media_base_libaom__thread__wrapper.cc
new file mode 100644
index 000000000000..d08a8992857e
--- /dev/null
+++ b/devel/electron31/files/patch-media_base_libaom__thread__wrapper.cc
@@ -0,0 +1,24 @@
+--- media/base/libaom_thread_wrapper.cc.orig 2024-04-15 20:34:00 UTC
++++ media/base/libaom_thread_wrapper.cc
+@@ -5,17 +5,21 @@
+ #include "base/logging.h"
+ #include "media/base/codec_worker_impl.h"
+ #include "media/base/libvpx_thread_wrapper.h"
++#if !BUILDFLAG(IS_BSD)
+ #include "third_party/libaom/source/libaom/aom_util/aom_thread.h"
++#endif
+
+ namespace media {
+
+ void InitLibAomThreadWrapper() {
++#if !BUILDFLAG(IS_BSD)
+ const AVxWorkerInterface interface =
+ CodecWorkerImpl<AVxWorkerInterface, AVxWorkerImpl, AVxWorker,
+ AVxWorkerStatus, AVX_WORKER_STATUS_NOT_OK,
+ AVX_WORKER_STATUS_OK,
+ AVX_WORKER_STATUS_WORKING>::GetCodecWorkerInterface();
+ CHECK(aom_set_worker_interface(&interface));
++#endif
+ }
+
+ } // namespace media
diff --git a/devel/electron31/files/patch-media_base_libvpx__thread__wrapper.cc b/devel/electron31/files/patch-media_base_libvpx__thread__wrapper.cc
new file mode 100644
index 000000000000..db10f013d75d
--- /dev/null
+++ b/devel/electron31/files/patch-media_base_libvpx__thread__wrapper.cc
@@ -0,0 +1,25 @@
+--- media/base/libvpx_thread_wrapper.cc.orig 2024-04-15 20:34:00 UTC
++++ media/base/libvpx_thread_wrapper.cc
+@@ -5,11 +5,14 @@
+ #include "media/base/libvpx_thread_wrapper.h"
+
+ #include "media/base/codec_worker_impl.h"
++#if !BUILDFLAG(IS_OPENBSD)
+ #include "third_party/libvpx/source/libvpx/vpx_util/vpx_thread.h"
++#endif
+
+ namespace media {
+
+ void InitLibVpxThreadWrapper() {
++#if !BUILDFLAG(IS_OPENBSD)
+ const VPxWorkerInterface interface =
+ CodecWorkerImpl<VPxWorkerInterface, VPxWorkerImpl, VPxWorker,
+ VPxWorkerStatus, VPX_WORKER_STATUS_NOT_OK,
+@@ -17,6 +20,7 @@ void InitLibVpxThreadWrapper() {
+ VPX_WORKER_STATUS_WORKING>::GetCodecWorkerInterface();
+
+ CHECK(vpx_set_worker_interface(&interface));
++#endif
+ }
+
+ } // namespace media
diff --git a/devel/electron31/files/patch-media_base_media__switches.cc b/devel/electron31/files/patch-media_base_media__switches.cc
new file mode 100644
index 000000000000..996c44ef584b
--- /dev/null
+++ b/devel/electron31/files/patch-media_base_media__switches.cc
@@ -0,0 +1,114 @@
+--- media/base/media_switches.cc.orig 2024-06-18 21:43:35 UTC
++++ media/base/media_switches.cc
+@@ -21,7 +21,7 @@
+ #include "ui/gl/gl_features.h"
+ #include "ui/gl/gl_utils.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/cpu.h"
+ #endif
+
+@@ -60,6 +60,10 @@ const char kReportVp9AsAnUnsupportedMimeType[] =
+ const char kReportVp9AsAnUnsupportedMimeType[] =
+ "report-vp9-as-an-unsupported-mime-type";
+
++#if BUILDFLAG(IS_BSD)
++const char kAudioBackend[] = "audio-backend";
++#endif
++
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FREEBSD) || \
+ BUILDFLAG(IS_SOLARIS)
+ // The Alsa device to use when opening an audio input stream.
+@@ -368,8 +372,8 @@ BASE_FEATURE(kMacLoopbackAudioForScreenShare,
+ "MacLoopbackAudioForScreenShare",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+ #endif // BUILDFLAG(IS_MAC)
+-
+-#if BUILDFLAG(IS_LINUX)
++
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Enables system audio mirroring using pulseaudio.
+ BASE_FEATURE(kPulseaudioLoopbackForCast,
+ "PulseaudioLoopbackForCast",
+@@ -688,7 +692,7 @@ BASE_FEATURE(kGlobalMediaControls,
+ // Show toolbar button that opens dialog for controlling media sessions.
+ BASE_FEATURE(kGlobalMediaControls,
+ "GlobalMediaControls",
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -716,7 +720,7 @@ BASE_FEATURE(kMediaRemotingWithoutFullscreen,
+ // If enabled, users can request Media Remoting without fullscreen-in-tab.
+ BASE_FEATURE(kMediaRemotingWithoutFullscreen,
+ "MediaRemotingWithoutFullscreen",
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -728,7 +732,7 @@ BASE_FEATURE(kGlobalMediaControlsPictureInPicture,
+ BASE_FEATURE(kGlobalMediaControlsPictureInPicture,
+ "GlobalMediaControlsPictureInPicture",
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -757,7 +761,7 @@ BASE_FEATURE(kUnifiedAutoplay,
+ "UnifiedAutoplay",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Enable vaapi video decoding on linux. This is already enabled by default on
+ // chromeos, but needs an experiment on linux.
+ BASE_FEATURE(kVaapiVideoDecodeLinux,
+@@ -848,7 +852,7 @@ BASE_FEATURE(kVaapiVp9SModeHWEncoding,
+ "VaapiVp9SModeHWEncoding",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+ #endif // defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_CHROMEOS)
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Enables the new V4L2 flat video decoder clients instead of V4L2VideoDecoder.
+ // Owners: frkoenig@chromium.org, mcasas@chromium.org
+ // Expiry: When flat decoders are supported on all platforms and the legacy
+@@ -978,7 +982,7 @@ BASE_FEATURE(kLiveCaptionMultiLanguage,
+ // Live Caption can be used in multiple languages, as opposed to just English.
+ BASE_FEATURE(kLiveCaptionMultiLanguage,
+ "LiveCaptionMultiLanguage",
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -1008,7 +1012,7 @@ BASE_FEATURE(kLiveTranslate,
+ // Live Translate translates captions generated by Live Caption.
+ BASE_FEATURE(kLiveTranslate,
+ "LiveTranslate",
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -1472,7 +1476,7 @@ BASE_FEATURE(kUseGTFOOutOfProcessVideoDecoding,
+ base::FEATURE_DISABLED_BY_DEFAULT);
+ #endif // BUILDFLAG(ALLOW_OOP_VIDEO_DECODER)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Spawn utility processes to perform hardware encode acceleration instead of
+ // using the GPU process.
+ BASE_FEATURE(kUseOutOfProcessVideoEncoding,
+@@ -1552,7 +1556,7 @@ BASE_FEATURE(kRecordWebAudioEngagement,
+ "RecordWebAudioEngagement",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Reduces the number of buffers needed in the output video frame pool to
+ // populate the Renderer pipeline for hardware accelerated VideoDecoder in
+ // non-low latency scenarios.
diff --git a/devel/electron31/files/patch-media_base_media__switches.h b/devel/electron31/files/patch-media_base_media__switches.h
new file mode 100644
index 000000000000..beb96ef34bb0
--- /dev/null
+++ b/devel/electron31/files/patch-media_base_media__switches.h
@@ -0,0 +1,56 @@
+--- media/base/media_switches.h.orig 2024-06-18 21:43:35 UTC
++++ media/base/media_switches.h
+@@ -43,6 +43,10 @@ MEDIA_EXPORT extern const char kReportVp9AsAnUnsupport
+
+ MEDIA_EXPORT extern const char kReportVp9AsAnUnsupportedMimeType[];
+
++#if BUILDFLAG(IS_BSD)
++MEDIA_EXPORT extern const char kAudioBackend[];
++#endif
++
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FREEBSD) || \
+ BUILDFLAG(IS_SOLARIS)
+ MEDIA_EXPORT extern const char kAlsaInputDevice[];
+@@ -324,13 +328,13 @@ MEDIA_EXPORT BASE_DECLARE_FEATURE(kPreloadMetadataSusp
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kPlaybackSpeedButton);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kPreloadMediaEngagementData);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kPreloadMetadataSuspend);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kPulseaudioLoopbackForCast);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kPulseaudioLoopbackForScreenShare);
+ #endif // BUILDFLAG(IS_LINUX)
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kRecordMediaEngagementScores);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kRecordWebAudioEngagement);
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kReduceHardwareVideoDecoderBuffers);
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kResumeBackgroundVideo);
+@@ -345,7 +349,7 @@ MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseFakeDeviceForMed
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseAndroidOverlayForSecureOnly);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseDecoderStreamForWebRTC);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseFakeDeviceForMediaStream);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVideoDecodeLinux);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVideoDecodeLinuxGL);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVideoEncodeLinux);
+@@ -364,7 +368,7 @@ MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVp9SModeHWEnco
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVp8TemporalLayerHWEncoding);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVp9SModeHWEncoding);
+ #endif // defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_CHROMEOS)
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kV4L2FlatVideoDecoder);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kV4L2FlatStatefulVideoDecoder);
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+@@ -506,7 +510,7 @@ MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseGTFOOutOfProcess
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseGTFOOutOfProcessVideoDecoding);
+ #endif // BUILDFLAG(ALLOW_OOP_VIDEO_DECODER)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseOutOfProcessVideoEncoding);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
diff --git a/devel/electron31/files/patch-media_base_user__input__monitor__unittest.cc b/devel/electron31/files/patch-media_base_user__input__monitor__unittest.cc
new file mode 100644
index 000000000000..15d4c34336ae
--- /dev/null
+++ b/devel/electron31/files/patch-media_base_user__input__monitor__unittest.cc
@@ -0,0 +1,29 @@
+--- media/base/user_input_monitor_unittest.cc.orig 2023-02-01 18:43:22 UTC
++++ media/base/user_input_monitor_unittest.cc
+@@ -13,7 +13,7 @@
+ #include "build/build_config.h"
+ #include "testing/gtest/include/gtest/gtest.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/files/file_descriptor_watcher_posix.h"
+ #endif
+
+@@ -49,7 +49,7 @@ class UserInputMonitorTest : public testing::Test {
+ } // namespace
+
+ TEST_F(UserInputMonitorTest, CreatePlatformSpecific) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::test::TaskEnvironment task_environment(
+ base::test::TaskEnvironment::MainThreadType::IO);
+ #else
+@@ -72,7 +72,7 @@ TEST_F(UserInputMonitorTest, CreatePlatformSpecific) {
+ }
+
+ TEST_F(UserInputMonitorTest, CreatePlatformSpecificWithMapping) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::test::TaskEnvironment task_environment(
+ base::test::TaskEnvironment::MainThreadType::IO);
+ #else
diff --git a/devel/electron31/files/patch-media_base_video__frame.cc b/devel/electron31/files/patch-media_base_video__frame.cc
new file mode 100644
index 000000000000..2e772a8f2406
--- /dev/null
+++ b/devel/electron31/files/patch-media_base_video__frame.cc
@@ -0,0 +1,74 @@
+--- media/base/video_frame.cc.orig 2024-06-18 21:43:35 UTC
++++ media/base/video_frame.cc
+@@ -80,7 +80,7 @@ std::string VideoFrame::StorageTypeToString(
+ return "OWNED_MEMORY";
+ case VideoFrame::STORAGE_SHMEM:
+ return "SHMEM";
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ case VideoFrame::STORAGE_DMABUFS:
+ return "DMABUFS";
+ #endif
+@@ -95,7 +95,7 @@ bool VideoFrame::IsStorageTypeMappable(VideoFrame::Sto
+ // static
+ bool VideoFrame::IsStorageTypeMappable(VideoFrame::StorageType storage_type) {
+ return
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // This is not strictly needed but makes explicit that, at VideoFrame
+ // level, DmaBufs are not mappable from userspace.
+ storage_type != VideoFrame::STORAGE_DMABUFS &&
+@@ -306,7 +306,7 @@ static std::optional<VideoFrameLayout> GetDefaultLayou
+ return VideoFrameLayout::CreateWithPlanes(format, coded_size, planes);
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // This class allows us to embed a vector<ScopedFD> into a scoped_refptr, and
+ // thus to have several VideoFrames share the same set of DMABUF FDs.
+ class VideoFrame::DmabufHolder
+@@ -440,7 +440,7 @@ scoped_refptr<VideoFrame> VideoFrame::CreateFrameForGp
+ planes[i].stride = gpu_memory_buffer->stride(i);
+ }
+ uint64_t modifier = gfx::NativePixmapHandle::kNoModifier;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (gpu_memory_buffer->GetType() == gfx::NATIVE_PIXMAP) {
+ const auto gmb_handle = gpu_memory_buffer->CloneHandle();
+ if (gmb_handle.is_null() ||
+@@ -778,7 +778,7 @@ scoped_refptr<VideoFrame> VideoFrame::WrapExternalGpuM
+ return frame;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // static
+ scoped_refptr<VideoFrame> VideoFrame::WrapExternalDmabufs(
+ const VideoFrameLayout& layout,
+@@ -997,7 +997,7 @@ scoped_refptr<VideoFrame> VideoFrame::WrapVideoFrame(
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ DCHECK(frame->dmabuf_fds_);
+ // If there are any |dmabuf_fds_| plugged in, we should refer them too.
+ wrapping_frame->dmabuf_fds_ = frame->dmabuf_fds_;
+@@ -1471,7 +1471,7 @@ scoped_refptr<gpu::ClientSharedImage> VideoFrame::shar
+ : shared_images_[texture_index];
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ size_t VideoFrame::NumDmabufFds() const {
+ return dmabuf_fds_->size();
+ }
+@@ -1588,7 +1588,7 @@ VideoFrame::VideoFrame(const VideoFrameLayout& layout,
+ storage_type_(storage_type),
+ visible_rect_(Intersection(visible_rect, gfx::Rect(layout.coded_size()))),
+ natural_size_(natural_size),
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ dmabuf_fds_(base::MakeRefCounted<DmabufHolder>()),
+ #endif
+ timestamp_(timestamp),
diff --git a/devel/electron31/files/patch-media_base_video__frame.h b/devel/electron31/files/patch-media_base_video__frame.h
new file mode 100644
index 000000000000..6084651bf41c
--- /dev/null
+++ b/devel/electron31/files/patch-media_base_video__frame.h
@@ -0,0 +1,47 @@
+--- media/base/video_frame.h.orig 2024-06-18 21:43:35 UTC
++++ media/base/video_frame.h
+@@ -45,7 +45,7 @@
+ #include "base/apple/scoped_cftyperef.h"
+ #endif // BUILDFLAG(IS_APPLE)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/files/scoped_file.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+@@ -111,7 +111,7 @@ class MEDIA_EXPORT VideoFrame : public base::RefCounte
+ STORAGE_UNOWNED_MEMORY = 2, // External, non owned data pointers.
+ STORAGE_OWNED_MEMORY = 3, // VideoFrame has allocated its own data buffer.
+ STORAGE_SHMEM = 4, // Backed by read-only shared memory.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // TODO(mcasas): Consider turning this type into STORAGE_NATIVE
+ // based on the idea of using this same enum value for both DMA
+ // buffers on Linux and CVPixelBuffers on Mac (which currently use
+@@ -341,7 +341,7 @@ class MEDIA_EXPORT VideoFrame : public base::RefCounte
+ ReleaseMailboxAndGpuMemoryBufferCB mailbox_holder_and_gmb_release_cb,
+ base::TimeDelta timestamp);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Wraps provided dmabufs
+ // (https://www.kernel.org/doc/html/latest/driver-api/dma-buf.html) with a
+ // VideoFrame. The frame will take ownership of |dmabuf_fds|, and will
+@@ -650,7 +650,7 @@ class MEDIA_EXPORT VideoFrame : public base::RefCounte
+ scoped_refptr<gpu::ClientSharedImage> shared_image(
+ size_t texture_index) const;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // The number of DmaBufs will be equal or less than the number of planes of
+ // the frame. If there are less, this means that the last FD contains the
+ // remaining planes. Should be > 0 for STORAGE_DMABUFS.
+@@ -886,7 +886,7 @@ class MEDIA_EXPORT VideoFrame : public base::RefCounte
+ // GPU memory buffer, if this frame is STORAGE_GPU_MEMORY_BUFFER.
+ std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer_;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ class DmabufHolder;
+
+ // Dmabufs for the frame, used when storage is STORAGE_DMABUFS. Size is either
diff --git a/devel/electron31/files/patch-media_capture_video_create__video__capture__device__factory.cc b/devel/electron31/files/patch-media_capture_video_create__video__capture__device__factory.cc
new file mode 100644
index 000000000000..d6dc7e2bf5ec
--- /dev/null
+++ b/devel/electron31/files/patch-media_capture_video_create__video__capture__device__factory.cc
@@ -0,0 +1,20 @@
+--- media/capture/video/create_video_capture_device_factory.cc.orig 2023-03-30 00:33:53 UTC
++++ media/capture/video/create_video_capture_device_factory.cc
+@@ -13,7 +13,7 @@
+ #include "media/capture/video/fake_video_capture_device_factory.h"
+ #include "media/capture/video/file_video_capture_device_factory.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #include "media/capture/video/linux/video_capture_device_factory_linux.h"
+ #elif BUILDFLAG(IS_CHROMEOS_ASH)
+ #include "media/capture/video/chromeos/public/cros_features.h"
+@@ -56,7 +56,7 @@ CreateFakeVideoCaptureDeviceFactory() {
+ std::unique_ptr<VideoCaptureDeviceFactory>
+ CreatePlatformSpecificVideoCaptureDeviceFactory(
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ return std::make_unique<VideoCaptureDeviceFactoryLinux>(ui_task_runner);
+ #elif BUILDFLAG(IS_CHROMEOS_ASH)
+ if (base::SysInfo::IsRunningOnChromeOS())
diff --git a/devel/electron31/files/patch-media_capture_video_fake__video__capture__device__factory.cc b/devel/electron31/files/patch-media_capture_video_fake__video__capture__device__factory.cc
new file mode 100644
index 000000000000..b610d6a77eac
--- /dev/null
+++ b/devel/electron31/files/patch-media_capture_video_fake__video__capture__device__factory.cc
@@ -0,0 +1,11 @@
+--- media/capture/video/fake_video_capture_device_factory.cc.orig 2024-06-18 21:43:35 UTC
++++ media/capture/video/fake_video_capture_device_factory.cc
+@@ -231,7 +231,7 @@ void FakeVideoCaptureDeviceFactory::GetDevicesInfo(
+ int entry_index = 0;
+ for (const auto& entry : devices_config_) {
+ VideoCaptureApi api =
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE;
+ #elif BUILDFLAG(IS_IOS)
+ VideoCaptureApi::UNKNOWN;
diff --git a/devel/electron31/files/patch-media_capture_video_file__video__capture__device__factory.cc b/devel/electron31/files/patch-media_capture_video_file__video__capture__device__factory.cc
new file mode 100644
index 000000000000..91bf3d7255cc
--- /dev/null
+++ b/devel/electron31/files/patch-media_capture_video_file__video__capture__device__factory.cc
@@ -0,0 +1,11 @@
+--- media/capture/video/file_video_capture_device_factory.cc.orig 2022-02-28 16:54:41 UTC
++++ media/capture/video/file_video_capture_device_factory.cc
+@@ -52,7 +52,7 @@ void FileVideoCaptureDeviceFactory::GetDevicesInfo(
+ VideoCaptureApi::WIN_DIRECT_SHOW;
+ #elif BUILDFLAG(IS_MAC)
+ VideoCaptureApi::MACOSX_AVFOUNDATION;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE;
+ #else
+ VideoCaptureApi::UNKNOWN;
diff --git a/devel/electron31/files/patch-media_capture_video_linux_fake__v4l2__impl.cc b/devel/electron31/files/patch-media_capture_video_linux_fake__v4l2__impl.cc
new file mode 100644
index 000000000000..ab945731ae3e
--- /dev/null
+++ b/devel/electron31/files/patch-media_capture_video_linux_fake__v4l2__impl.cc
@@ -0,0 +1,11 @@
+--- media/capture/video/linux/fake_v4l2_impl.cc.orig 2024-04-15 20:34:01 UTC
++++ media/capture/video/linux/fake_v4l2_impl.cc
+@@ -562,7 +562,7 @@ int FakeV4L2Impl::close(int fd) {
+ return kSuccessReturnValue;
+ }
+
+-int FakeV4L2Impl::ioctl(int fd, int request, void* argp) {
++int FakeV4L2Impl::ioctl(int fd, unsigned long request, void* argp) {
+ base::AutoLock lock(lock_);
+ auto device_iter = opened_devices_.find(fd);
+ if (device_iter == opened_devices_.end())
diff --git a/devel/electron31/files/patch-media_capture_video_linux_fake__v4l2__impl.h b/devel/electron31/files/patch-media_capture_video_linux_fake__v4l2__impl.h
new file mode 100644
index 000000000000..ce6bba028f1c
--- /dev/null
+++ b/devel/electron31/files/patch-media_capture_video_linux_fake__v4l2__impl.h
@@ -0,0 +1,25 @@
+--- media/capture/video/linux/fake_v4l2_impl.h.orig 2023-10-19 19:58:26 UTC
++++ media/capture/video/linux/fake_v4l2_impl.h
+@@ -8,7 +8,13 @@
+ #include <map>
+ #include <string>
+
++#include "build/build_config.h"
++#if BUILDFLAG(IS_OPENBSD)
++#include <sys/videoio.h>
++typedef __uint32_t __u32;
++#else
+ #include <linux/videodev2.h>
++#endif
+
+ #include "base/synchronization/lock.h"
+ #include "media/capture/capture_export.h"
+@@ -38,7 +44,7 @@ class CAPTURE_EXPORT FakeV4L2Impl : public V4L2Capture
+ // Implementation of V4L2CaptureDevice interface:
+ int open(const char* device_name, int flags) override;
+ int close(int fd) override;
+- int ioctl(int fd, int request, void* argp) override;
++ int ioctl(int fd, unsigned long request, void* argp) override;
+ void* mmap(void* start,
+ size_t length,
+ int prot,
diff --git a/devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__delegate.cc b/devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__delegate.cc
new file mode 100644
index 000000000000..ba05197ad2a1
--- /dev/null
+++ b/devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__delegate.cc
@@ -0,0 +1,156 @@
+--- media/capture/video/linux/v4l2_capture_delegate.cc.orig 2024-02-21 00:20:49 UTC
++++ media/capture/video/linux/v4l2_capture_delegate.cc
+@@ -5,8 +5,10 @@
+ #include "media/capture/video/linux/v4l2_capture_delegate.h"
+
+ #include <fcntl.h>
++#if !BUILDFLAG(IS_BSD)
+ #include <linux/version.h>
+ #include <linux/videodev2.h>
++#endif
+ #include <poll.h>
+ #include <sys/ioctl.h>
+ #include <sys/mman.h>
+@@ -27,17 +29,19 @@
+ #include "media/capture/video/blob_utils.h"
+ #include "media/capture/video/linux/video_capture_device_linux.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "media/capture/capture_switches.h"
+ #include "media/capture/video/linux/v4l2_capture_delegate_gpu_helper.h"
+ #endif // BUILDFLAG(IS_LINUX)
+
+ using media::mojom::MeteringMode;
+
++#if !BUILDFLAG(IS_BSD)
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
+ // 16 bit depth, Realsense F200.
+ #define V4L2_PIX_FMT_Z16 v4l2_fourcc('Z', '1', '6', ' ')
+ #endif
++#endif
+
+ // TODO(aleksandar.stojiljkovic): Wrap this with kernel version check once the
+ // format is introduced to kernel.
+@@ -47,6 +51,14 @@ using media::mojom::MeteringMode;
+ #define V4L2_PIX_FMT_INVZ v4l2_fourcc('I', 'N', 'V', 'Z')
+ #endif
+
++#ifndef V4L2_COLORSPACE_OPRGB
++#define V4L2_COLORSPACE_OPRGB V4L2_COLORSPACE_ADOBERGB
++#endif
++
++#ifndef V4L2_XFER_FUNC_OPRGB
++#define V4L2_XFER_FUNC_OPRGB V4L2_XFER_FUNC_ADOBERGB
++#endif
++
+ namespace media {
+
+ namespace {
+@@ -264,7 +276,7 @@ bool V4L2CaptureDelegate::IsControllableControl(
+ // static
+ bool V4L2CaptureDelegate::IsControllableControl(
+ int control_id,
+- const base::RepeatingCallback<int(int, void*)>& do_ioctl) {
++ const base::RepeatingCallback<int(unsigned int, void*)>& do_ioctl) {
+ const int special_control_id = GetControllingSpecialControl(control_id);
+ if (!special_control_id) {
+ // The control is not controlled by a special control thus the control is
+@@ -320,7 +332,7 @@ V4L2CaptureDelegate::V4L2CaptureDelegate(
+ is_capturing_(false),
+ timeout_count_(0),
+ rotation_(rotation) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ use_gpu_buffer_ = switches::IsVideoCaptureUseGpuMemoryBufferEnabled();
+ #endif // BUILDFLAG(IS_LINUX)
+ }
+@@ -447,7 +459,7 @@ void V4L2CaptureDelegate::AllocateAndStart(
+
+ client_->OnStarted();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (use_gpu_buffer_) {
+ v4l2_gpu_helper_ = std::make_unique<V4L2CaptureDelegateGpuHelper>(
+ std::move(gmb_support_test_));
+@@ -797,7 +809,7 @@ V4L2CaptureDelegate::~V4L2CaptureDelegate() = default;
+
+ V4L2CaptureDelegate::~V4L2CaptureDelegate() = default;
+
+-bool V4L2CaptureDelegate::RunIoctl(int request, void* argp) {
++bool V4L2CaptureDelegate::RunIoctl(unsigned int request, void* argp) {
+ int num_retries = 0;
+ for (; DoIoctl(request, argp) < 0 && num_retries < kMaxIOCtrlRetries;
+ ++num_retries) {
+@@ -807,7 +819,7 @@ bool V4L2CaptureDelegate::RunIoctl(int request, void*
+ return num_retries != kMaxIOCtrlRetries;
+ }
+
+-int V4L2CaptureDelegate::DoIoctl(int request, void* argp) {
++int V4L2CaptureDelegate::DoIoctl(unsigned int request, void* argp) {
+ return HANDLE_EINTR(v4l2_->ioctl(device_fd_.get(), request, argp));
+ }
+
+@@ -818,6 +830,7 @@ void V4L2CaptureDelegate::ReplaceControlEventSubscript
+ }
+
+ void V4L2CaptureDelegate::ReplaceControlEventSubscriptions() {
++#if !BUILDFLAG(IS_BSD)
+ constexpr uint32_t kControlIds[] = {V4L2_CID_AUTO_EXPOSURE_BIAS,
+ V4L2_CID_AUTO_WHITE_BALANCE,
+ V4L2_CID_BRIGHTNESS,
+@@ -845,6 +858,7 @@ void V4L2CaptureDelegate::ReplaceControlEventSubscript
+ << ", {type = V4L2_EVENT_CTRL, id = " << control_id << "}";
+ }
+ }
++#endif
+ }
+
+ mojom::RangePtr V4L2CaptureDelegate::RetrieveUserControlRange(int control_id) {
+@@ -1025,7 +1039,11 @@ void V4L2CaptureDelegate::DoCapture() {
+
+ pollfd device_pfd = {};
+ device_pfd.fd = device_fd_.get();
++#if !BUILDFLAG(IS_BSD)
+ device_pfd.events = POLLIN | POLLPRI;
++#else
++ device_pfd.events = POLLIN;
++#endif
+
+ const int result =
+ HANDLE_EINTR(v4l2_->poll(&device_pfd, 1, kCaptureTimeoutMs));
+@@ -1063,6 +1081,7 @@ void V4L2CaptureDelegate::DoCapture() {
+ timeout_count_ = 0;
+ }
+
++#if !BUILDFLAG(IS_BSD)
+ // Dequeue events if the driver has filled in some.
+ if (device_pfd.revents & POLLPRI) {
+ bool controls_changed = false;
+@@ -1097,6 +1116,7 @@ void V4L2CaptureDelegate::DoCapture() {
+ client_->OnCaptureConfigurationChanged();
+ }
+ }
++#endif
+
+ // Deenqueue, send and reenqueue a buffer if the driver has filled one in.
+ if (device_pfd.revents & POLLIN) {
+@@ -1150,7 +1170,7 @@ void V4L2CaptureDelegate::DoCapture() {
+ // workable on Linux.
+
+ // See http://crbug.com/959919.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (use_gpu_buffer_) {
+ v4l2_gpu_helper_->OnIncomingCapturedData(
+ client_.get(), buffer_tracker->start(),
+@@ -1223,7 +1243,7 @@ void V4L2CaptureDelegate::SetErrorState(VideoCaptureEr
+ client_->OnError(error, from_here, reason);
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ gfx::ColorSpace V4L2CaptureDelegate::BuildColorSpaceFromv4l2() {
+ v4l2_colorspace v4l2_primary = (v4l2_colorspace)video_fmt_.fmt.pix.colorspace;
+ v4l2_quantization v4l2_range =
diff --git a/devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__delegate.h b/devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__delegate.h
new file mode 100644
index 000000000000..3adf1ccdcb47
--- /dev/null
+++ b/devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__delegate.h
@@ -0,0 +1,51 @@
+--- media/capture/video/linux/v4l2_capture_delegate.h.orig 2023-10-19 19:58:26 UTC
++++ media/capture/video/linux/v4l2_capture_delegate.h
+@@ -35,7 +35,7 @@ class Location;
+
+ namespace media {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ class V4L2CaptureDelegateGpuHelper;
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -86,7 +86,7 @@ class CAPTURE_EXPORT V4L2CaptureDelegate final {
+ static bool IsBlockedControl(int control_id);
+ static bool IsControllableControl(
+ int control_id,
+- const base::RepeatingCallback<int(int, void*)>& do_ioctl);
++ const base::RepeatingCallback<int(unsigned int, void*)>& do_ioctl);
+
+ void SetGPUEnvironmentForTesting(
+ std::unique_ptr<gpu::GpuMemoryBufferSupport> gmb_support);
+@@ -100,10 +100,10 @@ class CAPTURE_EXPORT V4L2CaptureDelegate final {
+ // device file descriptor or (re)starting streaming, can fail but works after
+ // retrying (https://crbug.com/670262). Returns false if the |request| ioctl
+ // fails too many times.
+- bool RunIoctl(int request, void* argp);
++ bool RunIoctl(unsigned int request, void* argp);
+
+ // Simple wrapper to do HANDLE_EINTR(v4l2_->ioctl(device_fd_.get(), ...)).
+- int DoIoctl(int request, void* argp);
++ int DoIoctl(unsigned int request, void* argp);
+
+ // Check whether the control is controllable (and not changed automatically).
+ bool IsControllableControl(int control_id);
+@@ -133,7 +133,7 @@ class CAPTURE_EXPORT V4L2CaptureDelegate final {
+ const base::Location& from_here,
+ const std::string& reason);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Systems which describe a "color space" usually map that to one or more of
+ // {primary, matrix, transfer, range}. BuildColorSpaceFromv4l2() will use the
+ // matched value as first priority. Otherwise, if there is no best matching
+@@ -167,7 +167,7 @@ class CAPTURE_EXPORT V4L2CaptureDelegate final {
+ // Clockwise rotation in degrees. This value should be 0, 90, 180, or 270.
+ int rotation_;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Support GPU memory buffer.
+ bool use_gpu_buffer_;
+ std::unique_ptr<V4L2CaptureDelegateGpuHelper> v4l2_gpu_helper_;
diff --git a/devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__device.h b/devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__device.h
new file mode 100644
index 000000000000..cbba776523a9
--- /dev/null
+++ b/devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__device.h
@@ -0,0 +1,11 @@
+--- media/capture/video/linux/v4l2_capture_device.h.orig 2022-02-07 13:39:41 UTC
++++ media/capture/video/linux/v4l2_capture_device.h
+@@ -21,7 +21,7 @@ class CAPTURE_EXPORT V4L2CaptureDevice
+ public:
+ virtual int open(const char* device_name, int flags) = 0;
+ virtual int close(int fd) = 0;
+- virtual int ioctl(int fd, int request, void* argp) = 0;
++ virtual int ioctl(int fd, unsigned long request, void* argp) = 0;
+ virtual void* mmap(void* start,
+ size_t length,
+ int prot,
diff --git a/devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__device__impl.cc b/devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__device__impl.cc
new file mode 100644
index 000000000000..902427b862a2
--- /dev/null
+++ b/devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__device__impl.cc
@@ -0,0 +1,11 @@
+--- media/capture/video/linux/v4l2_capture_device_impl.cc.orig 2022-02-07 13:39:41 UTC
++++ media/capture/video/linux/v4l2_capture_device_impl.cc
+@@ -22,7 +22,7 @@ int V4L2CaptureDeviceImpl::close(int fd) {
+ return ::close(fd);
+ }
+
+-int V4L2CaptureDeviceImpl::ioctl(int fd, int request, void* argp) {
++int V4L2CaptureDeviceImpl::ioctl(int fd, unsigned long request, void* argp) {
+ return ::ioctl(fd, request, argp);
+ }
+
diff --git a/devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__device__impl.h b/devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__device__impl.h
new file mode 100644
index 000000000000..21a77244eca8
--- /dev/null
+++ b/devel/electron31/files/patch-media_capture_video_linux_v4l2__capture__device__impl.h
@@ -0,0 +1,11 @@
+--- media/capture/video/linux/v4l2_capture_device_impl.h.orig 2022-02-07 13:39:41 UTC
++++ media/capture/video/linux/v4l2_capture_device_impl.h
+@@ -19,7 +19,7 @@ class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4
+ public:
+ int open(const char* device_name, int flags) override;
+ int close(int fd) override;
+- int ioctl(int fd, int request, void* argp) override;
++ int ioctl(int fd, unsigned long request, void* argp) override;
+ void* mmap(void* start,
+ size_t length,
+ int prot,
diff --git a/devel/electron31/files/patch-media_capture_video_linux_video__capture__device__factory__v4l2.cc b/devel/electron31/files/patch-media_capture_video_linux_video__capture__device__factory__v4l2.cc
new file mode 100644
index 000000000000..4130eb82441b
--- /dev/null
+++ b/devel/electron31/files/patch-media_capture_video_linux_video__capture__device__factory__v4l2.cc
@@ -0,0 +1,71 @@
+--- media/capture/video/linux/video_capture_device_factory_v4l2.cc.orig 2024-04-15 20:34:01 UTC
++++ media/capture/video/linux/video_capture_device_factory_v4l2.cc
+@@ -38,6 +38,7 @@ bool CompareCaptureDevices(const VideoCaptureDeviceInf
+ return a.descriptor < b.descriptor;
+ }
+
++#if !BUILDFLAG(IS_OPENBSD)
+ // USB VID and PID are both 4 bytes long.
+ const size_t kVidPidSize = 4;
+ const size_t kMaxInterfaceNameSize = 256;
+@@ -70,11 +71,15 @@ std::string ExtractFileNameFromDeviceId(const std::str
+ DCHECK(base::StartsWith(device_id, kDevDir, base::CompareCase::SENSITIVE));
+ return device_id.substr(strlen(kDevDir), device_id.length());
+ }
++#endif
+
+ class DevVideoFilePathsDeviceProvider
+ : public VideoCaptureDeviceFactoryV4L2::DeviceProvider {
+ public:
+ void GetDeviceIds(std::vector<std::string>* target_container) override {
++#if BUILDFLAG(IS_OPENBSD)
++ target_container->emplace_back("/dev/video");
++#else
+ const base::FilePath path("/dev/");
+ base::FileEnumerator enumerator(path, false, base::FileEnumerator::FILES,
+ "video*");
+@@ -82,9 +87,13 @@ class DevVideoFilePathsDeviceProvider
+ const base::FileEnumerator::FileInfo info = enumerator.GetInfo();
+ target_container->emplace_back(path.value() + info.GetName().value());
+ }
++#endif
+ }
+
+ std::string GetDeviceModelId(const std::string& device_id) override {
++#if BUILDFLAG(IS_OPENBSD)
++ return std::string();
++#else
+ const std::string file_name = ExtractFileNameFromDeviceId(device_id);
+ std::string usb_id;
+ const std::string vid_path =
+@@ -101,9 +110,13 @@ class DevVideoFilePathsDeviceProvider
+ }
+
+ return usb_id;
++#endif
+ }
+
+ std::string GetDeviceDisplayName(const std::string& device_id) override {
++#if BUILDFLAG(IS_OPENBSD)
++ return std::string();
++#else
+ const std::string file_name = ExtractFileNameFromDeviceId(device_id);
+ const std::string interface_path =
+ base::StringPrintf(kInterfacePathTemplate, file_name.c_str());
+@@ -114,6 +127,7 @@ class DevVideoFilePathsDeviceProvider
+ return std::string();
+ }
+ return display_name;
++#endif
+ }
+ };
+
+@@ -219,7 +233,7 @@ void VideoCaptureDeviceFactoryV4L2::GetDevicesInfo(
+ std::move(callback).Run(std::move(devices_info));
+ }
+
+-int VideoCaptureDeviceFactoryV4L2::DoIoctl(int fd, int request, void* argp) {
++int VideoCaptureDeviceFactoryV4L2::DoIoctl(int fd, unsigned int request, void* argp) {
+ return HANDLE_EINTR(v4l2_->ioctl(fd, request, argp));
+ }
+
diff --git a/devel/electron31/files/patch-media_capture_video_linux_video__capture__device__factory__v4l2.h b/devel/electron31/files/patch-media_capture_video_linux_video__capture__device__factory__v4l2.h
new file mode 100644
index 000000000000..892b5de1714d
--- /dev/null
+++ b/devel/electron31/files/patch-media_capture_video_linux_video__capture__device__factory__v4l2.h
@@ -0,0 +1,11 @@
+--- media/capture/video/linux/video_capture_device_factory_v4l2.h.orig 2023-03-30 00:33:53 UTC
++++ media/capture/video/linux/video_capture_device_factory_v4l2.h
+@@ -51,7 +51,7 @@ class CAPTURE_EXPORT VideoCaptureDeviceFactoryV4L2
+
+ private:
+ // Simple wrapper to do HANDLE_EINTR(v4l2_->ioctl(fd, ...)).
+- int DoIoctl(int fd, int request, void* argp);
++ int DoIoctl(int fd, unsigned int request, void* argp);
+
+ VideoCaptureControlSupport GetControlSupport(int fd);
+ bool GetControlSupport(int fd, int control_id);
diff --git a/devel/electron31/files/patch-media_capture_video_video__capture__buffer__tracker__factory__impl.cc b/devel/electron31/files/patch-media_capture_video_video__capture__buffer__tracker__factory__impl.cc
new file mode 100644
index 000000000000..1a1f895f2805
--- /dev/null
+++ b/devel/electron31/files/patch-media_capture_video_video__capture__buffer__tracker__factory__impl.cc
@@ -0,0 +1,20 @@
+--- media/capture/video/video_capture_buffer_tracker_factory_impl.cc.orig 2023-11-29 21:40:06 UTC
++++ media/capture/video/video_capture_buffer_tracker_factory_impl.cc
+@@ -14,7 +14,7 @@
+ #include "media/capture/video/chromeos/gpu_memory_buffer_tracker_cros.h"
+ #elif BUILDFLAG(IS_APPLE)
+ #include "media/capture/video/apple/gpu_memory_buffer_tracker_apple.h"
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "media/capture/video/linux/v4l2_gpu_memory_buffer_tracker.h"
+ #elif BUILDFLAG(IS_WIN)
+ #include "media/capture/video/win/gpu_memory_buffer_tracker_win.h"
+@@ -42,7 +42,7 @@ VideoCaptureBufferTrackerFactoryImpl::CreateTracker(
+ return std::make_unique<GpuMemoryBufferTrackerCros>();
+ #elif BUILDFLAG(IS_APPLE)
+ return std::make_unique<GpuMemoryBufferTrackerApple>();
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return std::make_unique<V4L2GpuMemoryBufferTracker>();
+ #elif BUILDFLAG(IS_WIN)
+ if (!dxgi_device_manager_) {
diff --git a/devel/electron31/files/patch-media_capture_video_video__capture__device__client.cc b/devel/electron31/files/patch-media_capture_video_video__capture__device__client.cc
new file mode 100644
index 000000000000..b57aafdf2496
--- /dev/null
+++ b/devel/electron31/files/patch-media_capture_video_video__capture__device__client.cc
@@ -0,0 +1,11 @@
+--- media/capture/video/video_capture_device_client.cc.orig 2024-06-18 21:43:35 UTC
++++ media/capture/video/video_capture_device_client.cc
+@@ -164,7 +164,7 @@ FourccAndFlip GetFourccAndFlipFromPixelFormat(
+ CHECK(!is_width_odd && !is_height_odd);
+ return {libyuv::FOURCC_UYVY};
+ case media::PIXEL_FORMAT_RGB24:
+- if constexpr (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) {
++ if constexpr (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) {
+ // Linux RGB24 defines red at lowest byte address,
+ // see http://linuxtv.org/downloads/v4l-dvb-apis/packed-rgb.html.
+ return {libyuv::FOURCC_RAW};
diff --git a/devel/electron31/files/patch-media_cdm_cdm__paths__unittest.cc b/devel/electron31/files/patch-media_cdm_cdm__paths__unittest.cc
new file mode 100644
index 000000000000..e225b2ebe8c7
--- /dev/null
+++ b/devel/electron31/files/patch-media_cdm_cdm__paths__unittest.cc
@@ -0,0 +1,11 @@
+--- media/cdm/cdm_paths_unittest.cc.orig 2022-10-24 13:33:33 UTC
++++ media/cdm/cdm_paths_unittest.cc
+@@ -27,7 +27,7 @@ const char kComponentPlatform[] =
+ "win";
+ #elif BUILDFLAG(IS_CHROMEOS)
+ "cros";
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ "linux";
+ #elif BUILDFLAG(IS_FUCHSIA)
+ "fuchsia";
diff --git a/devel/electron31/files/patch-media_cdm_library__cdm_cdm__paths.gni b/devel/electron31/files/patch-media_cdm_library__cdm_cdm__paths.gni
new file mode 100644
index 000000000000..37e25e725134
--- /dev/null
+++ b/devel/electron31/files/patch-media_cdm_library__cdm_cdm__paths.gni
@@ -0,0 +1,11 @@
+--- media/cdm/library_cdm/cdm_paths.gni.orig 2023-10-19 19:58:27 UTC
++++ media/cdm/library_cdm/cdm_paths.gni
+@@ -15,7 +15,7 @@ assert(enable_library_cdms)
+ # Explicitly define what we use to avoid confusion.
+ if (is_chromeos) {
+ component_os = "cros"
+-} else if (is_linux) {
++} else if (is_linux || is_bsd) {
+ component_os = "linux"
+ } else if (is_win) {
+ component_os = "win"
diff --git a/devel/electron31/files/patch-media_ffmpeg_scripts_build__ffmpeg.py b/devel/electron31/files/patch-media_ffmpeg_scripts_build__ffmpeg.py
new file mode 100644
index 000000000000..8a5ae835be89
--- /dev/null
+++ b/devel/electron31/files/patch-media_ffmpeg_scripts_build__ffmpeg.py
@@ -0,0 +1,83 @@
+--- media/ffmpeg/scripts/build_ffmpeg.py.orig 2024-06-18 21:43:35 UTC
++++ media/ffmpeg/scripts/build_ffmpeg.py
+@@ -33,7 +33,7 @@ sys.path.append(os.path.join(CHROMIUM_ROOT_DIR, 'build
+ SUCCESS_TOKEN = 'THIS_BUILD_WORKED'
+
+ sys.path.append(os.path.join(CHROMIUM_ROOT_DIR, 'build'))
+-import gn_helpers
++#import gn_helpers
+
+ BRANDINGS = [
+ 'Chrome',
+@@ -44,6 +44,8 @@ ARCH_MAP = {
+ ARCH_MAP = {
+ 'android': ['ia32', 'x64', 'arm-neon', 'arm64'],
+ 'linux': ['ia32', 'x64', 'noasm-x64', 'arm', 'arm-neon', 'arm64'],
++ 'openbsd': ['x64', 'arm64', 'ia32'],
++ 'freebsd': ['x64', 'arm64', 'ia32'],
+ 'mac': ['x64', 'arm64'],
+ 'win': ['ia32', 'x64', 'arm64'],
+ }
+@@ -123,7 +125,7 @@ def GetDsoName(target_os, dso_name, dso_version):
+
+
+ def GetDsoName(target_os, dso_name, dso_version):
+- if target_os in ('linux', 'linux-noasm', 'android'):
++ if target_os in ('linux', 'linux-noasm', 'android', 'openbsd', 'freebsd'):
+ return 'lib%s.so.%s' % (dso_name, dso_version)
+ elif target_os == 'mac':
+ return 'lib%s.%s.dylib' % (dso_name, dso_version)
+@@ -476,7 +478,7 @@ def BuildFFmpeg(target_os, target_arch, host_os, host_
+ # removing <sys/sysctl.h> soon, so this is needed to silence a deprecation
+ # #warning which will be converted to an error via -Werror.
+ # There is also no prctl.h
+- if target_os in ['linux', 'linux-noasm']:
++ if target_os in ['linux', 'linux-noasm', 'openbsd', 'freebsd']:
+ pre_make_rewrites += [
+ (r'(#define HAVE_SYSCTL [01])',
+ r'#define HAVE_SYSCTL 0 /* \1 -- forced to 0 for Fuchsia */'),
+@@ -599,7 +601,7 @@ def main(argv):
+ configure_args = args[2:]
+
+ if target_os not in ('android', 'linux', 'linux-noasm', 'mac', 'win',
+- 'all'):
++ 'all', 'openbsd', 'freebsd'):
+ parser.print_help()
+ return 1
+
+@@ -672,7 +674,6 @@ def ConfigureAndBuild(target_arch, target_os, host_os,
+ '--disable-securetransport',
+ '--disable-faan',
+ '--disable-alsa',
+- '--disable-iamf',
+
+ # Disable automatically detected external libraries. This prevents
+ # automatic inclusion of things like hardware decoders. Each roll should
+@@ -713,7 +714,7 @@ def ConfigureAndBuild(target_arch, target_os, host_os,
+ '--optflags="-O2"',
+ ])
+
+- if target_os in ('linux', 'linux-noasm', 'android'):
++ if target_os in ('linux', 'linux-noasm', 'android', 'openbsd', 'freebsd'):
+ if target_arch == 'x64':
+ if target_os == 'android':
+ configure_flags['Common'].extend([
+@@ -828,9 +829,6 @@ def ConfigureAndBuild(target_arch, target_os, host_os,
+
+ configure_flags['Common'].extend([
+ '--target-os=linux',
+- '--sysroot=' +
+- os.path.join(CHROMIUM_ROOT_DIR,
+- 'build/linux/debian_bullseye_arm64-sysroot'),
+ # See crbug.com/1467681. These could be removed eventually
+ '--disable-dotprod',
+ '--disable-i8mm',
+@@ -1034,7 +1032,7 @@ def ConfigureAndBuild(target_arch, target_os, host_os,
+ 'Chrome', configure_flags['Common'] +
+ configure_flags['ChromeAndroid'] + configure_args)
+
+- if target_os in ['linux', 'linux-noasm']:
++ if target_os in ['linux', 'linux-noasm', 'openbsd', 'freebsd']:
+ # ChromeOS enables MPEG4 which requires error resilience :(
+ chrome_os_flags = (configure_flags['Common'] +
+ configure_flags['Chrome'] +
diff --git a/devel/electron31/files/patch-media_ffmpeg_scripts_robo__lib_config.py b/devel/electron31/files/patch-media_ffmpeg_scripts_robo__lib_config.py
new file mode 100644
index 000000000000..fa3cfeb2da50
--- /dev/null
+++ b/devel/electron31/files/patch-media_ffmpeg_scripts_robo__lib_config.py
@@ -0,0 +1,56 @@
+--- media/ffmpeg/scripts/robo_lib/config.py.orig 2024-06-18 21:43:35 UTC
++++ media/ffmpeg/scripts/robo_lib/config.py
+@@ -55,19 +55,13 @@ class RoboConfiguration:
+ self._llvm_path = os.path.join(self.chrome_src(), "third_party",
+ "llvm-build", "Release+Asserts", "bin")
+
+- self.EnsurePathContainsLLVM()
+- self.EnsureNoMakeInfo()
+ self.EnsureFFmpegHome()
+ self.EnsureGNConfig()
+- self.ComputeBranchName()
+
+ if not quiet:
+ shell.log(f"Using chrome src: {self.chrome_src()}")
+ shell.log(f"Using script dir: {self._script_directory}")
+ shell.log(f"Using ffmpeg home: {self.ffmpeg_home()}")
+- shell.log(f"On branch: {self.branch_name()}")
+- if self.sushi_branch_name():
+- shell.log(f"On sushi branch: {self.sushi_branch_name()}")
+
+ # Filename that we'll ask generate_gn.py to write git commands to.
+ # TODO: Should this use script_directory, or stay with ffmpeg? As long as
+@@ -186,9 +180,9 @@ class RoboConfiguration:
+
+ if re.match(r"i.86", platform.machine()):
+ self._host_architecture = "ia32"
+- elif platform.machine() == "x86_64" or platform.machine() == "AMD64":
++ elif platform.machine() == "x86_64" or platform.machine() == "AMD64" or platform.machine() == "amd64":
+ self._host_architecture = "x64"
+- elif platform.machine() == "aarch64":
++ elif platform.machine() == "aarch64" or platform.machine() == "arm64":
+ self._host_architecture = "arm64"
+ elif platform.machine() == "mips32":
+ self._host_architecture = "mipsel"
+@@ -223,6 +217,10 @@ class RoboConfiguration:
+ elif platform.system() == "Windows" or "CYGWIN_NT" in platform.system(
+ ):
+ self._host_operating_system = "win"
++ elif platform.system() == "OpenBSD":
++ self._host_operating_system = "openbsd"
++ elif platform.system() == "FreeBSD":
++ self._host_operating_system = "freebsd"
+ else:
+ raise ValueError(f"Unsupported platform: {platform.system()}")
+
+@@ -231,8 +229,8 @@ class RoboConfiguration:
+ wd = os.getcwd()
+ # Walk up the tree until we find src/AUTHORS
+ while wd != "/":
+- if os.path.isfile(os.path.join(wd, "src", "AUTHORS")):
+- self._chrome_src = os.path.join(wd, "src")
++ if os.path.isfile(os.path.join(wd, "third_party", "DEPS")):
++ self._chrome_src = wd
+ return
+ wd = os.path.dirname(wd)
+ raise Exception("could not find src/AUTHORS in any parent of the wd")
diff --git a/devel/electron31/files/patch-media_gpu_buffer__validation.cc b/devel/electron31/files/patch-media_gpu_buffer__validation.cc
new file mode 100644
index 000000000000..3f4d75dea598
--- /dev/null
+++ b/devel/electron31/files/patch-media_gpu_buffer__validation.cc
@@ -0,0 +1,46 @@
+--- media/gpu/buffer_validation.cc.orig 2024-02-21 00:20:49 UTC
++++ media/gpu/buffer_validation.cc
+@@ -16,7 +16,7 @@
+ #include "ui/gfx/geometry/size.h"
+ #include "ui/gfx/gpu_memory_buffer.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <drm_fourcc.h>
+ #include <sys/types.h>
+ #include <unistd.h>
+@@ -29,7 +29,7 @@ namespace {
+ namespace media {
+
+ namespace {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #ifndef I915_FORMAT_MOD_4_TILED_MTL_MC_CCS
+ // TODO(b/271455200): Remove this definition once drm_fourcc.h contains it.
+ /*
+@@ -55,7 +55,7 @@ bool GetFileSize(const int fd, size_t* size) {
+ } // namespace
+
+ bool GetFileSize(const int fd, size_t* size) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (fd < 0) {
+ VLOG(1) << "Invalid file descriptor";
+ return false;
+@@ -109,14 +109,14 @@ bool VerifyGpuMemoryBufferHandle(
+ VLOG(1) << "Unsupported: " << pixel_format;
+ return false;
+ }
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const uint64_t modifier = gmb_handle.native_pixmap_handle.modifier;
+ const bool is_intel_media_compressed_buffer =
+ IsIntelMediaCompressedModifier(modifier);
+ const bool is_intel_media_compression_enabled =
+ #if BUILDFLAG(IS_CHROMEOS)
+ base::FeatureList::IsEnabled(features::kEnableIntelMediaCompression);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ false;
+ #endif
+
diff --git a/devel/electron31/files/patch-media_gpu_chromeos_gl__image__processor__backend.cc b/devel/electron31/files/patch-media_gpu_chromeos_gl__image__processor__backend.cc
new file mode 100644
index 000000000000..a6b9c99f8ca8
--- /dev/null
+++ b/devel/electron31/files/patch-media_gpu_chromeos_gl__image__processor__backend.cc
@@ -0,0 +1,13 @@
+--- media/gpu/chromeos/gl_image_processor_backend.cc.orig 2024-06-18 21:43:35 UTC
++++ media/gpu/chromeos/gl_image_processor_backend.cc
+@@ -28,6 +28,10 @@
+ #include "ui/ozone/public/ozone_platform.h"
+ #include "ui/ozone/public/surface_factory_ozone.h"
+
++#ifndef GL_CONTEXT_LOST_KHR
++#define GL_CONTEXT_LOST_KHR 0x0507
++#endif
++
+ namespace media {
+
+ namespace {
diff --git a/devel/electron31/files/patch-media_gpu_chromeos_libyuv__image__processor__backend.cc b/devel/electron31/files/patch-media_gpu_chromeos_libyuv__image__processor__backend.cc
new file mode 100644
index 000000000000..9e8c26548f78
--- /dev/null
+++ b/devel/electron31/files/patch-media_gpu_chromeos_libyuv__image__processor__backend.cc
@@ -0,0 +1,29 @@
+--- media/gpu/chromeos/libyuv_image_processor_backend.cc.orig 2024-06-18 21:43:35 UTC
++++ media/gpu/chromeos/libyuv_image_processor_backend.cc
+@@ -48,7 +48,7 @@ static constexpr struct {
+ #define CONV(in, out, trans, result) \
+ {Fourcc::in, Fourcc::out, Transform::trans, SupportResult::result}
+ // Conversion.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ CONV(NV12, AR24, kConversion, Supported),
+ #endif
+ CONV(NV12, NV12, kConversion, Supported),
+@@ -415,7 +415,7 @@ int LibYUVImageProcessorBackend::DoConversion(const Fr
+ fr->GetWritableVisibleData(VideoFrame::Plane::kUV)), \
+ fr->stride(VideoFrame::Plane::kUV)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #define ARGB_DATA(fr) \
+ fr->GetWritableVisibleData(VideoFrame::Plane::kARGB), \
+ fr->stride(VideoFrame::Plane::kARGB)
+@@ -577,7 +577,7 @@ int LibYUVImageProcessorBackend::DoConversion(const Fr
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (output->format() == PIXEL_FORMAT_ARGB) {
+ if (input_config_.fourcc == Fourcc(Fourcc::NV12)) {
+ return LIBYUV_FUNC(NV12ToARGB, Y_UV_DATA(input),
diff --git a/devel/electron31/files/patch-media_gpu_chromeos_mailbox__video__frame__converter.cc b/devel/electron31/files/patch-media_gpu_chromeos_mailbox__video__frame__converter.cc
new file mode 100644
index 000000000000..162367037169
--- /dev/null
+++ b/devel/electron31/files/patch-media_gpu_chromeos_mailbox__video__frame__converter.cc
@@ -0,0 +1,11 @@
+--- media/gpu/chromeos/mailbox_video_frame_converter.cc.orig 2024-06-18 21:43:35 UTC
++++ media/gpu/chromeos/mailbox_video_frame_converter.cc
+@@ -65,7 +65,7 @@ viz::SharedImageFormat GetSharedImageFormat(gfx::Buffe
+ << static_cast<int>(buffer_format);
+ NOTREACHED_NORETURN();
+ }
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // If format is true multiplanar format, we prefer external sampler on
+ // ChromeOS and Linux.
+ if (format.is_multi_plane()) {
diff --git a/devel/electron31/files/patch-media_gpu_chromeos_native__pixmap__frame__resource.cc b/devel/electron31/files/patch-media_gpu_chromeos_native__pixmap__frame__resource.cc
new file mode 100644
index 000000000000..14508c43c576
--- /dev/null
+++ b/devel/electron31/files/patch-media_gpu_chromeos_native__pixmap__frame__resource.cc
@@ -0,0 +1,11 @@
+--- media/gpu/chromeos/native_pixmap_frame_resource.cc.orig 2024-06-18 21:43:35 UTC
++++ media/gpu/chromeos/native_pixmap_frame_resource.cc
+@@ -154,7 +154,7 @@ scoped_refptr<NativePixmapFrameResource> NativePixmapF
+ const bool is_intel_media_compression_enabled =
+ #if BUILDFLAG(IS_CHROMEOS)
+ base::FeatureList::IsEnabled(features::kEnableIntelMediaCompression);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ false;
+ #endif
+ CHECK(!is_intel_media_compressed_buffer ||
diff --git a/devel/electron31/files/patch-media_gpu_chromeos_platform__video__frame__utils.cc b/devel/electron31/files/patch-media_gpu_chromeos_platform__video__frame__utils.cc
new file mode 100644
index 000000000000..763b6ca68fb4
--- /dev/null
+++ b/devel/electron31/files/patch-media_gpu_chromeos_platform__video__frame__utils.cc
@@ -0,0 +1,29 @@
+--- media/gpu/chromeos/platform_video_frame_utils.cc.orig 2024-06-18 21:43:35 UTC
++++ media/gpu/chromeos/platform_video_frame_utils.cc
+@@ -68,7 +68,7 @@ static std::unique_ptr<ui::GbmDevice> CreateGbmDevice(
+ const base::FilePath dev_path(FILE_PATH_LITERAL(
+ base::StrCat({drm_node_file_prefix, base::NumberToString(i)})));
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_V4L2_CODEC)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(USE_V4L2_CODEC)
+ const bool is_render_node = base::Contains(drm_node_file_prefix, "render");
+
+ // TODO(b/313513760): don't guard base::File::FLAG_WRITE behind
+@@ -196,7 +196,7 @@ class GbmDeviceWrapper {
+ const bool is_intel_media_compression_enabled =
+ #if BUILDFLAG(IS_CHROMEOS)
+ base::FeatureList::IsEnabled(features::kEnableIntelMediaCompression);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ false;
+ #endif
+ if (is_intel_media_compression_enabled) {
+@@ -350,7 +350,7 @@ scoped_refptr<VideoFrame> CreateVideoFrameFromGpuMemor
+ const bool is_intel_media_compression_enabled =
+ #if BUILDFLAG(IS_CHROMEOS)
+ base::FeatureList::IsEnabled(features::kEnableIntelMediaCompression);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ false;
+ #endif
+
diff --git a/devel/electron31/files/patch-media_gpu_chromeos_video__decoder__pipeline.cc b/devel/electron31/files/patch-media_gpu_chromeos_video__decoder__pipeline.cc
new file mode 100644
index 000000000000..8f88dba4821e
--- /dev/null
+++ b/devel/electron31/files/patch-media_gpu_chromeos_video__decoder__pipeline.cc
@@ -0,0 +1,29 @@
+--- media/gpu/chromeos/video_decoder_pipeline.cc.orig 2024-06-18 21:43:35 UTC
++++ media/gpu/chromeos/video_decoder_pipeline.cc
+@@ -1097,7 +1097,7 @@ VideoDecoderPipeline::PickDecoderOutputFormat(
+ }
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_VAAPI)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(USE_VAAPI)
+ // Linux should always use a custom allocator (to allocate buffers using
+ // libva) and a PlatformVideoFramePool.
+ CHECK(allocator.has_value());
+@@ -1106,7 +1106,7 @@ VideoDecoderPipeline::PickDecoderOutputFormat(
+ // VideoFrame::StorageType of VideoFrame::STORAGE_DMABUFS.
+ main_frame_pool_->AsPlatformVideoFramePool()->SetCustomFrameAllocator(
+ *allocator, VideoFrame::STORAGE_DMABUFS);
+-#elif BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_V4L2_CODEC)
++#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(USE_V4L2_CODEC)
+ // Linux w/ V4L2 should not use a custom allocator
+ // Only tested with video_decode_accelerator_tests
+ // TODO(wenst@) Test with full Chromium Browser
+@@ -1294,7 +1294,7 @@ VideoDecoderPipeline::PickDecoderOutputFormat(
+ << " VideoFrames";
+ auxiliary_frame_pool_->set_parent_task_runner(decoder_task_runner_);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // The custom allocator creates frames backed by NativePixmap, which uses a
+ // VideoFrame::StorageType of VideoFrame::STORAGE_DMABUFS.
+ auxiliary_frame_pool_->AsPlatformVideoFramePool()->SetCustomFrameAllocator(
diff --git a/devel/electron31/files/patch-media_gpu_gpu__video__encode__accelerator__factory.cc b/devel/electron31/files/patch-media_gpu_gpu__video__encode__accelerator__factory.cc
new file mode 100644
index 000000000000..4e7d1a84bcd8
--- /dev/null
+++ b/devel/electron31/files/patch-media_gpu_gpu__video__encode__accelerator__factory.cc
@@ -0,0 +1,11 @@
+--- media/gpu/gpu_video_encode_accelerator_factory.cc.orig 2024-04-15 20:34:01 UTC
++++ media/gpu/gpu_video_encode_accelerator_factory.cc
+@@ -118,7 +118,7 @@ std::vector<VEAFactoryFunction> GetVEAFactoryFunctions
+ return vea_factory_functions;
+
+ #if BUILDFLAG(USE_VAAPI)
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (base::FeatureList::IsEnabled(kVaapiVideoEncodeLinux))
+ vea_factory_functions.push_back(base::BindRepeating(&CreateVaapiVEA));
+ #else
diff --git a/devel/electron31/files/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.cc b/devel/electron31/files/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.cc
new file mode 100644
index 000000000000..445e45081f58
--- /dev/null
+++ b/devel/electron31/files/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.cc
@@ -0,0 +1,44 @@
+--- media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc.orig 2024-06-18 21:43:35 UTC
++++ media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc
+@@ -16,7 +16,9 @@
+ #include "media/gpu/vaapi/vaapi_wrapper.h"
+ #endif
+
++#if !BUILDFLAG(IS_BSD)
+ using sandbox::syscall_broker::BrokerFilePermission;
++#endif
+
+ // TODO(b/195769334): the hardware video decoding sandbox is really only useful
+ // when building with VA-API or V4L2 (otherwise, we're not really doing hardware
+@@ -32,6 +34,7 @@ namespace {
+ namespace media {
+ namespace {
+
++#if !BUILDFLAG(IS_BSD)
+ void AllowAccessToRenderNodes(std::vector<BrokerFilePermission>& permissions,
+ bool include_sys_dev_char,
+ bool read_write) {
+@@ -172,6 +175,7 @@ bool HardwareVideoDecodingPreSandboxHookForV4L2(
+ NOTREACHED_NORETURN();
+ #endif // BUILDFLAG(USE_V4L2_CODEC)
+ }
++#endif
+
+ } // namespace
+
+@@ -187,6 +191,7 @@ bool HardwareVideoDecodingPreSandboxHook(
+ // (at least).
+ bool HardwareVideoDecodingPreSandboxHook(
+ sandbox::policy::SandboxLinux::Options options) {
++#if !BUILDFLAG(IS_BSD)
+ using HardwareVideoDecodingProcessPolicy =
+ sandbox::policy::HardwareVideoDecodingProcessPolicy;
+ using PolicyType =
+@@ -232,6 +237,7 @@ bool HardwareVideoDecodingPreSandboxHook(
+ // |permissions| is empty?
+ sandbox::policy::SandboxLinux::GetInstance()->StartBrokerProcess(
+ command_set, permissions, options);
++#endif
+ return true;
+ }
+
diff --git a/devel/electron31/files/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.h b/devel/electron31/files/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.h
new file mode 100644
index 000000000000..767032bf10a4
--- /dev/null
+++ b/devel/electron31/files/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.h
@@ -0,0 +1,16 @@
+--- media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.h.orig 2023-05-25 00:41:58 UTC
++++ media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.h
+@@ -5,7 +5,13 @@
+ #ifndef MEDIA_GPU_SANDBOX_HARDWARE_VIDEO_DECODING_SANDBOX_HOOK_LINUX_H_
+ #define MEDIA_GPU_SANDBOX_HARDWARE_VIDEO_DECODING_SANDBOX_HOOK_LINUX_H_
+
++#include "build/build_config.h"
++
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#else
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+
+ namespace media {
+
diff --git a/devel/electron31/files/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.cc b/devel/electron31/files/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.cc
new file mode 100644
index 000000000000..c6203b22f89a
--- /dev/null
+++ b/devel/electron31/files/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.cc
@@ -0,0 +1,26 @@
+--- media/gpu/sandbox/hardware_video_encoding_sandbox_hook_linux.cc.orig 2024-04-15 20:34:01 UTC
++++ media/gpu/sandbox/hardware_video_encoding_sandbox_hook_linux.cc
+@@ -18,12 +18,15 @@
+ #include "media/gpu/v4l2/v4l2_device.h"
+ #endif
+
++#if !BUILDFLAG(IS_BSD)
+ using sandbox::syscall_broker::BrokerFilePermission;
++#endif
+
+ namespace media {
+
+ bool HardwareVideoEncodingPreSandboxHook(
+ sandbox::policy::SandboxLinux::Options options) {
++#if !BUILDFLAG(IS_BSD)
+ sandbox::syscall_broker::BrokerCommandSet command_set;
+ std::vector<BrokerFilePermission> permissions;
+
+@@ -120,6 +123,7 @@ bool HardwareVideoEncodingPreSandboxHook(
+ return false;
+ }
+ }
++#endif
+ #endif
+ return true;
+ }
diff --git a/devel/electron31/files/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.h b/devel/electron31/files/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.h
new file mode 100644
index 000000000000..7134a7a79f35
--- /dev/null
+++ b/devel/electron31/files/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.h
@@ -0,0 +1,23 @@
+--- media/gpu/sandbox/hardware_video_encoding_sandbox_hook_linux.h.orig 2023-05-25 00:41:58 UTC
++++ media/gpu/sandbox/hardware_video_encoding_sandbox_hook_linux.h
+@@ -5,7 +5,13 @@
+ #ifndef MEDIA_GPU_SANDBOX_HARDWARE_VIDEO_ENCODING_SANDBOX_HOOK_LINUX_H_
+ #define MEDIA_GPU_SANDBOX_HARDWARE_VIDEO_ENCODING_SANDBOX_HOOK_LINUX_H_
+
++#include "build/build_config.h"
++
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#else
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+
+ namespace media {
+
+@@ -14,4 +20,4 @@ bool HardwareVideoEncodingPreSandboxHook(
+
+ } // namespace media
+
+-#endif // MEDIA_GPU_SANDBOX_HARDWARE_VIDEO_ENCODING_SANDBOX_HOOK_LINUX_H_
+\ No newline at end of file
++#endif // MEDIA_GPU_SANDBOX_HARDWARE_VIDEO_ENCODING_SANDBOX_HOOK_LINUX_H_
diff --git a/devel/electron31/files/patch-media_gpu_vaapi_vaapi__video__decoder.cc b/devel/electron31/files/patch-media_gpu_vaapi_vaapi__video__decoder.cc
new file mode 100644
index 000000000000..595257c263a2
--- /dev/null
+++ b/devel/electron31/files/patch-media_gpu_vaapi_vaapi__video__decoder.cc
@@ -0,0 +1,11 @@
+--- media/gpu/vaapi/vaapi_video_decoder.cc.orig 2024-06-18 21:43:35 UTC
++++ media/gpu/vaapi/vaapi_video_decoder.cc
+@@ -775,7 +775,7 @@ void VaapiVideoDecoder::ApplyResolutionChangeWithScree
+ const gfx::Size decoder_natural_size =
+ aspect_ratio_.GetNaturalSize(decoder_visible_rect);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::optional<DmabufVideoFramePool::CreateFrameCB> allocator =
+ base::BindRepeating(&AllocateCustomFrameProxy, weak_this_);
+ std::vector<ImageProcessor::PixelLayoutCandidate> candidates = {
diff --git a/devel/electron31/files/patch-media_gpu_vaapi_vaapi__wrapper.cc b/devel/electron31/files/patch-media_gpu_vaapi_vaapi__wrapper.cc
new file mode 100644
index 000000000000..24265e4b6703
--- /dev/null
+++ b/devel/electron31/files/patch-media_gpu_vaapi_vaapi__wrapper.cc
@@ -0,0 +1,11 @@
+--- media/gpu/vaapi/vaapi_wrapper.cc.orig 2024-06-18 21:43:35 UTC
++++ media/gpu/vaapi/vaapi_wrapper.cc
+@@ -71,7 +71,7 @@ using media_gpu_vaapi::kModuleVa_prot;
+ using media_gpu_vaapi::kModuleVa_prot;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/files/file_util.h"
+ #include "base/strings/string_split.h"
+ #endif
diff --git a/devel/electron31/files/patch-media_media__options.gni b/devel/electron31/files/patch-media_media__options.gni
new file mode 100644
index 000000000000..bf137bf4eed6
--- /dev/null
+++ b/devel/electron31/files/patch-media_media__options.gni
@@ -0,0 +1,19 @@
+--- media/media_options.gni.orig 2024-06-18 21:43:35 UTC
++++ media/media_options.gni
+@@ -190,12 +190,15 @@ declare_args() {
+ # Enables runtime selection of ALSA library for audio.
+ use_alsa = false
+
++ # Enable runtime selection of sndio(7)
++ use_sndio = false
++
+ # Alsa should be used on all non-Android, non-Mac POSIX systems - with the
+ # exception of CastOS desktop builds.
+ #
+ # TODO(crbug.com/1336055): Remove legacy target_cpu hack used for targeting
+ # desktop Chromecast builds.
+- if (is_posix && !is_android && !is_apple &&
++ if (is_posix && !is_android && !is_apple && !is_bsd &&
+ (!is_castos || (target_cpu == "x86" || target_cpu == "x64") ||
+ is_cast_audio_only)) {
+ use_alsa = true
diff --git a/devel/electron31/files/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.cc b/devel/electron31/files/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.cc
new file mode 100644
index 000000000000..aaf5fc1d8cf7
--- /dev/null
+++ b/devel/electron31/files/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.cc
@@ -0,0 +1,20 @@
+--- media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.cc.orig 2023-10-19 19:58:27 UTC
++++ media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.cc
+@@ -837,7 +837,7 @@ const gfx::GpuMemoryBufferId& StructTraits<
+ return input.id;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // static
+ gfx::NativePixmapHandle StructTraits<
+ media::stable::mojom::NativeGpuMemoryBufferHandleDataView,
+@@ -858,7 +858,7 @@ bool StructTraits<media::stable::mojom::NativeGpuMemor
+
+ output->type = gfx::NATIVE_PIXMAP;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (!data.ReadPlatformHandle(&output->native_pixmap_handle))
+ return false;
+ return true;
diff --git a/devel/electron31/files/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.h b/devel/electron31/files/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.h
new file mode 100644
index 000000000000..8c88b50222b7
--- /dev/null
+++ b/devel/electron31/files/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.h
@@ -0,0 +1,11 @@
+--- media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h.orig 2024-06-18 21:43:35 UTC
++++ media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h
+@@ -690,7 +690,7 @@ struct StructTraits<media::stable::mojom::NativeGpuMem
+ static const gfx::GpuMemoryBufferId& id(
+ const gfx::GpuMemoryBufferHandle& input);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ static gfx::NativePixmapHandle platform_handle(
+ gfx::GpuMemoryBufferHandle& input);
+ #else
diff --git a/devel/electron31/files/patch-media_mojo_mojom_video__frame__mojom__traits.cc b/devel/electron31/files/patch-media_mojo_mojom_video__frame__mojom__traits.cc
new file mode 100644
index 000000000000..abaff21f1ca3
--- /dev/null
+++ b/devel/electron31/files/patch-media_mojo_mojom_video__frame__mojom__traits.cc
@@ -0,0 +1,11 @@
+--- media/mojo/mojom/video_frame_mojom_traits.cc.orig 2022-10-24 13:33:33 UTC
++++ media/mojo/mojom/video_frame_mojom_traits.cc
+@@ -22,7 +22,7 @@
+ #include "ui/gfx/mojom/color_space_mojom_traits.h"
+ #include "ui/gfx/mojom/hdr_metadata_mojom_traits.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/posix/eintr_wrapper.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
diff --git a/devel/electron31/files/patch-media_video_fake__gpu__memory__buffer.cc b/devel/electron31/files/patch-media_video_fake__gpu__memory__buffer.cc
new file mode 100644
index 000000000000..fdd70f04c04e
--- /dev/null
+++ b/devel/electron31/files/patch-media_video_fake__gpu__memory__buffer.cc
@@ -0,0 +1,38 @@
+--- media/video/fake_gpu_memory_buffer.cc.orig 2024-04-15 20:34:01 UTC
++++ media/video/fake_gpu_memory_buffer.cc
+@@ -9,7 +9,7 @@
+ #include "media/base/format_utils.h"
+ #include "media/base/video_frame.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <fcntl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+@@ -52,7 +52,7 @@ class FakeGpuMemoryBufferImpl : public gpu::GpuMemoryB
+
+ } // namespace
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::ScopedFD GetDummyFD() {
+ base::ScopedFD fd(open("/dev/zero", O_RDWR));
+ DCHECK(fd.is_valid());
+@@ -82,7 +82,7 @@ FakeGpuMemoryBuffer::FakeGpuMemoryBuffer(const gfx::Si
+ static base::AtomicSequenceNumber buffer_id_generator;
+ handle_.id = gfx::GpuMemoryBufferId(buffer_id_generator.GetNext());
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ for (size_t i = 0; i < VideoFrame::NumPlanes(video_pixel_format_); i++) {
+ const gfx::Size plane_size_in_bytes =
+ VideoFrame::PlaneSize(video_pixel_format_, i, size_);
+@@ -144,7 +144,7 @@ gfx::GpuMemoryBufferHandle FakeGpuMemoryBuffer::CloneH
+ gfx::GpuMemoryBufferHandle handle;
+ handle.type = gfx::NATIVE_PIXMAP;
+ handle.id = handle_.id;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ handle.native_pixmap_handle =
+ gfx::CloneHandleForIPC(handle_.native_pixmap_handle);
+ #endif
diff --git a/devel/electron31/files/patch-media_video_gpu__memory__buffer__video__frame__pool.cc b/devel/electron31/files/patch-media_video_gpu__memory__buffer__video__frame__pool.cc
new file mode 100644
index 000000000000..016cb8f8ab50
--- /dev/null
+++ b/devel/electron31/files/patch-media_video_gpu__memory__buffer__video__frame__pool.cc
@@ -0,0 +1,29 @@
+--- media/video/gpu_memory_buffer_video_frame_pool.cc.orig 2024-06-18 21:43:36 UTC
++++ media/video/gpu_memory_buffer_video_frame_pool.cc
+@@ -758,7 +758,7 @@ void GpuMemoryBufferVideoFramePool::PoolImpl::CreateHa
+ }
+
+ bool is_software_backed_video_frame = !video_frame->HasTextures();
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ is_software_backed_video_frame &= !video_frame->HasDmaBufs();
+ #endif
+
+@@ -1234,7 +1234,7 @@ scoped_refptr<VideoFrame> GpuMemoryBufferVideoFramePoo
+ gpu_memory_buffer->CloneHandle().io_surface.get());
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ is_webgpu_compatible =
+ gpu_memory_buffer->CloneHandle()
+ .native_pixmap_handle.supports_zero_copy_webgpu_import;
+@@ -1250,7 +1250,7 @@ scoped_refptr<VideoFrame> GpuMemoryBufferVideoFramePoo
+ gpu::SHARED_IMAGE_USAGE_DISPLAY_READ |
+ gpu::SHARED_IMAGE_USAGE_SCANOUT;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/40194712): Always add the flag once the
+ // OzoneImageBacking is by default turned on.
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
diff --git a/devel/electron31/files/patch-media_video_video__encode__accelerator__adapter.cc b/devel/electron31/files/patch-media_video_video__encode__accelerator__adapter.cc
new file mode 100644
index 000000000000..692cf55ac49a
--- /dev/null
+++ b/devel/electron31/files/patch-media_video_video__encode__accelerator__adapter.cc
@@ -0,0 +1,20 @@
+--- media/video/video_encode_accelerator_adapter.cc.orig 2024-04-15 20:34:01 UTC
++++ media/video/video_encode_accelerator_adapter.cc
+@@ -157,7 +157,7 @@ VideoEncodeAccelerator::Config SetUpVeaConfig(
+ if (is_rgb)
+ config.input_format = PIXEL_FORMAT_I420;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (format != PIXEL_FORMAT_I420 ||
+ !VideoFrame::IsStorageTypeMappable(storage_type)) {
+ // ChromeOS/Linux hardware video encoders supports I420 on-memory
+@@ -482,7 +482,7 @@ void VideoEncodeAcceleratorAdapter::InitializeInternal
+ SetUpVeaConfig(profile_, options_, format, first_frame->storage_type(),
+ supported_rc_modes_, required_encoder_type_);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Linux/ChromeOS require a special configuration to use dmabuf storage.
+ // We need to keep sending frames the same way the first frame was sent.
+ // Other platforms will happily mix GpuMemoryBuffer storage with regular
diff --git a/devel/electron31/files/patch-media_video_video__encode__accelerator__adapter__test.cc b/devel/electron31/files/patch-media_video_video__encode__accelerator__adapter__test.cc
new file mode 100644
index 000000000000..f7608ae4b83b
--- /dev/null
+++ b/devel/electron31/files/patch-media_video_video__encode__accelerator__adapter__test.cc
@@ -0,0 +1,11 @@
+--- media/video/video_encode_accelerator_adapter_test.cc.orig 2023-08-10 01:48:46 UTC
++++ media/video/video_encode_accelerator_adapter_test.cc
+@@ -459,7 +459,7 @@ TEST_P(VideoEncodeAcceleratorAdapterTest, TwoFramesRes
+ CreateGreenFrame(large_size, pixel_format, base::Milliseconds(2));
+
+ VideoPixelFormat expected_input_format = PIXEL_FORMAT_I420;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (pixel_format != PIXEL_FORMAT_I420 || !small_frame->IsMappable())
+ expected_input_format = PIXEL_FORMAT_NV12;
+ #endif
diff --git a/devel/electron31/files/patch-media_webrtc_audio__processor.cc b/devel/electron31/files/patch-media_webrtc_audio__processor.cc
new file mode 100644
index 000000000000..04a5b69e342f
--- /dev/null
+++ b/devel/electron31/files/patch-media_webrtc_audio__processor.cc
@@ -0,0 +1,11 @@
+--- media/webrtc/audio_processor.cc.orig 2023-03-30 00:33:54 UTC
++++ media/webrtc/audio_processor.cc
+@@ -513,7 +513,7 @@ absl::optional<double> AudioProcessor::ProcessData(
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
+ DCHECK_LE(volume, 1.0);
+ #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || \
+- BUILDFLAG(IS_OPENBSD)
++ BUILDFLAG(IS_BSD)
+ // We have a special situation on Linux where the microphone volume can be
+ // "higher than maximum". The input volume slider in the sound preference
+ // allows the user to set a scaling that is higher than 100%. It means that
diff --git a/devel/electron31/files/patch-media_webrtc_helpers.cc b/devel/electron31/files/patch-media_webrtc_helpers.cc
new file mode 100644
index 000000000000..c42cb6e1b766
--- /dev/null
+++ b/devel/electron31/files/patch-media_webrtc_helpers.cc
@@ -0,0 +1,19 @@
+--- media/webrtc/helpers.cc.orig 2024-06-18 21:43:36 UTC
++++ media/webrtc/helpers.cc
+@@ -41,14 +41,14 @@ void ConfigAutomaticGainControl(const AudioProcessingS
+ return;
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const bool kInputVolumeAdjustmentOverrideAllowed = true;
+ #elif BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
+ const bool kInputVolumeAdjustmentOverrideAllowed = false;
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // Use AGC2 digital and input volume controller.
+ // TODO(crbug.com/40872787): Remove `kWebRtcAllowInputVolumeAdjustment` safely
+ // and set `input_volume_controller.enabled` true.
diff --git a/devel/electron31/files/patch-media_webrtc_helpers__unittests.cc b/devel/electron31/files/patch-media_webrtc_helpers__unittests.cc
new file mode 100644
index 000000000000..880a895094a9
--- /dev/null
+++ b/devel/electron31/files/patch-media_webrtc_helpers__unittests.cc
@@ -0,0 +1,38 @@
+--- media/webrtc/helpers_unittests.cc.orig 2024-04-15 20:34:01 UTC
++++ media/webrtc/helpers_unittests.cc
+@@ -40,7 +40,7 @@ TEST(CreateWebRtcAudioProcessingModuleTest, CheckDefau
+ EXPECT_TRUE(config.echo_canceller.enabled);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ EXPECT_FALSE(config.gain_controller1.enabled);
+ EXPECT_TRUE(config.gain_controller2.enabled);
+ #elif BUILDFLAG(IS_CASTOS) || BUILDFLAG(IS_CAST_ANDROID)
+@@ -73,7 +73,7 @@ TEST(CreateWebRtcAudioProcessingModuleTest,
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ TEST(CreateWebRtcAudioProcessingModuleTest,
+ InputVolumeAdjustmentEnabledWithAgc2) {
+ ::base::test::ScopedFeatureList feature_list;
+@@ -89,7 +89,7 @@ TEST(CreateWebRtcAudioProcessingModuleTest,
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ TEST(CreateWebRtcAudioProcessingModuleTest,
+ CanDisableInputVolumeAdjustmentWithAgc2) {
+ ::base::test::ScopedFeatureList feature_list;
+@@ -106,7 +106,7 @@ TEST(CreateWebRtcAudioProcessingModuleTest,
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ TEST(CreateWebRtcAudioProcessingModuleTest,
+ OnlyOneInputVolumeControllerEnabledOnDesktopPlatforms) {
+ auto config = CreateApmGetConfig(
diff --git a/devel/electron31/files/patch-mojo_core_BUILD.gn b/devel/electron31/files/patch-mojo_core_BUILD.gn
new file mode 100644
index 000000000000..a47ecdd9ec14
--- /dev/null
+++ b/devel/electron31/files/patch-mojo_core_BUILD.gn
@@ -0,0 +1,11 @@
+--- mojo/core/BUILD.gn.orig 2023-05-25 00:41:59 UTC
++++ mojo/core/BUILD.gn
+@@ -166,7 +166,7 @@ template("core_impl_source_set") {
+ ]
+ }
+
+- if ((is_linux || is_chromeos || is_android) && !is_nacl) {
++ if ((is_linux || is_chromeos || is_android) && !is_nacl && !is_bsd) {
+ sources += [
+ "channel_linux.cc",
+ "channel_linux.h",
diff --git a/devel/electron31/files/patch-mojo_core_channel.cc b/devel/electron31/files/patch-mojo_core_channel.cc
new file mode 100644
index 000000000000..8791aca737d5
--- /dev/null
+++ b/devel/electron31/files/patch-mojo_core_channel.cc
@@ -0,0 +1,14 @@
+--- mojo/core/channel.cc.orig 2024-06-18 21:43:36 UTC
++++ mojo/core/channel.cc
+@@ -71,7 +71,11 @@ const size_t kMaxAttachedHandles = 64;
+ // Fuchsia: The zx_channel_write() API supports up to 64 handles.
+ const size_t kMaxAttachedHandles = 64;
+
++#if defined(__i386__) && defined(OS_FREEBSD)
++const size_t kChannelMessageAlignment = 4;
++#else
+ static_assert(alignof(std::max_align_t) >= kChannelMessageAlignment, "");
++#endif
+ Channel::AlignedBuffer MakeAlignedBuffer(size_t size) {
+ // Generic allocators (such as malloc) return a pointer that is suitably
+ // aligned for storing any type of object with a fundamental alignment
diff --git a/devel/electron31/files/patch-mojo_core_embedder_features.h b/devel/electron31/files/patch-mojo_core_embedder_features.h
new file mode 100644
index 000000000000..ae158663d373
--- /dev/null
+++ b/devel/electron31/files/patch-mojo_core_embedder_features.h
@@ -0,0 +1,11 @@
+--- mojo/core/embedder/features.h.orig 2023-05-25 00:41:59 UTC
++++ mojo/core/embedder/features.h
+@@ -16,7 +16,7 @@ namespace core {
+
+ #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_NACL) && \
+ !BUILDFLAG(MOJO_USE_APPLE_CHANNEL)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(MOJO_CORE_EMBEDDER_FEATURES)
+ BASE_DECLARE_FEATURE(kMojoLinuxChannelSharedMem);
+
diff --git a/devel/electron31/files/patch-mojo_public_c_system_thunks.cc b/devel/electron31/files/patch-mojo_public_c_system_thunks.cc
new file mode 100644
index 000000000000..5bd787e67d00
--- /dev/null
+++ b/devel/electron31/files/patch-mojo_public_c_system_thunks.cc
@@ -0,0 +1,38 @@
+--- mojo/public/c/system/thunks.cc.orig 2024-04-15 20:34:01 UTC
++++ mojo/public/c/system/thunks.cc
+@@ -25,7 +25,7 @@
+ #include "mojo/public/c/system/message_pipe.h"
+
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ #include "base/environment.h"
+ #include "base/files/file_path.h"
+ #include "base/scoped_native_library.h"
+@@ -72,7 +72,7 @@ class CoreLibraryInitializer {
+
+ MojoResult LoadLibrary(base::FilePath library_path) {
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ if (library_ && library_->is_valid())
+ return MOJO_RESULT_OK;
+
+@@ -86,7 +86,7 @@ class CoreLibraryInitializer {
+
+ if (library_path.empty()) {
+ // Default to looking for the library in the current working directory.
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const base::FilePath::CharType kDefaultLibraryPathValue[] =
+ FILE_PATH_LITERAL("./libmojo_core.so");
+ #elif BUILDFLAG(IS_FUCHSIA)
+@@ -142,7 +142,7 @@ class CoreLibraryInitializer {
+
+ private:
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ std::optional<base::ScopedNativeLibrary> library_;
+ #endif
+ };
diff --git a/devel/electron31/files/patch-mojo_public_tools_bindings_mojom.gni b/devel/electron31/files/patch-mojo_public_tools_bindings_mojom.gni
new file mode 100644
index 000000000000..04b94064f7da
--- /dev/null
+++ b/devel/electron31/files/patch-mojo_public_tools_bindings_mojom.gni
@@ -0,0 +1,19 @@
+--- mojo/public/tools/bindings/mojom.gni.orig 2024-06-18 21:43:36 UTC
++++ mojo/public/tools/bindings/mojom.gni
+@@ -746,6 +746,16 @@ template("mojom") {
+ enabled_features += [ "is_apple" ]
+ }
+
++ if (is_openbsd) {
++ enabled_features += [ "is_openbsd" ]
++ enabled_features += [ "is_bsd" ]
++ }
++
++ if (is_freebsd) {
++ enabled_features += [ "is_freebsd" ]
++ enabled_features += [ "is_bsd" ]
++ }
++
+ action(parser_target_name) {
+ allow_remote = true
+
diff --git a/devel/electron31/files/patch-net_BUILD.gn b/devel/electron31/files/patch-net_BUILD.gn
new file mode 100644
index 000000000000..7290d550c3c6
--- /dev/null
+++ b/devel/electron31/files/patch-net_BUILD.gn
@@ -0,0 +1,78 @@
+--- net/BUILD.gn.orig 2024-06-18 21:43:36 UTC
++++ net/BUILD.gn
+@@ -123,7 +123,7 @@ net_configs = [
+ "//build/config/compiler:wexit_time_destructors",
+ ]
+
+-if (is_linux || is_chromeos) {
++if ((is_linux || is_chromeos) && !is_bsd) {
+ net_configs += [ "//build/config/linux:libresolv" ]
+ }
+
+@@ -1200,6 +1200,19 @@ component("net") {
+ ]
+ }
+
++ if (is_bsd) {
++ sources -= [
++ "base/address_map_cache_linux.cc",
++ "base/address_map_cache_linux.h",
++ "base/address_map_linux.cc",
++ "base/address_map_linux.h",
++ "base/address_tracker_linux.cc",
++ "base/address_tracker_linux.h",
++ "base/network_change_notifier_linux.cc",
++ "base/network_interfaces_linux.cc",
++ ]
++ }
++
+ if (is_mac) {
+ sources += [
+ "base/network_notification_thread_mac.cc",
+@@ -1357,7 +1370,7 @@ component("net") {
+ }
+
+ # Use getifaddrs() on POSIX platforms, except Linux.
+- if (is_posix && !is_linux && !is_chromeos) {
++ if ((is_posix && !is_linux && !is_chromeos) || is_bsd) {
+ sources += [
+ "base/network_interfaces_getifaddrs.cc",
+ "base/network_interfaces_getifaddrs.h",
+@@ -2846,7 +2859,7 @@ test("net_unittests") {
+ ]
+ }
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ sources += [
+ "base/address_tracker_linux_unittest.cc",
+ "base/network_interfaces_linux_unittest.cc",
+@@ -2934,6 +2947,10 @@ test("net_unittests") {
+ ]
+ }
+
++ if (is_bsd) {
++ deps += [ "//sandbox/policy" ]
++ }
++
+ if (enable_websockets) {
+ deps += [ "//net/server:tests" ]
+ }
+@@ -2994,7 +3011,7 @@ test("net_unittests") {
+ ]
+ }
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ sources += [ "tools/quic/quic_simple_server_test.cc" ]
+ }
+
+@@ -3130,7 +3147,7 @@ test("net_unittests") {
+ }
+
+ # Use getifaddrs() on POSIX platforms, except Linux.
+- if (is_posix && !is_linux && !is_chromeos) {
++ if (is_posix && !is_linux && !is_chromeos && !is_bsd) {
+ sources += [ "base/network_interfaces_getifaddrs_unittest.cc" ]
+ }
+
diff --git a/devel/electron31/files/patch-net_base_features.cc b/devel/electron31/files/patch-net_base_features.cc
new file mode 100644
index 000000000000..4ebc7c0402d8
--- /dev/null
+++ b/devel/electron31/files/patch-net_base_features.cc
@@ -0,0 +1,24 @@
+--- net/base/features.cc.orig 2024-06-18 21:43:36 UTC
++++ net/base/features.cc
+@@ -26,7 +26,7 @@ BASE_FEATURE(kAsyncDns,
+ BASE_FEATURE(kAsyncDns,
+ "AsyncDns",
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -516,7 +516,12 @@ BASE_FEATURE(kSpdyHeadersToHttpResponseUseBuilder,
+ "SpdyHeadersToHttpResponseUseBuilder",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
++#if BUILDFLAG(IS_OPENBSD)
++// No IP_RECVTOS support
+ BASE_FEATURE(kReportEcn, "ReportEcn", base::FEATURE_DISABLED_BY_DEFAULT);
++#else
++BASE_FEATURE(kReportEcn, "ReportEcn", base::FEATURE_DISABLED_BY_DEFAULT);
++#endif
+
+ BASE_FEATURE(kUseNewAlpsCodepointHttp2,
+ "UseNewAlpsCodepointHttp2",
diff --git a/devel/electron31/files/patch-net_base_mock__network__change__notifier.cc b/devel/electron31/files/patch-net_base_mock__network__change__notifier.cc
new file mode 100644
index 000000000000..c03d3070a457
--- /dev/null
+++ b/devel/electron31/files/patch-net_base_mock__network__change__notifier.cc
@@ -0,0 +1,11 @@
+--- net/base/mock_network_change_notifier.cc.orig 2023-08-10 01:48:47 UTC
++++ net/base/mock_network_change_notifier.cc
+@@ -103,7 +103,7 @@ MockNetworkChangeNotifier::GetCurrentConnectionCost()
+ return connection_cost_;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ AddressMapOwnerLinux* MockNetworkChangeNotifier::GetAddressMapOwnerInternal() {
+ return address_map_owner_;
+ }
diff --git a/devel/electron31/files/patch-net_base_mock__network__change__notifier.h b/devel/electron31/files/patch-net_base_mock__network__change__notifier.h
new file mode 100644
index 000000000000..a9375c70dee1
--- /dev/null
+++ b/devel/electron31/files/patch-net_base_mock__network__change__notifier.h
@@ -0,0 +1,20 @@
+--- net/base/mock_network_change_notifier.h.orig 2023-08-10 01:48:47 UTC
++++ net/base/mock_network_change_notifier.h
+@@ -84,7 +84,7 @@ class MockNetworkChangeNotifier : public NetworkChange
+ // use_default_connection_cost_implementation is set to true.
+ ConnectionCost GetCurrentConnectionCost() override;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SetAddressMapOwnerLinux(AddressMapOwnerLinux* address_map_owner) {
+ address_map_owner_ = address_map_owner;
+ }
+@@ -104,7 +104,7 @@ class MockNetworkChangeNotifier : public NetworkChange
+ bool use_default_connection_cost_implementation_ = false;
+ NetworkChangeNotifier::NetworkList connected_networks_;
+ std::unique_ptr<SystemDnsConfigChangeNotifier> dns_config_notifier_;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ raw_ptr<AddressMapOwnerLinux> address_map_owner_ = nullptr;
+ #endif
+ };
diff --git a/devel/electron31/files/patch-net_base_network__change__notifier.cc b/devel/electron31/files/patch-net_base_network__change__notifier.cc
new file mode 100644
index 000000000000..524666e6f993
--- /dev/null
+++ b/devel/electron31/files/patch-net_base_network__change__notifier.cc
@@ -0,0 +1,21 @@
+--- net/base/network_change_notifier.cc.orig 2024-02-21 00:20:50 UTC
++++ net/base/network_change_notifier.cc
+@@ -37,7 +37,7 @@
+ #include "net/base/network_change_notifier_linux.h"
+ #elif BUILDFLAG(IS_APPLE)
+ #include "net/base/network_change_notifier_apple.h"
+-#elif BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#elif BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "net/base/network_change_notifier_passive.h"
+ #elif BUILDFLAG(IS_FUCHSIA)
+ #include "net/base/network_change_notifier_fuchsia.h"
+@@ -329,6 +329,9 @@ std::unique_ptr<NetworkChangeNotifier> NetworkChangeNo
+ #elif BUILDFLAG(IS_FUCHSIA)
+ return std::make_unique<NetworkChangeNotifierFuchsia>(
+ /*require_wlan=*/false);
++#elif BUILDFLAG(IS_BSD)
++ return std::make_unique<MockNetworkChangeNotifier>(
++ /*dns_config_notifier*/nullptr);
+ #else
+ NOTIMPLEMENTED();
+ return nullptr;
diff --git a/devel/electron31/files/patch-net_base_network__change__notifier__passive.cc b/devel/electron31/files/patch-net_base_network__change__notifier__passive.cc
new file mode 100644
index 000000000000..c9075b11c3ea
--- /dev/null
+++ b/devel/electron31/files/patch-net_base_network__change__notifier__passive.cc
@@ -0,0 +1,11 @@
+--- net/base/network_change_notifier_passive.cc.orig 2023-05-25 00:42:00 UTC
++++ net/base/network_change_notifier_passive.cc
+@@ -107,7 +107,7 @@ NetworkChangeNotifierPassive::GetAddressMapOwnerIntern
+ NetworkChangeNotifier::NetworkChangeCalculatorParams
+ NetworkChangeNotifierPassive::NetworkChangeCalculatorParamsPassive() {
+ NetworkChangeCalculatorParams params;
+-#if BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Delay values arrived at by simple experimentation and adjusted so as to
+ // produce a single signal when switching between network connections.
+ params.ip_address_offline_delay_ = base::Milliseconds(4000);
diff --git a/devel/electron31/files/patch-net_base_network__interfaces__posix.h b/devel/electron31/files/patch-net_base_network__interfaces__posix.h
new file mode 100644
index 000000000000..cb3379e3ba8d
--- /dev/null
+++ b/devel/electron31/files/patch-net_base_network__interfaces__posix.h
@@ -0,0 +1,11 @@
+--- net/base/network_interfaces_posix.h.orig 2022-02-07 13:39:41 UTC
++++ net/base/network_interfaces_posix.h
+@@ -8,6 +8,8 @@
+ // This file provides some basic functionality shared between
+ // network_interfaces_linux.cc and network_interfaces_getifaddrs.cc.
+
++#include <sys/socket.h>
++
+ #include <string>
+
+ struct sockaddr;
diff --git a/devel/electron31/files/patch-net_base_sockaddr__util__posix.cc b/devel/electron31/files/patch-net_base_sockaddr__util__posix.cc
new file mode 100644
index 000000000000..825c0490c3f1
--- /dev/null
+++ b/devel/electron31/files/patch-net_base_sockaddr__util__posix.cc
@@ -0,0 +1,12 @@
+--- net/base/sockaddr_util_posix.cc.orig 2022-07-22 17:30:31 UTC
++++ net/base/sockaddr_util_posix.cc
+@@ -41,7 +41,8 @@ bool FillUnixAddress(const std::string& socket_path,
+ return true;
+ }
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
++ // XXX ?
+ // Convert the path given into abstract socket name. It must start with
+ // the '\0' character, so we are adding it. |addr_len| must specify the
+ // length of the structure exactly, as potentially the socket name may
diff --git a/devel/electron31/files/patch-net_base_sockaddr__util__posix__unittest.cc b/devel/electron31/files/patch-net_base_sockaddr__util__posix__unittest.cc
new file mode 100644
index 000000000000..50ed6dc7f90d
--- /dev/null
+++ b/devel/electron31/files/patch-net_base_sockaddr__util__posix__unittest.cc
@@ -0,0 +1,12 @@
+--- net/base/sockaddr_util_posix_unittest.cc.orig 2022-06-17 14:20:10 UTC
++++ net/base/sockaddr_util_posix_unittest.cc
+@@ -83,7 +83,8 @@ TEST(FillUnixAddressTest, AbstractLinuxAddress) {
+ size_t path_max = MaxPathLength(&storage);
+ std::string path(path_max, '0');
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
++ // XXX?
+ EXPECT_TRUE(FillUnixAddress(path, /*use_abstract_namespace=*/true, &storage));
+
+ EXPECT_EQ(path.size() + 1U + offsetof(struct sockaddr_un, sun_path),
diff --git a/devel/electron31/files/patch-net_cert_cert__verify__proc.h b/devel/electron31/files/patch-net_cert_cert__verify__proc.h
new file mode 100644
index 000000000000..b7016f80c73b
--- /dev/null
+++ b/devel/electron31/files/patch-net_cert_cert__verify__proc.h
@@ -0,0 +1,11 @@
+--- net/cert/cert_verify_proc.h.orig 2024-06-18 21:43:36 UTC
++++ net/cert/cert_verify_proc.h
+@@ -176,7 +176,7 @@ class NET_EXPORT CertVerifyProc
+ kMaxValue = kChainLengthOne
+ };
+
+-#if !(BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || \
++#if !(BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) || \
+ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(CHROME_ROOT_STORE_ONLY))
+ // Creates and returns a CertVerifyProc that uses the system verifier.
+ // |cert_net_fetcher| may not be used, depending on the implementation.
diff --git a/devel/electron31/files/patch-net_disk__cache_simple_simple__file__tracker.cc b/devel/electron31/files/patch-net_disk__cache_simple_simple__file__tracker.cc
new file mode 100644
index 000000000000..ea6580b0cab2
--- /dev/null
+++ b/devel/electron31/files/patch-net_disk__cache_simple_simple__file__tracker.cc
@@ -0,0 +1,20 @@
+--- net/disk_cache/simple/simple_file_tracker.cc.orig 2022-06-17 14:20:10 UTC
++++ net/disk_cache/simple/simple_file_tracker.cc
+@@ -29,7 +29,17 @@ void RecordFileDescripterLimiterOp(FileDescriptorLimit
+ } // namespace
+
+ SimpleFileTracker::SimpleFileTracker(int file_limit)
++#if defined(OS_OPENBSD)
++{
++ // cap the file descriptor limit at 85% of the size of the
++ // file descriptor table and also substract the amount of
++ // currently used file descriptors as this should give us
++ // enough reserve to avoid hitting the limit
++ file_limit_ = (getdtablesize() * 0.85) - getdtablecount();
++}
++#else
+ : file_limit_(file_limit) {}
++#endif
+
+ SimpleFileTracker::~SimpleFileTracker() {
+ DCHECK(lru_.empty());
diff --git a/devel/electron31/files/patch-net_dns_BUILD.gn b/devel/electron31/files/patch-net_dns_BUILD.gn
new file mode 100644
index 000000000000..f1e85f0ddb01
--- /dev/null
+++ b/devel/electron31/files/patch-net_dns_BUILD.gn
@@ -0,0 +1,31 @@
+--- net/dns/BUILD.gn.orig 2024-06-30 11:48:27 UTC
++++ net/dns/BUILD.gn
+@@ -138,7 +138,7 @@ source_set("dns") {
+ "dns_config_service_android.cc",
+ "dns_config_service_android.h",
+ ]
+- } else if (is_linux) {
++ } else if (is_linux && !is_bsd) {
+ sources += [
+ "dns_config_service_linux.cc",
+ "dns_config_service_linux.h",
+@@ -179,6 +179,7 @@ source_set("dns") {
+ ":host_resolver_manager",
+ ":mdns_client",
+ "//net:net_public_deps",
++ "//printing/buildflags",
+ ]
+
+ allow_circular_includes_from = [
+@@ -449,9 +450,9 @@ source_set("tests") {
+
+ if (is_android) {
+ sources += [ "dns_config_service_android_unittest.cc" ]
+- } else if (is_linux) {
++ } else if (is_linux && !is_bsd) {
+ sources += [ "dns_config_service_linux_unittest.cc" ]
+- } else if (is_posix) {
++ } else if (is_posix && !is_bsd) {
+ sources += [ "dns_config_service_posix_unittest.cc" ]
+ }
+
diff --git a/devel/electron31/files/patch-net_dns_address__info.cc b/devel/electron31/files/patch-net_dns_address__info.cc
new file mode 100644
index 000000000000..e73c66e5fd8b
--- /dev/null
+++ b/devel/electron31/files/patch-net_dns_address__info.cc
@@ -0,0 +1,16 @@
+--- net/dns/address_info.cc.orig 2024-02-21 00:20:50 UTC
++++ net/dns/address_info.cc
+@@ -78,8 +78,12 @@ AddressInfo::AddressInfoAndResult AddressInfo::Get(
+ // error.
+ // http://crbug.com/134142
+ err = ERR_NAME_NOT_RESOLVED;
+-#elif BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_FREEBSD)
++#elif BUILDFLAG(IS_POSIX)
++#ifdef EAI_NODATA
+ if (os_error != EAI_NONAME && os_error != EAI_NODATA)
++#else
++ if (os_error != EAI_NONAME)
++#endif
+ err = ERR_NAME_RESOLUTION_FAILED;
+ #endif
+
diff --git a/devel/electron31/files/patch-net_dns_address__sorter__posix.cc b/devel/electron31/files/patch-net_dns_address__sorter__posix.cc
new file mode 100644
index 000000000000..e3b77b5a6717
--- /dev/null
+++ b/devel/electron31/files/patch-net_dns_address__sorter__posix.cc
@@ -0,0 +1,10 @@
+--- net/dns/address_sorter_posix.cc.orig 2024-04-15 20:34:02 UTC
++++ net/dns/address_sorter_posix.cc
+@@ -27,6 +27,7 @@
+ #include "net/dns/netinet_in_var_ios.h"
+ #else
+ #include <netinet/in_var.h>
++#include <netinet6/in6_var.h>
+ #endif // BUILDFLAG(IS_IOS)
+ #endif
+ #include <vector>
diff --git a/devel/electron31/files/patch-net_dns_dns__config__service__posix.cc b/devel/electron31/files/patch-net_dns_dns__config__service__posix.cc
new file mode 100644
index 000000000000..f54393c1baf8
--- /dev/null
+++ b/devel/electron31/files/patch-net_dns_dns__config__service__posix.cc
@@ -0,0 +1,27 @@
+--- net/dns/dns_config_service_posix.cc.orig 2023-02-15 13:08:44 UTC
++++ net/dns/dns_config_service_posix.cc
+@@ -34,6 +34,11 @@
+ #include "net/dns/dns_config_watcher_mac.h"
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include "base/command_line.h"
++#include "sandbox/policy/switches.h"
++#endif
++
+ namespace net {
+
+ namespace internal {
+@@ -130,6 +135,12 @@ class DnsConfigServicePosix::Watcher : public DnsConfi
+
+ bool Watch() override {
+ CheckOnCorrectSequence();
++
++// pledge + unveil
++ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
++ if (!command_line->HasSwitch(sandbox::policy::switches::kNoSandbox))
++ return false;
++
+ bool success = true;
+ #if !IS_MAS_BUILD()
+ if (!config_watcher_.Watch(base::BindRepeating(&Watcher::OnConfigChanged,
diff --git a/devel/electron31/files/patch-net_dns_dns__reloader.cc b/devel/electron31/files/patch-net_dns_dns__reloader.cc
new file mode 100644
index 000000000000..9a8ed94039dc
--- /dev/null
+++ b/devel/electron31/files/patch-net_dns_dns__reloader.cc
@@ -0,0 +1,10 @@
+--- net/dns/dns_reloader.cc.orig 2023-03-30 00:33:54 UTC
++++ net/dns/dns_reloader.cc
+@@ -10,6 +10,7 @@
+ // - there's not guarantee it exists at all. :(
+ #if BUILDFLAG(IS_POSIX)
+
++#include <netinet/in.h>
+ #include <resolv.h>
+
+ // This code only works on systems where the C library provides res_ninit(3) and
diff --git a/devel/electron31/files/patch-net_dns_dns__util.cc b/devel/electron31/files/patch-net_dns_dns__util.cc
new file mode 100644
index 000000000000..7de4f95330dc
--- /dev/null
+++ b/devel/electron31/files/patch-net_dns_dns__util.cc
@@ -0,0 +1,11 @@
+--- net/dns/dns_util.cc.orig 2023-02-01 18:43:23 UTC
++++ net/dns/dns_util.cc
+@@ -29,6 +29,8 @@
+ #include "net/dns/public/util.h"
+ #include "net/third_party/uri_template/uri_template.h"
+
++#include <sys/socket.h>
++
+ #if BUILDFLAG(IS_POSIX)
+ #include <net/if.h>
+ #include <netinet/in.h>
diff --git a/devel/electron31/files/patch-net_dns_host__resolver__proc.cc b/devel/electron31/files/patch-net_dns_host__resolver__proc.cc
new file mode 100644
index 000000000000..3e1336aaa4eb
--- /dev/null
+++ b/devel/electron31/files/patch-net_dns_host__resolver__proc.cc
@@ -0,0 +1,13 @@
+--- net/dns/host_resolver_proc.cc.orig 2022-11-30 08:12:58 UTC
++++ net/dns/host_resolver_proc.cc
+@@ -15,10 +15,6 @@
+ #include "net/base/net_errors.h"
+ #include "net/dns/host_resolver_system_task.h"
+
+-#if BUILDFLAG(IS_OPENBSD)
+-#define AI_ADDRCONFIG 0
+-#endif
+-
+ namespace net {
+
+ HostResolverProc* HostResolverProc::default_proc_ = nullptr;
diff --git a/devel/electron31/files/patch-net_dns_public_BUILD.gn b/devel/electron31/files/patch-net_dns_public_BUILD.gn
new file mode 100644
index 000000000000..1e5d2a8dca2a
--- /dev/null
+++ b/devel/electron31/files/patch-net_dns_public_BUILD.gn
@@ -0,0 +1,11 @@
+--- net/dns/public/BUILD.gn.orig 2024-06-18 21:43:36 UTC
++++ net/dns/public/BUILD.gn
+@@ -78,7 +78,7 @@ source_set("tests") {
+ "doh_provider_entry_unittest.cc",
+ ]
+
+- if (is_posix && !is_android) {
++ if (is_posix && !is_android && !is_bsd) {
+ sources += [ "resolv_reader_unittest.cc" ]
+ }
+
diff --git a/devel/electron31/files/patch-net_dns_public_resolv__reader.h b/devel/electron31/files/patch-net_dns_public_resolv__reader.h
new file mode 100644
index 000000000000..8e97c9b36f33
--- /dev/null
+++ b/devel/electron31/files/patch-net_dns_public_resolv__reader.h
@@ -0,0 +1,10 @@
+--- net/dns/public/resolv_reader.h.orig 2022-02-28 16:54:41 UTC
++++ net/dns/public/resolv_reader.h
+@@ -5,6 +5,7 @@
+ #ifndef NET_DNS_PUBLIC_RESOLV_READER_H_
+ #define NET_DNS_PUBLIC_RESOLV_READER_H_
+
++#include <netinet/in.h>
+ #include <resolv.h>
+
+ #include <memory>
diff --git a/devel/electron31/files/patch-net_dns_public_scoped__res__state.h b/devel/electron31/files/patch-net_dns_public_scoped__res__state.h
new file mode 100644
index 000000000000..0fc78c4a06a0
--- /dev/null
+++ b/devel/electron31/files/patch-net_dns_public_scoped__res__state.h
@@ -0,0 +1,10 @@
+--- net/dns/public/scoped_res_state.h.orig 2024-02-21 00:20:50 UTC
++++ net/dns/public/scoped_res_state.h
+@@ -5,6 +5,7 @@
+ #ifndef NET_DNS_PUBLIC_SCOPED_RES_STATE_H_
+ #define NET_DNS_PUBLIC_SCOPED_RES_STATE_H_
+
++#include <netinet/in.h>
+ #include <resolv.h>
+
+ #include <optional>
diff --git a/devel/electron31/files/patch-net_filter_zstd__source__stream.cc b/devel/electron31/files/patch-net_filter_zstd__source__stream.cc
new file mode 100644
index 000000000000..e4820db54a4e
--- /dev/null
+++ b/devel/electron31/files/patch-net_filter_zstd__source__stream.cc
@@ -0,0 +1,10 @@
+--- net/filter/zstd_source_stream.cc.orig 2024-02-21 00:20:50 UTC
++++ net/filter/zstd_source_stream.cc
+@@ -7,6 +7,7 @@
+ #include <algorithm>
+ #include <unordered_map>
+ #include <utility>
++#include <unordered_map>
+
+ #define ZSTD_STATIC_LINKING_ONLY
+
diff --git a/devel/electron31/files/patch-net_http_http__auth__gssapi__posix.cc b/devel/electron31/files/patch-net_http_http__auth__gssapi__posix.cc
new file mode 100644
index 000000000000..920576227b0d
--- /dev/null
+++ b/devel/electron31/files/patch-net_http_http__auth__gssapi__posix.cc
@@ -0,0 +1,14 @@
+--- net/http/http_auth_gssapi_posix.cc.orig 2023-05-25 00:42:00 UTC
++++ net/http/http_auth_gssapi_posix.cc
+@@ -370,8 +370,9 @@ base::NativeLibrary GSSAPISharedLibrary::LoadSharedLib
+ static const char* const kDefaultLibraryNames[] = {
+ #if BUILDFLAG(IS_APPLE)
+ "/System/Library/Frameworks/GSS.framework/GSS"
+-#elif BUILDFLAG(IS_OPENBSD)
+- "libgssapi.so" // Heimdal - OpenBSD
++#elif BUILDFLAG(IS_BSD)
++ "libgssapi_krb5.so.2", // MIT Kerberos - FreeBSD
++ "libgssapi.so" // Heimdal - OpenBSD, FreeBSD
+ #else
+ "libgssapi_krb5.so.2", // MIT Kerberos - FC, Suse10, Debian
+ "libgssapi.so.4", // Heimdal - Suse10, MDK
diff --git a/devel/electron31/files/patch-net_http_http__auth__gssapi__posix.h b/devel/electron31/files/patch-net_http_http__auth__gssapi__posix.h
new file mode 100644
index 000000000000..a5df8462e3a1
--- /dev/null
+++ b/devel/electron31/files/patch-net_http_http__auth__gssapi__posix.h
@@ -0,0 +1,12 @@
+--- net/http/http_auth_gssapi_posix.h.orig 2022-08-31 12:19:35 UTC
++++ net/http/http_auth_gssapi_posix.h
+@@ -21,6 +21,9 @@
+ #if BUILDFLAG(IS_APPLE)
+ #include <GSS/gssapi.h>
+ #elif BUILDFLAG(IS_FREEBSD)
++#ifndef GSS_C_DELEG_POLICY_FLAG
++#define GSS_C_DELEG_POLICY_FLAG 32768
++#endif
+ #include <gssapi/gssapi.h>
+ #else
+ #include <gssapi.h>
diff --git a/devel/electron31/files/patch-net_http_http__auth__handler__negotiate.cc b/devel/electron31/files/patch-net_http_http__auth__handler__negotiate.cc
new file mode 100644
index 000000000000..6cb87ad1befd
--- /dev/null
+++ b/devel/electron31/files/patch-net_http_http__auth__handler__negotiate.cc
@@ -0,0 +1,11 @@
+--- net/http/http_auth_handler_negotiate.cc.orig 2024-04-15 20:34:02 UTC
++++ net/http/http_auth_handler_negotiate.cc
+@@ -120,7 +120,7 @@ int HttpAuthHandlerNegotiate::Factory::CreateAuthHandl
+ #elif BUILDFLAG(IS_POSIX)
+ if (is_unsupported_)
+ return ERR_UNSUPPORTED_AUTH_SCHEME;
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Note: Don't set is_unsupported_ = true here. AllowGssapiLibraryLoad()
+ // might change to true during a session.
+ if (!http_auth_preferences() ||
diff --git a/devel/electron31/files/patch-net_http_http__auth__preferences.cc b/devel/electron31/files/patch-net_http_http__auth__preferences.cc
new file mode 100644
index 000000000000..d30b0907f30e
--- /dev/null
+++ b/devel/electron31/files/patch-net_http_http__auth__preferences.cc
@@ -0,0 +1,11 @@
+--- net/http/http_auth_preferences.cc.orig 2023-10-19 19:58:28 UTC
++++ net/http/http_auth_preferences.cc
+@@ -39,7 +39,7 @@ std::string HttpAuthPreferences::AuthAndroidNegotiateA
+ }
+ #endif // BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool HttpAuthPreferences::AllowGssapiLibraryLoad() const {
+ return allow_gssapi_library_load_;
+ }
diff --git a/devel/electron31/files/patch-net_http_http__auth__preferences.h b/devel/electron31/files/patch-net_http_http__auth__preferences.h
new file mode 100644
index 000000000000..1dd6c8db3248
--- /dev/null
+++ b/devel/electron31/files/patch-net_http_http__auth__preferences.h
@@ -0,0 +1,29 @@
+--- net/http/http_auth_preferences.h.orig 2023-10-19 19:58:28 UTC
++++ net/http/http_auth_preferences.h
+@@ -50,7 +50,7 @@ class NET_EXPORT HttpAuthPreferences {
+ #if BUILDFLAG(IS_ANDROID)
+ virtual std::string AuthAndroidNegotiateAccountType() const;
+ #endif
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ virtual bool AllowGssapiLibraryLoad() const;
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+ virtual bool CanUseDefaultCredentials(
+@@ -86,7 +86,7 @@ class NET_EXPORT HttpAuthPreferences {
+ }
+ #endif // BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void set_allow_gssapi_library_load(bool allow_gssapi_library_load) {
+ allow_gssapi_library_load_ = allow_gssapi_library_load;
+ }
+@@ -137,7 +137,7 @@ class NET_EXPORT HttpAuthPreferences {
+ std::string auth_android_negotiate_account_type_;
+ #endif // BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool allow_gssapi_library_load_ = true;
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+
diff --git a/devel/electron31/files/patch-net_http_http__network__session.cc b/devel/electron31/files/patch-net_http_http__network__session.cc
new file mode 100644
index 000000000000..b1e15c11990a
--- /dev/null
+++ b/devel/electron31/files/patch-net_http_http__network__session.cc
@@ -0,0 +1,12 @@
+--- net/http/http_network_session.cc.orig 2023-02-01 18:43:23 UTC
++++ net/http/http_network_session.cc
+@@ -19,7 +19,9 @@
+ #include "build/build_config.h"
+ #include "net/base/features.h"
+ #include "net/dns/host_resolver.h"
++#if defined(USE_KERBEROS)
+ #include "net/http/http_auth_handler_factory.h"
++#endif
+ #include "net/http/http_response_body_drainer.h"
+ #include "net/http/http_stream_factory.h"
+ #include "net/http/url_security_manager.h"
diff --git a/devel/electron31/files/patch-net_proxy__resolution_proxy__config__service.cc b/devel/electron31/files/patch-net_proxy__resolution_proxy__config__service.cc
new file mode 100644
index 000000000000..1a4a43ada141
--- /dev/null
+++ b/devel/electron31/files/patch-net_proxy__resolution_proxy__config__service.cc
@@ -0,0 +1,35 @@
+--- net/proxy_resolution/proxy_config_service.cc.orig 2023-03-30 00:33:55 UTC
++++ net/proxy_resolution/proxy_config_service.cc
+@@ -19,20 +19,20 @@
+ #include "net/proxy_resolution/proxy_config_service_ios.h"
+ #elif BUILDFLAG(IS_MAC)
+ #include "net/proxy_resolution/proxy_config_service_mac.h"
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "net/proxy_resolution/proxy_config_service_linux.h"
+ #elif BUILDFLAG(IS_ANDROID)
+ #include "net/proxy_resolution/proxy_config_service_android.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "net/traffic_annotation/network_traffic_annotation.h"
+ #endif
+
+ namespace net {
+
+ namespace {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ constexpr net::NetworkTrafficAnnotationTag kSystemProxyConfigTrafficAnnotation =
+ net::DefineNetworkTrafficAnnotation("proxy_config_system", R"(
+ semantics {
+@@ -108,7 +108,7 @@ ProxyConfigService::CreateSystemProxyConfigService(
+ << "profile_io_data.cc::CreateProxyConfigService and this should "
+ << "be used only for examples.";
+ return std::make_unique<UnsetProxyConfigService>();
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<ProxyConfigServiceLinux> linux_config_service(
+ std::make_unique<ProxyConfigServiceLinux>());
+
diff --git a/devel/electron31/files/patch-net_proxy__resolution_proxy__config__service__linux.cc b/devel/electron31/files/patch-net_proxy__resolution_proxy__config__service__linux.cc
new file mode 100644
index 000000000000..552fa1c05a77
--- /dev/null
+++ b/devel/electron31/files/patch-net_proxy__resolution_proxy__config__service__linux.cc
@@ -0,0 +1,40 @@
+--- net/proxy_resolution/proxy_config_service_linux.cc.orig 2024-06-18 21:43:37 UTC
++++ net/proxy_resolution/proxy_config_service_linux.cc
+@@ -6,7 +6,9 @@
+
+ #include <errno.h>
+ #include <limits.h>
++#if !BUILDFLAG(IS_BSD)
+ #include <sys/inotify.h>
++#endif
+ #include <unistd.h>
+
+ #include <map>
+@@ -505,6 +507,7 @@ bool SettingGetterImplGSettings::CheckVersion(
+ }
+ #endif // defined(USE_GIO)
+
++#if !BUILDFLAG(IS_BSD)
+ // Converts |value| from a decimal string to an int. If there was a failure
+ // parsing, returns |default_value|.
+ int StringToIntOrDefault(std::string_view value, int default_value) {
+@@ -1033,6 +1036,7 @@ class SettingGetterImplKDE : public ProxyConfigService
+ // events on.
+ scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
+ };
++#endif
+
+ } // namespace
+
+@@ -1251,9 +1255,11 @@ ProxyConfigServiceLinux::Delegate::Delegate(
+ case base::nix::DESKTOP_ENVIRONMENT_KDE4:
+ case base::nix::DESKTOP_ENVIRONMENT_KDE5:
+ case base::nix::DESKTOP_ENVIRONMENT_KDE6:
++#if !BUILDFLAG(IS_BSD)
+ setting_getter_ =
+ std::make_unique<SettingGetterImplKDE>(env_var_getter_.get());
+ break;
++#endif
+ case base::nix::DESKTOP_ENVIRONMENT_XFCE:
+ case base::nix::DESKTOP_ENVIRONMENT_LXQT:
+ case base::nix::DESKTOP_ENVIRONMENT_OTHER:
diff --git a/devel/electron31/files/patch-net_socket_socket__posix.cc b/devel/electron31/files/patch-net_socket_socket__posix.cc
new file mode 100644
index 000000000000..665305fd5623
--- /dev/null
+++ b/devel/electron31/files/patch-net_socket_socket__posix.cc
@@ -0,0 +1,11 @@
+--- net/socket/socket_posix.cc.orig 2022-07-22 17:30:31 UTC
++++ net/socket/socket_posix.cc
+@@ -516,7 +516,7 @@ void SocketPosix::ReadCompleted() {
+ }
+
+ int SocketPosix::DoWrite(IOBuffer* buf, int buf_len) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // Disable SIGPIPE for this write. Although Chromium globally disables
+ // SIGPIPE, the net stack may be used in other consumers which do not do
+ // this. MSG_NOSIGNAL is a Linux-only API. On OS X, this is a setsockopt on
diff --git a/devel/electron31/files/patch-net_socket_socks5__client__socket.cc b/devel/electron31/files/patch-net_socket_socks5__client__socket.cc
new file mode 100644
index 000000000000..d80844cdf1be
--- /dev/null
+++ b/devel/electron31/files/patch-net_socket_socks5__client__socket.cc
@@ -0,0 +1,12 @@
+--- net/socket/socks5_client_socket.cc.orig 2022-04-21 18:48:31 UTC
++++ net/socket/socks5_client_socket.cc
+@@ -19,6 +19,9 @@
+ #include "net/log/net_log_event_type.h"
+ #include "net/traffic_annotation/network_traffic_annotation.h"
+
++#include <sys/types.h>
++#include <netinet/in.h>
++
+ namespace net {
+
+ const unsigned int SOCKS5ClientSocket::kGreetReadHeaderSize = 2;
diff --git a/devel/electron31/files/patch-net_socket_tcp__socket__posix.cc b/devel/electron31/files/patch-net_socket_tcp__socket__posix.cc
new file mode 100644
index 000000000000..de9944328b67
--- /dev/null
+++ b/devel/electron31/files/patch-net_socket_tcp__socket__posix.cc
@@ -0,0 +1,20 @@
+--- net/socket/tcp_socket_posix.cc.orig 2023-05-25 00:42:00 UTC
++++ net/socket/tcp_socket_posix.cc
+@@ -98,6 +98,17 @@ bool SetTCPKeepAlive(int fd, bool enable, int delay) {
+ PLOG(ERROR) << "Failed to set TCP_KEEPALIVE on fd: " << fd;
+ return false;
+ }
++#elif BUILDFLAG(IS_FREEBSD)
++ // Set seconds until first TCP keep alive.
++ if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &delay, sizeof(delay))) {
++ PLOG(ERROR) << "Failed to set TCP_KEEPIDLE on fd: " << fd;
++ return false;
++ }
++ // Set seconds between TCP keep alives.
++ if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &delay, sizeof(delay))) {
++ PLOG(ERROR) << "Failed to set TCP_KEEPINTVL on fd: " << fd;
++ return false;
++ }
+ #endif
+ }
+
diff --git a/devel/electron31/files/patch-net_socket_udp__socket__posix.cc b/devel/electron31/files/patch-net_socket_udp__socket__posix.cc
new file mode 100644
index 000000000000..9f9204cf40c4
--- /dev/null
+++ b/devel/electron31/files/patch-net_socket_udp__socket__posix.cc
@@ -0,0 +1,39 @@
+--- net/socket/udp_socket_posix.cc.orig 2024-06-18 21:43:37 UTC
++++ net/socket/udp_socket_posix.cc
+@@ -516,12 +516,17 @@ int UDPSocketPosix::SetRecvTos() {
+ }
+ }
+
++#ifdef IP_RECVTOS
+ int rv = setsockopt(socket_, IPPROTO_IP, IP_RECVTOS, &ecn, sizeof(ecn));
++#else
++ int rv = -1;
++ errno = EOPNOTSUPP;
++#endif
+ return rv == 0 ? OK : MapSystemError(errno);
+ }
+
+ void UDPSocketPosix::SetMsgConfirm(bool confirm) {
+-#if !BUILDFLAG(IS_APPLE)
++#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD)
+ if (confirm) {
+ sendto_flags_ |= MSG_CONFIRM;
+ } else {
+@@ -542,7 +547,7 @@ int UDPSocketPosix::SetBroadcast(bool broadcast) {
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
+ int value = broadcast ? 1 : 0;
+ int rv;
+-#if BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ // SO_REUSEPORT on OSX permits multiple processes to each receive
+ // UDP multicast or broadcast datagrams destined for the bound
+ // port.
+@@ -880,7 +885,7 @@ int UDPSocketPosix::DoBind(const IPEndPoint& address)
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ if (last_error == EINVAL)
+ return ERR_ADDRESS_IN_USE;
+-#elif BUILDFLAG(IS_APPLE)
++#elif BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ if (last_error == EADDRNOTAVAIL)
+ return ERR_ADDRESS_IN_USE;
+ #endif
diff --git a/devel/electron31/files/patch-net_socket_udp__socket__unittest.cc b/devel/electron31/files/patch-net_socket_udp__socket__unittest.cc
new file mode 100644
index 000000000000..95f26807b6c8
--- /dev/null
+++ b/devel/electron31/files/patch-net_socket_udp__socket__unittest.cc
@@ -0,0 +1,47 @@
+--- net/socket/udp_socket_unittest.cc.orig 2024-06-18 21:43:37 UTC
++++ net/socket/udp_socket_unittest.cc
+@@ -358,7 +358,7 @@ TEST_F(UDPSocketTest, PartialRecv) {
+ EXPECT_EQ(second_packet, received);
+ }
+
+-#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // - MacOS: requires root permissions on OSX 10.7+.
+ // - Android: devices attached to testbots don't have default network, so
+ // broadcasting to 255.255.255.255 returns error -109 (Address not reachable).
+@@ -669,7 +669,7 @@ TEST_F(UDPSocketTest, ClientSetDoNotFragment) {
+ EXPECT_THAT(rv, IsOk());
+
+ rv = client.SetDoNotFragment();
+-#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/42050633): IP_MTU_DISCOVER is not implemented on Fuchsia.
+ EXPECT_THAT(rv, IsError(ERR_NOT_IMPLEMENTED));
+ #elif BUILDFLAG(IS_MAC)
+@@ -697,7 +697,7 @@ TEST_F(UDPSocketTest, ServerSetDoNotFragment) {
+ EXPECT_THAT(rv, IsOk());
+
+ rv = server.SetDoNotFragment();
+-#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/42050633): IP_MTU_DISCOVER is not implemented on Fuchsia.
+ EXPECT_THAT(rv, IsError(ERR_NOT_IMPLEMENTED));
+ #elif BUILDFLAG(IS_MAC)
+@@ -762,7 +762,7 @@ TEST_F(UDPSocketTest, JoinMulticastGroup) {
+
+ // TODO(crbug.com/40620614): failing on device on iOS 12.2.
+ // TODO(crbug.com/40189274): flaky on Mac 11.
+-#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #define MAYBE_SharedMulticastAddress DISABLED_SharedMulticastAddress
+ #else
+ #define MAYBE_SharedMulticastAddress SharedMulticastAddress
+@@ -816,7 +816,7 @@ TEST_F(UDPSocketTest, MAYBE_SharedMulticastAddress) {
+ NetLogSource());
+ ASSERT_THAT(client_socket.Connect(send_address), IsOk());
+
+-#if !BUILDFLAG(IS_CHROMEOS_ASH)
++#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_BSD)
+ // Send a message via the multicast group. That message is expected be be
+ // received by both receving sockets.
+ //
diff --git a/devel/electron31/files/patch-net_third__party_quiche_BUILD.gn b/devel/electron31/files/patch-net_third__party_quiche_BUILD.gn
new file mode 100644
index 000000000000..a3a1f5329930
--- /dev/null
+++ b/devel/electron31/files/patch-net_third__party_quiche_BUILD.gn
@@ -0,0 +1,11 @@
+--- net/third_party/quiche/BUILD.gn.orig 2023-11-29 21:40:08 UTC
++++ net/third_party/quiche/BUILD.gn
+@@ -29,7 +29,7 @@ import("//third_party/protobuf/proto_library.gni")
+ import("//testing/libfuzzer/fuzzer_test.gni")
+ import("//third_party/protobuf/proto_library.gni")
+
+-build_epoll_based_tools = is_linux || is_chromeos
++build_epoll_based_tools = (is_linux && !is_bsd) || is_chromeos
+
+ config("quiche_internal_config") {
+ cflags = []
diff --git a/devel/electron31/files/patch-net_tools_cert__verify__tool_cert__verify__comparision__tool.cc b/devel/electron31/files/patch-net_tools_cert__verify__tool_cert__verify__comparision__tool.cc
new file mode 100644
index 000000000000..29a02117cfac
--- /dev/null
+++ b/devel/electron31/files/patch-net_tools_cert__verify__tool_cert__verify__comparision__tool.cc
@@ -0,0 +1,29 @@
+--- net/tools/cert_verify_tool/cert_verify_comparision_tool.cc.orig 2024-06-18 21:43:37 UTC
++++ net/tools/cert_verify_tool/cert_verify_comparision_tool.cc
+@@ -36,7 +36,7 @@
+ #include "net/url_request/url_request_context_builder.h"
+ #include "net/url_request/url_request_context_getter.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "net/proxy_resolution/proxy_config.h"
+ #include "net/proxy_resolution/proxy_config_service_fixed.h"
+ #endif
+@@ -56,7 +56,7 @@ void SetUpOnNetworkThread(
+ base::WaitableEvent* initialization_complete_event) {
+ net::URLRequestContextBuilder url_request_context_builder;
+ url_request_context_builder.set_user_agent(GetUserAgent());
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On Linux, use a fixed ProxyConfigService, since the default one
+ // depends on glib.
+ //
+@@ -124,7 +124,7 @@ std::unique_ptr<CertVerifyImpl> CreateCertVerifyImplFr
+ std::unique_ptr<CertVerifyImpl> CreateCertVerifyImplFromName(
+ std::string_view impl_name,
+ scoped_refptr<net::CertNetFetcher> cert_net_fetcher) {
+-#if !(BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || \
++#if !(BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) || \
+ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(CHROME_ROOT_STORE_ONLY))
+ if (impl_name == "platform") {
+ return std::make_unique<CertVerifyImpl>(
diff --git a/devel/electron31/files/patch-net_tools_cert__verify__tool_cert__verify__tool.cc b/devel/electron31/files/patch-net_tools_cert__verify__tool_cert__verify__tool.cc
new file mode 100644
index 000000000000..c0343723e88c
--- /dev/null
+++ b/devel/electron31/files/patch-net_tools_cert__verify__tool_cert__verify__tool.cc
@@ -0,0 +1,29 @@
+--- net/tools/cert_verify_tool/cert_verify_tool.cc.orig 2024-06-18 21:43:37 UTC
++++ net/tools/cert_verify_tool/cert_verify_tool.cc
+@@ -34,7 +34,7 @@
+ #include "third_party/boringssl/src/pki/trust_store.h"
+ #include "third_party/boringssl/src/pki/trust_store_collection.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "net/proxy_resolution/proxy_config.h"
+ #include "net/proxy_resolution/proxy_config_service_fixed.h"
+ #endif
+@@ -66,7 +66,7 @@ void SetUpOnNetworkThread(
+ base::WaitableEvent* initialization_complete_event) {
+ net::URLRequestContextBuilder url_request_context_builder;
+ url_request_context_builder.set_user_agent(GetUserAgent());
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On Linux, use a fixed ProxyConfigService, since the default one
+ // depends on glib.
+ //
+@@ -571,7 +571,7 @@ int main(int argc, char** argv) {
+ std::string impls_str = command_line.GetSwitchValueASCII("impls");
+ if (impls_str.empty()) {
+ // Default value.
+-#if !(BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || \
++#if !(BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) || \
+ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(CHROME_ROOT_STORE_ONLY))
+ impls_str = "platform,";
+ #endif
diff --git a/devel/electron31/files/patch-net_tools_net__watcher_net__watcher.cc b/devel/electron31/files/patch-net_tools_net__watcher_net__watcher.cc
new file mode 100644
index 000000000000..1fb0a9a1b91d
--- /dev/null
+++ b/devel/electron31/files/patch-net_tools_net__watcher_net__watcher.cc
@@ -0,0 +1,29 @@
+--- net/tools/net_watcher/net_watcher.cc.orig 2024-06-18 21:43:37 UTC
++++ net/tools/net_watcher/net_watcher.cc
+@@ -32,7 +32,7 @@
+ #include "net/proxy_resolution/proxy_config_service.h"
+ #include "net/proxy_resolution/proxy_config_with_annotation.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "net/base/network_change_notifier_linux.h"
+ #endif
+
+@@ -44,7 +44,7 @@ namespace {
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Flag to specifies which network interfaces to ignore. Interfaces should
+ // follow as a comma seperated list.
+ const char kIgnoreNetifFlag[] = "ignore-netif";
+@@ -163,7 +163,7 @@ int main(int argc, char* argv[]) {
+
+ NetWatcher net_watcher;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ std::string ignored_netifs_str =
+ command_line->GetSwitchValueASCII(kIgnoreNetifFlag);
diff --git a/devel/electron31/files/patch-net_traffic__annotation_network__traffic__annotation.h b/devel/electron31/files/patch-net_traffic__annotation_network__traffic__annotation.h
new file mode 100644
index 000000000000..d7d514fb683b
--- /dev/null
+++ b/devel/electron31/files/patch-net_traffic__annotation_network__traffic__annotation.h
@@ -0,0 +1,20 @@
+--- net/traffic_annotation/network_traffic_annotation.h.orig 2024-06-18 21:43:37 UTC
++++ net/traffic_annotation/network_traffic_annotation.h
+@@ -373,7 +373,7 @@ struct MutablePartialNetworkTrafficAnnotationTag {
+ } // namespace net
+
+ // Placeholder for unannotated usages.
+-#if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+ #define TRAFFIC_ANNOTATION_WITHOUT_PROTO(ANNOTATION_ID) \
+ net::DefineNetworkTrafficAnnotation(ANNOTATION_ID, "No proto yet.")
+ #endif
+@@ -387,7 +387,7 @@ struct MutablePartialNetworkTrafficAnnotationTag {
+ // TODO(crbug.com/40118868): Revisit once build flag switch of lacros-chrome is
+ // complete.
+ #if !BUILDFLAG(IS_WIN) && \
+- !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+
+ #define NO_TRAFFIC_ANNOTATION_YET \
+ net::DefineNetworkTrafficAnnotation("undefined", "Nothing here yet.")
diff --git a/devel/electron31/files/patch-net_url__request_url__request__context.cc b/devel/electron31/files/patch-net_url__request_url__request__context.cc
new file mode 100644
index 000000000000..e80ef4823e3b
--- /dev/null
+++ b/devel/electron31/files/patch-net_url__request_url__request__context.cc
@@ -0,0 +1,11 @@
+--- net/url_request/url_request_context.cc.orig 2024-06-18 21:43:37 UTC
++++ net/url_request/url_request_context.cc
+@@ -121,7 +121,7 @@ const HttpNetworkSessionContext* URLRequestContext::Ge
+ // TODO(crbug.com/40118868): Revisit once build flag switch of lacros-chrome is
+ // complete.
+ #if !BUILDFLAG(IS_WIN) && \
+- !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ std::unique_ptr<URLRequest> URLRequestContext::CreateRequest(
+ const GURL& url,
+ RequestPriority priority,
diff --git a/devel/electron31/files/patch-net_url__request_url__request__context.h b/devel/electron31/files/patch-net_url__request_url__request__context.h
new file mode 100644
index 000000000000..6a87e84e3fca
--- /dev/null
+++ b/devel/electron31/files/patch-net_url__request_url__request__context.h
@@ -0,0 +1,11 @@
+--- net/url_request/url_request_context.h.orig 2024-06-18 21:43:37 UTC
++++ net/url_request/url_request_context.h
+@@ -89,7 +89,7 @@ class NET_EXPORT URLRequestContext final {
+ // TODO(crbug.com/40118868): Revisit once build flag switch of lacros-chrome is
+ // complete.
+ #if !BUILDFLAG(IS_WIN) && \
+- !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ // This function should not be used in Chromium, please use the version with
+ // NetworkTrafficAnnotationTag in the future.
+ //
diff --git a/devel/electron31/files/patch-net_url__request_url__request__context__builder.cc b/devel/electron31/files/patch-net_url__request_url__request__context__builder.cc
new file mode 100644
index 000000000000..f98456a6f196
--- /dev/null
+++ b/devel/electron31/files/patch-net_url__request_url__request__context__builder.cc
@@ -0,0 +1,11 @@
+--- net/url_request/url_request_context_builder.cc.orig 2024-06-18 21:43:37 UTC
++++ net/url_request/url_request_context_builder.cc
+@@ -439,7 +439,7 @@ std::unique_ptr<URLRequestContext> URLRequestContextBu
+ }
+
+ if (!proxy_resolution_service_) {
+-#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_BSD)
+ // TODO(willchan): Switch to using this code when
+ // ProxyConfigService::CreateSystemProxyConfigService()'s
+ // signature doesn't suck.
diff --git a/devel/electron31/files/patch-pdf_pdfium_pdfium__engine.cc b/devel/electron31/files/patch-pdf_pdfium_pdfium__engine.cc
new file mode 100644
index 000000000000..24ed3492337e
--- /dev/null
+++ b/devel/electron31/files/patch-pdf_pdfium_pdfium__engine.cc
@@ -0,0 +1,20 @@
+--- pdf/pdfium/pdfium_engine.cc.orig 2024-06-18 21:43:37 UTC
++++ pdf/pdfium/pdfium_engine.cc
+@@ -87,7 +87,7 @@
+ #include "gin/public/cppgc.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "pdf/pdfium/pdfium_font_linux.h"
+ #endif
+
+@@ -512,7 +512,7 @@ void InitializeSDK(bool enable_v8,
+
+ FPDF_InitLibraryWithConfig(&config);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ g_font_mapping_mode = font_mapping_mode;
+ InitializeLinuxFontMapper();
+ #endif
diff --git a/devel/electron31/files/patch-printing_backend_cups__ipp__helper.cc b/devel/electron31/files/patch-printing_backend_cups__ipp__helper.cc
new file mode 100644
index 000000000000..b202516f75db
--- /dev/null
+++ b/devel/electron31/files/patch-printing_backend_cups__ipp__helper.cc
@@ -0,0 +1,11 @@
+--- printing/backend/cups_ipp_helper.cc.orig 2024-06-18 21:43:37 UTC
++++ printing/backend/cups_ipp_helper.cc
+@@ -202,7 +202,7 @@ void ExtractResolutions(const CupsOptionProvider& prin
+ // Provide a default DPI if no valid DPI is found.
+ #if BUILDFLAG(IS_MAC)
+ constexpr gfx::Size kDefaultMissingDpi(kDefaultMacDpi, kDefaultMacDpi);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ constexpr gfx::Size kDefaultMissingDpi(kPixelsPerInch, kPixelsPerInch);
+ #else
+ constexpr gfx::Size kDefaultMissingDpi(kDefaultPdfDpi, kDefaultPdfDpi);
diff --git a/devel/electron31/files/patch-printing_mojom_printing__context__mojom__traits.cc b/devel/electron31/files/patch-printing_mojom_printing__context__mojom__traits.cc
new file mode 100644
index 000000000000..c94ddbc40968
--- /dev/null
+++ b/devel/electron31/files/patch-printing_mojom_printing__context__mojom__traits.cc
@@ -0,0 +1,29 @@
+--- printing/mojom/printing_context_mojom_traits.cc.orig 2023-11-29 21:40:08 UTC
++++ printing/mojom/printing_context_mojom_traits.cc
+@@ -19,7 +19,7 @@
+ #include "base/numerics/safe_conversions.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "mojo/public/mojom/base/values.mojom.h"
+ #endif
+
+@@ -161,7 +161,7 @@ bool StructTraits<
+ }
+
+ out->set_pages_per_sheet(data.pages_per_sheet());
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ DCHECK(out->advanced_settings().empty());
+ if (!data.ReadAdvancedSettings(&out->advanced_settings()))
+ return false;
+@@ -238,7 +238,7 @@ bool StructTraits<
+ if (system_print_dialog_data.size() != dictionary_entries) {
+ return false;
+ }
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // The dictionary must contain three strings.
+ const base::Value* value = system_print_dialog_data.Find(
+ printing::kLinuxSystemPrintDialogDataPrinter);
diff --git a/devel/electron31/files/patch-printing_mojom_printing__context__mojom__traits.h b/devel/electron31/files/patch-printing_mojom_printing__context__mojom__traits.h
new file mode 100644
index 000000000000..26b80145a15c
--- /dev/null
+++ b/devel/electron31/files/patch-printing_mojom_printing__context__mojom__traits.h
@@ -0,0 +1,11 @@
+--- printing/mojom/printing_context_mojom_traits.h.orig 2023-10-19 19:58:29 UTC
++++ printing/mojom/printing_context_mojom_traits.h
+@@ -166,7 +166,7 @@ struct StructTraits<printing::mojom::PrintSettingsData
+ return s.pages_per_sheet();
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ static const printing::PrintSettings::AdvancedSettings& advanced_settings(
+ const printing::PrintSettings& s) {
+ return s.advanced_settings();
diff --git a/devel/electron31/files/patch-printing_print__settings.cc b/devel/electron31/files/patch-printing_print__settings.cc
new file mode 100644
index 000000000000..4ad593f843d2
--- /dev/null
+++ b/devel/electron31/files/patch-printing_print__settings.cc
@@ -0,0 +1,38 @@
+--- printing/print_settings.cc.orig 2023-10-19 19:58:29 UTC
++++ printing/print_settings.cc
+@@ -320,7 +320,7 @@ PrintSettings& PrintSettings::operator=(const PrintSet
+ #endif
+ is_modifiable_ = settings.is_modifiable_;
+ pages_per_sheet_ = settings.pages_per_sheet_;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ for (const auto& item : settings.advanced_settings_)
+ advanced_settings_.emplace(item.first, item.second.Clone());
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+@@ -350,7 +350,7 @@ bool PrintSettings::operator==(const PrintSettings& ot
+ #endif
+ is_modifiable_, requested_custom_margins_in_points_,
+ pages_per_sheet_
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ,
+ advanced_settings_
+ #endif
+@@ -374,7 +374,7 @@ bool PrintSettings::operator==(const PrintSettings& ot
+ other.is_modifiable_,
+ other.requested_custom_margins_in_points_,
+ other.pages_per_sheet_
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ,
+ other.advanced_settings_
+ #endif
+@@ -414,7 +414,7 @@ void PrintSettings::Clear() {
+ #endif
+ is_modifiable_ = true;
+ pages_per_sheet_ = 1;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ advanced_settings_.clear();
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ #if BUILDFLAG(IS_CHROMEOS)
diff --git a/devel/electron31/files/patch-printing_print__settings.h b/devel/electron31/files/patch-printing_print__settings.h
new file mode 100644
index 000000000000..da0ca9671815
--- /dev/null
+++ b/devel/electron31/files/patch-printing_print__settings.h
@@ -0,0 +1,47 @@
+--- printing/print_settings.h.orig 2023-10-19 19:58:29 UTC
++++ printing/print_settings.h
+@@ -25,7 +25,7 @@
+ #include "base/values.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <map>
+
+ #include "base/values.h"
+@@ -51,7 +51,7 @@ inline constexpr char kMacSystemPrintDialogDataPrintSe
+ "print_settings";
+ #endif // BUILDFLAG(IS_MAC)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ inline constexpr char kLinuxSystemPrintDialogDataPrinter[] = "printer_name";
+ inline constexpr char kLinuxSystemPrintDialogDataPrintSettings[] =
+ "print_settings";
+@@ -101,7 +101,7 @@ class COMPONENT_EXPORT(PRINTING) PrintSettings {
+ std::string vendor_id;
+ };
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ using AdvancedSettings = std::map<std::string, base::Value>;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+@@ -276,7 +276,7 @@ class COMPONENT_EXPORT(PRINTING) PrintSettings {
+ pages_per_sheet_ = pages_per_sheet;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ AdvancedSettings& advanced_settings() { return advanced_settings_; }
+ const AdvancedSettings& advanced_settings() const {
+ return advanced_settings_;
+@@ -429,7 +429,7 @@ class COMPONENT_EXPORT(PRINTING) PrintSettings {
+ // Number of pages per sheet.
+ int pages_per_sheet_;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Advanced settings.
+ AdvancedSettings advanced_settings_;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
diff --git a/devel/electron31/files/patch-printing_print__settings__conversion.cc b/devel/electron31/files/patch-printing_print__settings__conversion.cc
new file mode 100644
index 000000000000..f3b0d41f5813
--- /dev/null
+++ b/devel/electron31/files/patch-printing_print__settings__conversion.cc
@@ -0,0 +1,11 @@
+--- printing/print_settings_conversion.cc.orig 2024-04-15 20:34:03 UTC
++++ printing/print_settings_conversion.cc
+@@ -285,7 +285,7 @@ std::unique_ptr<PrintSettings> PrintSettingsFromJobSet
+ settings->set_is_modifiable(is_modifiable.value());
+ }
+
+-#if BUILDFLAG(IS_CHROMEOS) || (BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_CUPS))
++#if BUILDFLAG(IS_CHROMEOS) || ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(USE_CUPS))
+ const base::Value::Dict* advanced_settings =
+ job_settings.FindDict(kSettingAdvancedSettings);
+ if (advanced_settings) {
diff --git a/devel/electron31/files/patch-printing_printing__context__linux.cc b/devel/electron31/files/patch-printing_printing__context__linux.cc
new file mode 100644
index 000000000000..8d6303eb6860
--- /dev/null
+++ b/devel/electron31/files/patch-printing_printing__context__linux.cc
@@ -0,0 +1,38 @@
+--- printing/printing_context_linux.cc.orig 2023-11-29 21:40:08 UTC
++++ printing/printing_context_linux.cc
+@@ -23,7 +23,7 @@
+ #endif
+
+ // Avoid using LinuxUi on Fuchsia.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui.h"
+ #endif
+
+@@ -68,7 +68,7 @@ mojom::ResultCode PrintingContextLinux::UseDefaultSett
+
+ ResetSettings();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!ui::LinuxUi::instance())
+ return mojom::ResultCode::kSuccess;
+
+@@ -84,7 +84,7 @@ gfx::Size PrintingContextLinux::GetPdfPaperSizeDeviceU
+ }
+
+ gfx::Size PrintingContextLinux::GetPdfPaperSizeDeviceUnits() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (ui::LinuxUi::instance())
+ return ui::LinuxUi::instance()->GetPdfPaperSize(this);
+ #endif
+@@ -97,7 +97,7 @@ mojom::ResultCode PrintingContextLinux::UpdatePrinterS
+ DCHECK(!printer_settings.show_system_dialog);
+ DCHECK(!in_print_job_);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!ui::LinuxUi::instance())
+ return mojom::ResultCode::kSuccess;
+
diff --git a/devel/electron31/files/patch-printing_sandbox_print__backend__sandbox__hook__linux.cc b/devel/electron31/files/patch-printing_sandbox_print__backend__sandbox__hook__linux.cc
new file mode 100644
index 000000000000..39e5dec1c322
--- /dev/null
+++ b/devel/electron31/files/patch-printing_sandbox_print__backend__sandbox__hook__linux.cc
@@ -0,0 +1,50 @@
+--- printing/sandbox/print_backend_sandbox_hook_linux.cc.orig 2024-04-15 20:34:03 UTC
++++ printing/sandbox/print_backend_sandbox_hook_linux.cc
+@@ -10,20 +10,27 @@
+ #include "base/path_service.h"
+ #include "build/build_config.h"
+ #include "printing/buildflags/buildflags.h"
++#if !BUILDFLAG(IS_BSD)
+ #include "sandbox/linux/syscall_broker/broker_command.h"
+ #include "sandbox/linux/syscall_broker/broker_file_permission.h"
+ #include "sandbox/policy/export.h"
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#else
++#include "sandbox/policy/sandbox.h"
++#endif
+
+ #if BUILDFLAG(IS_CHROMEOS) && BUILDFLAG(USE_CUPS)
+ #include "printing/backend/cups_connection_pool.h"
+ #endif
+
++#if !BUILDFLAG(IS_BSD)
+ using sandbox::syscall_broker::BrokerFilePermission;
+ using sandbox::syscall_broker::MakeBrokerCommandSet;
++#endif
+
+ namespace printing {
+
++#if !BUILDFLAG(IS_BSD)
+ namespace {
+
+ sandbox::syscall_broker::BrokerCommandSet GetPrintBackendBrokerCommandSet() {
+@@ -76,9 +83,11 @@ std::vector<BrokerFilePermission> GetPrintBackendFileP
+ }
+
+ } // namespace
++#endif
+
+ bool PrintBackendPreSandboxHook(
+ sandbox::policy::SandboxLinux::Options options) {
++#if !BUILDFLAG(IS_BSD)
+ #if BUILDFLAG(IS_CHROMEOS) && BUILDFLAG(USE_CUPS)
+ // Create the socket connections to the CUPS server before engaging the
+ // sandbox, since new connections cannot be made after that.
+@@ -91,6 +100,7 @@ bool PrintBackendPreSandboxHook(
+ GetPrintBackendFilePermissions(), options);
+
+ instance->EngageNamespaceSandboxIfPossible();
++#endif
+ return true;
+ }
+
diff --git a/devel/electron31/files/patch-printing_sandbox_print__backend__sandbox__hook__linux.h b/devel/electron31/files/patch-printing_sandbox_print__backend__sandbox__hook__linux.h
new file mode 100644
index 000000000000..678