From 48a38c0289925c5b245078e822d232f451d92633 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 26 Mar 2025 04:04:39 -0500 Subject: [PATCH] fix: build failure when printing is disabled (#46283) fix: ftbfs when printing is disabled --- shell/browser/api/electron_api_web_contents.cc | 2 ++ shell/browser/api/electron_api_web_contents.h | 2 ++ shell/browser/feature_list.cc | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 209e47949ee0..a5b7026d0eb3 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -1988,6 +1988,7 @@ void WebContents::DraggableRegionsChanged( draggable_region_ = DraggableRegionsToSkRegion(regions); } +#if BUILDFLAG(ENABLE_PRINTING) void WebContents::PrintCrossProcessSubframe( content::WebContents* web_contents, const gfx::Rect& rect, @@ -1998,6 +1999,7 @@ void WebContents::PrintCrossProcessSubframe( client->PrintCrossProcessSubframe(rect, document_cookie, subframe_host); } } +#endif SkRegion* WebContents::draggable_region() { return g_disable_draggable_regions ? nullptr : draggable_region_.get(); diff --git a/shell/browser/api/electron_api_web_contents.h b/shell/browser/api/electron_api_web_contents.h index 6398bc89d2c1..30a2365bc0a9 100644 --- a/shell/browser/api/electron_api_web_contents.h +++ b/shell/browser/api/electron_api_web_contents.h @@ -585,11 +585,13 @@ class WebContents final : public ExclusiveAccessContext, void DraggableRegionsChanged( const std::vector& regions, content::WebContents* contents) override; +#if BUILDFLAG(ENABLE_PRINTING) void PrintCrossProcessSubframe( content::WebContents* web_contents, const gfx::Rect& rect, int document_cookie, content::RenderFrameHost* subframe_host) const override; +#endif // content::WebContentsObserver: void BeforeUnloadFired(bool proceed) override; diff --git a/shell/browser/feature_list.cc b/shell/browser/feature_list.cc index a4be79d37e98..e6249b383fda 100644 --- a/shell/browser/feature_list.cc +++ b/shell/browser/feature_list.cc @@ -16,6 +16,7 @@ #include "electron/buildflags/buildflags.h" #include "media/base/media_switches.h" #include "net/base/features.h" +#include "printing/buildflags/buildflags.h" #include "services/network/public/cpp/features.h" #include "third_party/blink/public/common/features.h" @@ -60,7 +61,7 @@ void InitializeFeatureList() { std::string(",") + features::kMacWebContentsOcclusion.name; #endif -#if BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_LINUX) && BUILDFLAG(ENABLE_PRINTING) disable_features += // EnableOopPrintDrivers is still a bit half-baked on Linux and // causes crashes when trying to show dialogs.