feat: promisify webContents.printToPDF() (#16795)
This commit is contained in:
parent
3effa6f20c
commit
36ce3e9546
12 changed files with 161 additions and 57 deletions
|
@ -1499,11 +1499,12 @@ std::vector<printing::PrinterBasicInfo> WebContents::GetPrinterList() {
|
|||
return printers;
|
||||
}
|
||||
|
||||
void WebContents::PrintToPDF(
|
||||
const base::DictionaryValue& settings,
|
||||
const PrintPreviewMessageHandler::PrintToPDFCallback& callback) {
|
||||
v8::Local<v8::Promise> WebContents::PrintToPDF(
|
||||
const base::DictionaryValue& settings) {
|
||||
scoped_refptr<util::Promise> promise = new util::Promise(isolate());
|
||||
PrintPreviewMessageHandler::FromWebContents(web_contents())
|
||||
->PrintToPDF(settings, callback);
|
||||
->PrintToPDF(settings, promise);
|
||||
return promise->GetHandle();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue