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( |