Chromium Code Reviews| Index: chrome/browser/ui/webui/print_preview/print_preview_handler.cc |
| diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc |
| index 86ee312de2523d6cdec431d45fdeac0d8f56af72..18fb280fd917dd8baaa0ce8018824e0780ab05db 100644 |
| --- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc |
| +++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc |
| @@ -278,11 +278,13 @@ void ReportPrintSettingsStats(const base::DictionaryValue& settings) { |
| // Callback that stores a PDF file on disk. |
| void PrintToPdfCallback(printing::Metafile* metafile, |
| - const base::FilePath& path) { |
| + const base::FilePath& path, |
| + const base::Closure& pdf_file_saved_callback) { |
| DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| metafile->SaveTo(path); |
| // |metafile| must be deleted on the UI thread. |
| BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, metafile); |
| + pdf_file_saved_callback.Run(); |
|
Lei Zhang
2014/07/22 03:04:39
What happens when you save to PDF outside of your
ivandavid
2014/07/22 19:02:01
Done.
|
| } |
| std::string GetDefaultPrinterOnFileThread() { |
| @@ -1372,7 +1374,10 @@ void PrintPreviewHandler::PostPrintToPdfTask() { |
| metafile->InitFromData(static_cast<const void*>(data->front()), data->size()); |
| BrowserThread::PostTask( |
| BrowserThread::FILE, FROM_HERE, |
| - base::Bind(&PrintToPdfCallback, metafile.release(), print_to_pdf_path_)); |
| + base::Bind(&PrintToPdfCallback, |
| + metafile.release(), |
| + print_to_pdf_path_, |
| + pdf_file_saved_callback_)); |
| print_to_pdf_path_ = base::FilePath(); |
| ClosePreviewDialog(); |
| } |
| @@ -1631,3 +1636,8 @@ void PrintPreviewHandler::UnregisterForMergeSession() { |
| if (reconcilor_) |
| reconcilor_->RemoveMergeSessionObserver(this); |
| } |
| + |
| +void PrintPreviewHandler::SetPdfSavedCallbackForTesting( |
| + const base::Closure& callback) { |
| + pdf_file_saved_callback_ = callback; |
| +} |