diff options
author | sverrir@google.com <sverrir@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-23 17:54:36 +0000 |
---|---|---|
committer | sverrir@google.com <sverrir@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-23 17:54:36 +0000 |
commit | 11e0abbd3303439cd8c4c90d545de449edab8931 (patch) | |
tree | b771db21e7f87561701dafe74f6287d24ef13cae /chrome/renderer/print_web_view_helper.cc | |
parent | 94604143604d2ec132f6722a80399d21d491fbb4 (diff) | |
download | chromium_src-11e0abbd3303439cd8c4c90d545de449edab8931.zip chromium_src-11e0abbd3303439cd8c4c90d545de449edab8931.tar.gz chromium_src-11e0abbd3303439cd8c4c90d545de449edab8931.tar.bz2 |
Alert the user when something fails when printing.
Also fix the alert when no printer is installed.
BUG=http://crbug.com/6833
TEST=Print to a printer that fails to print (e.g. MS XPS printer and cancel save). Try to print when no printer is installed.
Review URL: http://codereview.chromium.org/141060
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19030 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/print_web_view_helper.cc')
-rw-r--r-- | chrome/renderer/print_web_view_helper.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/chrome/renderer/print_web_view_helper.cc b/chrome/renderer/print_web_view_helper.cc index ab61664..781c059 100644 --- a/chrome/renderer/print_web_view_helper.cc +++ b/chrome/renderer/print_web_view_helper.cc @@ -105,7 +105,8 @@ void PrintWebViewHelper::SyncPrint(WebFrame* frame) { // can safely assume there are no printer drivers configured. So we safely // terminate. if (default_settings.IsEmpty()) { - RunJavaScriptAlert(frame, + // TODO: Create an async alert (http://crbug.com/14918). + render_view_->RunJavaScriptAlert(frame, l10n_util::GetString(IDS_DEFAULT_PRINTER_NOT_FOUND_WARNING_TITLE)); return; } @@ -170,15 +171,22 @@ void PrintWebViewHelper::SyncPrint(WebFrame* frame) { } void PrintWebViewHelper::DidFinishPrinting(bool success) { + if (!success) { + WebView* web_view = print_web_view_.get(); + if (!web_view) + web_view = render_view_->webview(); + + // TODO: Create an async alert (http://crbug.com/14918). + render_view_->RunJavaScriptAlert(web_view->GetMainFrame(), + l10n_util::GetString(IDS_PRINT_SPOOL_FAILED_ERROR_TEXT)); + } + if (print_web_view_.get()) { print_web_view_->Close(); print_web_view_.release(); // Close deletes object. print_pages_params_.reset(); } - if (!success) { - // TODO(sverrir): http://crbug.com/6833 Show some kind of notification. - } } bool PrintWebViewHelper::CopyAndPrint(const ViewMsg_PrintPages_Params& params, |