From 5bb3482de944f37ef43d2c9c391869f3b26b7480 Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Fri, 10 Feb 2012 03:16:02 +0000 Subject: Print Preview: Do not change the print preview state when print preview is not possible. Do reset the print preview state when the renderer goes away. BUG=none TEST=In a debug build, (1) open a tab, print preview, kill the tab from the task manager, and try to print preview again. (2) Trigger a bug that kills the initiator renderer right after it starts the print preview, and try to print preview again. Both of these cases should not crash. Review URL: http://codereview.chromium.org/9371030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121395 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/printing/print_view_manager.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'chrome/browser/printing/print_view_manager.cc') diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc index c9c4f25..3a5bdd6 100644 --- a/chrome/browser/printing/print_view_manager.cc +++ b/chrome/browser/printing/print_view_manager.cc @@ -118,8 +118,11 @@ bool PrintViewManager::PrintPreviewNow() { NOTREACHED(); return false; } + if (!PrintNowInternal(new PrintMsg_InitiatePrintPreview(routing_id()))) + return false; + print_preview_state_ = USER_INITIATED_PREVIEW; - return PrintNowInternal(new PrintMsg_InitiatePrintPreview(routing_id())); + return true; } void PrintViewManager::PrintPreviewForWebNode() { @@ -162,6 +165,8 @@ void PrintViewManager::StopNavigation() { } void PrintViewManager::RenderViewGone(base::TerminationStatus status) { + print_preview_state_ = NOT_PREVIEWING; + if (!print_job_.get()) return; -- cgit v1.1