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

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

Issue 7056070: PrintPreview: Preview generation should not block print button. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments. Created 9 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
Index: chrome/browser/printing/print_preview_message_handler.cc
diff --git a/chrome/browser/printing/print_preview_message_handler.cc b/chrome/browser/printing/print_preview_message_handler.cc
index d293d6f1d6e2829f2f43e1e7e3964fb66a627179..f56bb62475d7267a37d573ed5699977f5d0611ef 100644
--- a/chrome/browser/printing/print_preview_message_handler.cc
+++ b/chrome/browser/printing/print_preview_message_handler.cc
@@ -6,6 +6,7 @@
#include "base/memory/ref_counted.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/printing/background_printing_manager.h"
#include "chrome/browser/printing/print_job_manager.h"
#include "chrome/browser/printing/print_preview_tab_controller.h"
#include "chrome/browser/printing/print_view_manager.h"
@@ -114,7 +115,22 @@ void PrintPreviewMessageHandler::OnPrintPreviewFailed(int document_cookie) {
// User might have closed it already.
if (!print_preview_tab)
return;
- print_preview_tab->web_ui()->CallJavascriptFunction("printPreviewFailed");
+
+ TabContentsWrapper* wrapper =
+ TabContentsWrapper::GetCurrentWrapperForContents(print_preview_tab);
+
+ if (g_browser_process->background_printing_manager()->
+ HasTabContents(wrapper)) {
+ // Preview tab was hidden to serve the print request.
+ RenderViewHost* rvh = tab_contents()->render_view_host();
+ rvh->Send(new PrintMsg_PrintingDone(rvh->routing_id(), false));
Lei Zhang 2011/06/09 22:39:07 So you said this is to tell PWVH to cleanup after
kmadhusu 2011/06/09 23:55:48 Removed the msg. I will handle the error case in m
+ delete print_preview_tab;
Lei Zhang 2011/06/09 22:39:07 Can you delete |wrapper| instead? In a separate CL
kmadhusu 2011/06/09 23:55:48 Done
+ return;
+ } else {
+ PrintPreviewUI* print_preview_ui =
+ static_cast<PrintPreviewUI*>(print_preview_tab->web_ui());
+ print_preview_ui->CallJavascriptFunction("printPreviewFailed");
+ }
}
bool PrintPreviewMessageHandler::OnMessageReceived(
« no previous file with comments | « chrome/browser/printing/background_printing_manager.cc ('k') | chrome/browser/printing/print_preview_tab_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698