fix: print from PDF viewer not working (#22760)
This commit is contained in:
parent
9d4714f111
commit
24e21467b9
3 changed files with 7 additions and 4 deletions
|
@ -242,6 +242,8 @@ static_library("chrome") {
|
|||
"//chrome/renderer/extensions/extension_hooks_delegate.h",
|
||||
"//chrome/renderer/extensions/tabs_hooks_delegate.cc",
|
||||
"//chrome/renderer/extensions/tabs_hooks_delegate.h",
|
||||
"//chrome/renderer/pepper/chrome_pdf_print_client.cc",
|
||||
"//chrome/renderer/pepper/chrome_pdf_print_client.h",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,10 +74,7 @@ void AddAdditionalDataForPdf(base::DictionaryValue* dict) {
|
|||
dict->SetKey("pdfTwoUpViewEnabled",
|
||||
base::Value(base::FeatureList::IsEnabled(
|
||||
chrome_pdf::features::kPDFTwoUpView)));
|
||||
|
||||
// TODO(nornagon): enable printing once it works.
|
||||
bool enable_printing = false;
|
||||
dict->SetKey("printingEnabled", base::Value(enable_printing));
|
||||
dict->SetKey("printingEnabled", base::Value(true));
|
||||
#endif // BUILDFLAG(ENABLE_PDF)
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
|
||||
#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"
|
||||
|
@ -156,6 +157,9 @@ void RendererClientBase::RenderThreadStarted() {
|
|||
extensions_renderer_client_.reset(new ElectronExtensionsRendererClient);
|
||||
extensions::ExtensionsRendererClient::Set(extensions_renderer_client_.get());
|
||||
|
||||
// Enables printing from Chrome PDF viewer.
|
||||
pdf::PepperPDFHost::SetPrintClient(new ChromePDFPrintClient());
|
||||
|
||||
thread->AddObserver(extensions_renderer_client_->GetDispatcher());
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue