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

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: '' 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..551d67a02d1201e7d9d7f72da658fd07a1e30d56 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,19 @@ 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.
+ delete wrapper;
+ } 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