Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6141)

Unified Diff: chrome/browser/printing/print_view_manager.cc

Issue 125082: Add Print Selection support to Chrome. This change is fairly involved since ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/printing/print_view_manager.h ('k') | chrome/browser/printing/printed_document.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « chrome/browser/printing/print_view_manager.h ('k') | chrome/browser/printing/printed_document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698