Add callback function in printToPDF API.

This commit is contained in:
Haojian Wu 2015-06-01 10:37:27 +08:00
parent ce8bbb689c
commit 8572ccb807
5 changed files with 61 additions and 19 deletions

View file

@ -16,7 +16,6 @@
#include "native_mate/callback.h"
#include "native_mate/constructor.h"
#include "native_mate/dictionary.h"
#include "printing/print_job_constants.h"
#include "ui/gfx/geometry/rect.h"
#include "atom/common/node_includes.h"
@ -433,11 +432,14 @@ void Window::Print(mate::Arguments* args) {
void Window::PrintToPDF(mate::Arguments* args) {
mate::Dictionary options;
if (args->Length() == 1 && !args->GetNext(&options)) {
base::Callback<void(int)> callback;
if (!(args->Length() == 1 && !args->GetNext(&callback)) &&
!(args->Length() == 2 && args->GetNext(&options)
&& args->GetNext(&callback))) {
args->ThrowError();
return;
}
window_->PrintToPDF(options);
window_->PrintToPDF(options, callback);
}
void Window::SetProgressBar(double progress) {