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

Unified Diff: chrome/browser/ui/webui/print_preview/print_preview_ui.cc

Issue 2974183002: Remove bad CallJavascriptFunctionUnsafe call from PrintPreviewUI (Closed)
Patch Set: Rebase Created 3 years, 5 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/ui/webui/print_preview/print_preview_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/print_preview/print_preview_ui.cc
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
index 8493e8cc7554c35ed196e4827c17d8c9588094b8..f07d5be1ba4edb44d6baacf67699856693ab55a5 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
@@ -533,13 +533,20 @@ void PrintPreviewUI::OnPrintPreviewDialogClosed() {
}
void PrintPreviewUI::OnInitiatorClosed() {
+ // Should only get here if the initiator was still tracked by the Print
+ // Preview Dialog Controller, so the print job has not yet been sent.
WebContents* preview_dialog = web_ui()->GetWebContents();
printing::BackgroundPrintingManager* background_printing_manager =
g_browser_process->background_printing_manager();
- if (background_printing_manager->HasPrintPreviewDialog(preview_dialog))
- web_ui()->CallJavascriptFunctionUnsafe("cancelPendingPrintRequest");
- else
+ if (background_printing_manager->HasPrintPreviewDialog(preview_dialog)) {
+ // Dialog is hidden but is still generating the preview. Cancel the print
+ // request as it can't be completed.
+ background_printing_manager->OnPrintRequestCancelled(preview_dialog);
+ handler_->OnPrintRequestCancelled();
+ } else {
+ // Initiator was closed while print preview dialog was still open.
OnClosePrintPreviewDialog();
+ }
}
void PrintPreviewUI::OnPrintPreviewCancelled() {
« no previous file with comments | « chrome/browser/ui/webui/print_preview/print_preview_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698