| Index: chrome/browser/printing/print_view_manager.cc
|
| ===================================================================
|
| --- chrome/browser/printing/print_view_manager.cc (revision 18804)
|
| +++ chrome/browser/printing/print_view_manager.cc (working copy)
|
| @@ -25,6 +25,7 @@
|
| PrintViewManager::PrintViewManager(TabContents& owner)
|
| : owner_(owner),
|
| waiting_to_print_(false),
|
| + printing_succeeded_(false),
|
| inside_inner_message_loop_(false) {
|
| }
|
|
|
| @@ -46,7 +47,7 @@
|
|
|
| scoped_refptr<PrintedDocument> document(print_job_->document());
|
| if (document) {
|
| - // If IsComplete() returns false, the document isn't completely renderered.
|
| + // If IsComplete() returns false, the document isn't completely rendered.
|
| // Since our renderer is gone, there's nothing to do, cancel it. Otherwise,
|
| // the print job may finish without problem.
|
| TerminatePrintJob(!document->IsComplete());
|
| @@ -148,7 +149,6 @@
|
| const JobEventDetails& event_details) {
|
| switch (event_details.type()) {
|
| case JobEventDetails::FAILED: {
|
| - // TODO(maruel): bug 1123882 Show some kind of notification.
|
| TerminatePrintJob(true);
|
| break;
|
| }
|
| @@ -176,6 +176,7 @@
|
| // Printing is done, we don't need it anymore.
|
| // print_job_->is_job_pending() may still be true, depending on the order
|
| // of object registration.
|
| + printing_succeeded_ = true;
|
| ReleasePrintJob();
|
| break;
|
| }
|
| @@ -202,6 +203,7 @@
|
| // Is the document already complete?
|
| if (print_job_->document() && print_job_->document()->IsComplete()) {
|
| waiting_to_print_ = false;
|
| + printing_succeeded_ = true;
|
| return true;
|
| }
|
|
|
| @@ -266,6 +268,7 @@
|
| print_job_->Initialize(job, this);
|
| registrar_.Add(this, NotificationType::PRINT_JOB_EVENT,
|
| Source<PrintJob>(print_job_.get()));
|
| + printing_succeeded_ = false;
|
| return true;
|
| }
|
|
|
| @@ -287,6 +290,12 @@
|
| }
|
| }
|
|
|
| +void PrintViewManager::PrintingDone(bool success) {
|
| + if (print_job_.get()) {
|
| + owner_.PrintingDone(print_job_->cookie(), success);
|
| + }
|
| +}
|
| +
|
| void PrintViewManager::TerminatePrintJob(bool cancel) {
|
| if (!print_job_.get())
|
| return;
|
| @@ -314,6 +323,8 @@
|
| if (!print_job_.get())
|
| return;
|
|
|
| + PrintingDone(printing_succeeded_);
|
| +
|
| registrar_.Remove(this, NotificationType::PRINT_JOB_EVENT,
|
| Source<PrintJob>(print_job_.get()));
|
| print_job_->DisconnectSource();
|
|
|