Browse Source

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 <[email protected]>

* fix: FTBFS in printing_utils.cc when ENABLE_PDF is false

Co-authored-by: Charles Kerr <[email protected]>

* fixup! fix: do not build electron_plugin_info_host_impl.cc when plugins are disabled

fix BUILD.gn linting

Co-authored-by: Charles Kerr <[email protected]>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <[email protected]>
trop[bot] 6 months ago
parent
commit
4d16326b4d
4 changed files with 8 additions and 3 deletions
  1. 2 0
      BUILD.gn
  2. 0 2
      filenames.gni
  3. 2 0
      shell/browser/electron_browser_client.cc
  4. 4 1
      shell/browser/printing/printing_utils.cc

+ 2 - 0
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",
     ]

+ 0 - 2
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",

+ 2 - 0
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<mojom::ElectronPluginInfoHost>(
       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<printing::mojom::PrintManagerHost>(
       base::BindRepeating(

+ 4 - 1
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