From 4d16326b4d91d302bf591f2b061d09a27b161140 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 06:23:18 -0500 Subject: [PATCH] fix: FTBFS when building with `enable_plugins = false` (#44025) * fix: do not build electron_plugin_info_host_impl.cc when plugins are disabled it fails to build from source with this error: ../../content/public/browser/plugin_service.h:17:2: error: "Plugins should be enabled" 17 | #error "Plugins should be enabled" Co-authored-by: Charles Kerr * fix: FTBFS in printing_utils.cc when ENABLE_PDF is false Co-authored-by: Charles Kerr * fixup! fix: do not build electron_plugin_info_host_impl.cc when plugins are disabled fix BUILD.gn linting Co-authored-by: Charles Kerr --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr --- BUILD.gn | 2 ++ filenames.gni | 2 -- shell/browser/electron_browser_client.cc | 2 ++ shell/browser/printing/printing_utils.cc | 5 ++++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index d7ea81ac5aa3..97dec9c8d8db 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -674,6 +674,8 @@ source_set("electron_lib") { if (enable_plugins) { sources += [ + "shell/browser/electron_plugin_info_host_impl.cc", + "shell/browser/electron_plugin_info_host_impl.h", "shell/common/plugin_info.cc", "shell/common/plugin_info.h", ] diff --git a/filenames.gni b/filenames.gni index a7a8b1103959..279ba9a2d3c9 100644 --- a/filenames.gni +++ b/filenames.gni @@ -379,8 +379,6 @@ filenames = { "shell/browser/electron_navigation_throttle.h", "shell/browser/electron_permission_manager.cc", "shell/browser/electron_permission_manager.h", - "shell/browser/electron_plugin_info_host_impl.cc", - "shell/browser/electron_plugin_info_host_impl.h", "shell/browser/electron_speech_recognition_manager_delegate.cc", "shell/browser/electron_speech_recognition_manager_delegate.h", "shell/browser/electron_web_contents_utility_handler_impl.cc", diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index 93331bf4c414..e179150464ac 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -1459,6 +1459,7 @@ void ElectronBrowserClient:: render_frame_host); }, &render_frame_host)); +#if BUILDFLAG(ENABLE_PLUGINS) associated_registry.AddInterface( base::BindRepeating( [](content::RenderFrameHost* render_frame_host, @@ -1469,6 +1470,7 @@ void ElectronBrowserClient:: std::move(receiver)); }, &render_frame_host)); +#endif #if BUILDFLAG(ENABLE_PRINTING) associated_registry.AddInterface( base::BindRepeating( diff --git a/shell/browser/printing/printing_utils.cc b/shell/browser/printing/printing_utils.cc index 14dc82a3245a..52534ee31fdb 100644 --- a/shell/browser/printing/printing_utils.cc +++ b/shell/browser/printing/printing_utils.cc @@ -15,11 +15,14 @@ #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" #include "electron/buildflags/buildflags.h" -#include "pdf/pdf_features.h" #include "printing/backend/print_backend.h" // nogncheck #include "printing/units.h" #include "shell/common/thread_restrictions.h" +#if BUILDFLAG(ENABLE_PDF_VIEWER) +#include "pdf/pdf_features.h" +#endif + #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h" #endif