Skip to content

Commit

Permalink
fix: guard pdf behind correct buildflags (#23406)
Browse files Browse the repository at this point in the history
Co-authored-by: deepak1556 <hop2deep@gmail.com>
  • Loading branch information
trop[bot] and deepak1556 committed May 5, 2020
1 parent 6c78c92 commit c131148
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions shell/renderer/renderer_client_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#endif

#if BUILDFLAG(ENABLE_PDF_VIEWER)
#include "chrome/renderer/pepper/chrome_pdf_print_client.h"
#include "shell/common/electron_constants.h"
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)

Expand All @@ -68,7 +69,6 @@

#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
#include "base/strings/utf_string_conversions.h"
#include "chrome/renderer/pepper/chrome_pdf_print_client.h"
#include "content/public/common/webplugininfo.h"
#include "extensions/common/constants.h"
#include "extensions/common/extensions_client.h"
Expand Down Expand Up @@ -162,10 +162,12 @@ void RendererClientBase::RenderThreadStarted() {
extensions_renderer_client_.reset(new ElectronExtensionsRendererClient);
extensions::ExtensionsRendererClient::Set(extensions_renderer_client_.get());

thread->AddObserver(extensions_renderer_client_->GetDispatcher());
#endif

#if BUILDFLAG(ENABLE_PDF_VIEWER)
// Enables printing from Chrome PDF viewer.
pdf::PepperPDFHost::SetPrintClient(new ChromePDFPrintClient());

thread->AddObserver(extensions_renderer_client_->GetDispatcher());
#endif

#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
Expand Down Expand Up @@ -374,7 +376,7 @@ bool RendererClientBase::IsPluginHandledExternally(
const blink::WebElement& plugin_element,
const GURL& original_url,
const std::string& mime_type) {
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) && BUILDFLAG(ENABLE_PLUGINS)
#if BUILDFLAG(ENABLE_PDF_VIEWER)
DCHECK(plugin_element.HasHTMLTagName("object") ||
plugin_element.HasHTMLTagName("embed"));
// TODO(nornagon): this info should be shared with the data in
Expand Down

0 comments on commit c131148

Please sign in to comment.