fix: broken OOP window.print() on macOS/Linux (#45214)

fix: broken OOP printing on macOS/Linux
This commit is contained in:
Shelley Vohr 2025-01-20 10:23:44 +01:00 committed by GitHub
parent 51a249f380
commit 7d05fb2a1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -31,6 +31,11 @@
#include "components/services/print_compositor/public/mojom/print_compositor.mojom.h" // nogncheck
#endif // BUILDFLAG(ENABLE_PRINTING)
#if BUILDFLAG(ENABLE_OOP_PRINTING)
#include "chrome/services/printing/print_backend_service_impl.h"
#include "chrome/services/printing/public/mojom/print_backend_service.mojom.h"
#endif // BUILDFLAG(ENABLE_OOP_PRINTING)
#if BUILDFLAG(ENABLE_PRINTING) && BUILDFLAG(IS_WIN)
#include "chrome/services/printing/pdf_to_emf_converter_factory.h"
#endif
@ -72,6 +77,21 @@ auto RunPrintCompositor(
}
#endif
#if BUILDFLAG(ENABLE_OOP_PRINTING)
auto RunPrintingSandboxedPrintBackendHost(
mojo::PendingReceiver<printing::mojom::SandboxedPrintBackendHost>
receiver) {
return std::make_unique<printing::SandboxedPrintBackendHostImpl>(
std::move(receiver));
}
auto RunPrintingUnsandboxedPrintBackendHost(
mojo::PendingReceiver<printing::mojom::UnsandboxedPrintBackendHost>
receiver) {
return std::make_unique<printing::UnsandboxedPrintBackendHostImpl>(
std::move(receiver));
}
#endif // BUILDFLAG(ENABLE_OOP_PRINTING)
auto RunProxyResolver(
mojo::PendingReceiver<proxy_resolver::mojom::ProxyResolverFactory>
receiver) {
@ -122,6 +142,11 @@ void ElectronContentUtilityClient::RegisterMainThreadServices(
services.Add(RunPrintCompositor);
#endif
#if BUILDFLAG(ENABLE_OOP_PRINTING)
services.Add(RunPrintingSandboxedPrintBackendHost);
services.Add(RunPrintingUnsandboxedPrintBackendHost);
#endif
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) || \
(BUILDFLAG(ENABLE_PRINTING) && BUILDFLAG(IS_WIN))
services.Add(RunPrintingService);