From 48f3ef63e26c0e7b4d6980e71edf95a6b72302fc Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Fri, 18 Oct 2024 11:51:06 -0400 Subject: [PATCH] linux: Fix callbacks to CefPrintHandler (fixes #3729) Out-of-process printing must also be disabled by passing `--disable-features=EnableOopPrintDrivers`. --- .../browser/chrome/chrome_browser_main_extra_parts_cef.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libcef/browser/chrome/chrome_browser_main_extra_parts_cef.cc b/libcef/browser/chrome/chrome_browser_main_extra_parts_cef.cc index f04ee109c..b85ef8a3a 100644 --- a/libcef/browser/chrome/chrome_browser_main_extra_parts_cef.cc +++ b/libcef/browser/chrome/chrome_browser_main_extra_parts_cef.cc @@ -17,6 +17,7 @@ #if BUILDFLAG(IS_LINUX) #include "base/linux_util.h" +#include "cef/libcef/browser/printing/print_dialog_linux.h" #endif #if BUILDFLAG(IS_WIN) @@ -83,4 +84,11 @@ void ChromeBrowserMainExtraPartsCef::ToolkitInitialized() { // Override the default Chrome client. SetConstrainedWindowViewsClient(CreateAlloyConstrainedWindowViewsClient( CreateChromeConstrainedWindowViewsClient())); + +#if BUILDFLAG(IS_LINUX) + auto printing_delegate = new CefPrintingContextLinuxDelegate(); + auto default_delegate = + ui::PrintingContextLinuxDelegate::SetInstance(printing_delegate); + printing_delegate->SetDefaultDelegate(default_delegate); +#endif // BUILDFLAG(IS_LINUX) }