feat: promisify webContents.printToPDF() (#16795)

This commit is contained in:
Milan Burda 2019-02-11 20:20:04 +01:00 committed by John Kleinschmidt
parent 3effa6f20c
commit 36ce3e9546
12 changed files with 161 additions and 57 deletions

View file

@ -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