fix: Save As PDF from PDF Preview (#25959)

This commit is contained in:
Shelley Vohr 2020-10-16 18:30:46 -07:00 committed by GitHub
parent 708cf44d19
commit eca53aaaf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 4 deletions

View file

@ -14,6 +14,12 @@
#include "shell/browser/extensions/electron_extension_web_contents_observer.h"
#include "shell/browser/extensions/electron_messaging_delegate.h"
#if BUILDFLAG(ENABLE_PRINTING)
#include "chrome/browser/printing/print_view_manager_basic.h"
#include "components/printing/browser/print_manager_utils.h"
#include "shell/browser/printing/print_preview_message_handler.h"
#endif
#if BUILDFLAG(ENABLE_PDF_VIEWER)
#include "components/pdf/browser/pdf_web_contents_helper.h" // nogncheck
#include "shell/browser/electron_pdf_web_contents_helper_client.h"
@ -52,13 +58,18 @@ MessagingDelegate* ElectronExtensionsAPIClient::GetMessagingDelegate() {
void ElectronExtensionsAPIClient::AttachWebContentsHelpers(
content::WebContents* web_contents) const {
extensions::ElectronExtensionWebContentsObserver::CreateForWebContents(
web_contents);
#if BUILDFLAG(ENABLE_PRINTING)
electron::PrintPreviewMessageHandler::CreateForWebContents(web_contents);
printing::PrintViewManagerBasic::CreateForWebContents(web_contents);
#endif
#if BUILDFLAG(ENABLE_PDF_VIEWER)
pdf::PDFWebContentsHelper::CreateForWebContentsWithClient(
web_contents, std::make_unique<ElectronPDFWebContentsHelperClient>());
#endif
extensions::ElectronExtensionWebContentsObserver::CreateForWebContents(
web_contents);
}
ManagementAPIDelegate*