Skip to content

Commit

Permalink
fix: pdf download not working (#24946)
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Aug 17, 2020
1 parent db13dcb commit befbbc2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions shell/browser/extensions/electron_extensions_api_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@
#include <string>

#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
Expand Down Expand Up @@ -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<ElectronPDFWebContentsHelperClient>());
#endif
}

std::unique_ptr<MimeHandlerViewGuestDelegate>
Expand Down

0 comments on commit befbbc2

Please sign in to comment.