From befbbc27d8abe5d41260704b4bacfb99373cc62f Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 17 Aug 2020 08:25:20 -0700 Subject: [PATCH] fix: pdf download not working (#24946) --- .../extensions/electron_extensions_api_client.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/shell/browser/extensions/electron_extensions_api_client.cc b/shell/browser/extensions/electron_extensions_api_client.cc index c280df252c6c..5da08766e7e9 100644 --- a/shell/browser/extensions/electron_extensions_api_client.cc +++ b/shell/browser/extensions/electron_extensions_api_client.cc @@ -8,9 +8,15 @@ #include #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest_delegate.h" +#include "printing/buildflags/buildflags.h" #include "shell/browser/extensions/electron_extension_web_contents_observer.h" #include "shell/browser/extensions/electron_messaging_delegate.h" +#if BUILDFLAG(ENABLE_PRINT_PREVIEW) +#include "components/pdf/browser/pdf_web_contents_helper.h" +#include "shell/browser/electron_pdf_web_contents_helper_client.h" +#endif + namespace extensions { class ElectronMimeHandlerViewGuestDelegate @@ -46,6 +52,11 @@ void ElectronExtensionsAPIClient::AttachWebContentsHelpers( content::WebContents* web_contents) const { extensions::ElectronExtensionWebContentsObserver::CreateForWebContents( web_contents); + +#if BUILDFLAG(ENABLE_PRINT_PREVIEW) + pdf::PDFWebContentsHelper::CreateForWebContentsWithClient( + web_contents, std::make_unique()); +#endif } std::unique_ptr