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

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

Issue 7740005: Print preview not showing if default print is invalid. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Update per code review Created 9 years, 4 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 a9462e9afc2aad8b90be41785540844cd2870ca5..c2c39d35e64688e396da1868e3aa902e7bf7706e 100644
--- a/chrome/browser/printing/print_preview_message_handler.cc
+++ b/chrome/browser/printing/print_preview_message_handler.cc
@@ -211,6 +211,28 @@ void PrintPreviewMessageHandler::OnPrintPreviewCancelled(int document_cookie) {
StopWorker(document_cookie);
}
+void PrintPreviewMessageHandler::OnInvalidPrinterSettings(int document_cookie) {
+ // Always need to stop the worker.
+ StopWorker(document_cookie);
kmadhusu 2011/08/30 02:11:27 You need to stop the worker only if the document_c
arthurhsu 2011/08/30 20:43:03 Done.
+
+ TabContents* print_preview_tab = GetPrintPreviewTab();
+ if (!print_preview_tab)
+ return;
+
+ bool show_as_alert = false;
+ 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.
+ show_as_alert = true;
+ }
+
+ PrintPreviewUI* print_preview_ui =
+ static_cast<PrintPreviewUI*>(print_preview_tab->web_ui());
+ print_preview_ui->OnInvalidPrinterSettings(show_as_alert);
kmadhusu 2011/08/30 02:11:27 If you are going to display the alert from javascr
arthurhsu 2011/08/30 20:43:03 Per discussion, changed to follow the OnPrintPrevi
+}
+
bool PrintPreviewMessageHandler::OnMessageReceived(
const IPC::Message& message) {
bool handled = true;
@@ -229,6 +251,8 @@ bool PrintPreviewMessageHandler::OnMessageReceived(
OnDidGetDefaultPageLayout)
IPC_MESSAGE_HANDLER(PrintHostMsg_PrintPreviewCancelled,
OnPrintPreviewCancelled)
+ IPC_MESSAGE_HANDLER(PrintHostMsg_PrintPreviewInvalidPrinterSettings,
+ OnInvalidPrinterSettings)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;

Powered by Google App Engine
This is Rietveld 408576698