Commit 5fd82d91 authored by thestig@chromium.org's avatar thestig@chromium.org

Print Preview: Provide a link to try printing with the system dialog when...

Print Preview: Provide a link to try printing with the system dialog when print preview fails. Also fix an initiator tab closed case that is being misreported as a failure.

BUG=92599
TEST=none

Review URL: http://codereview.chromium.org/7715022

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98400 0039d316-1c4b-4281-b951-d872f2087c98
parent aafc3e9c
......@@ -566,8 +566,8 @@ be available for now. -->
<message name="IDS_PRINT_PREVIEW_NO_PLUGIN" desc="Message to display when the PDF viewer is missing.">
Chromium does not include the PDF viewer which is required for Print Preview to function.
</message>
<message name="IDS_PRINT_PREVIEW_NATIVE_DIALOG" desc="Option offering the user to open the native print dialog, displayed when the PDF viewer is missing.">
Launch native print dialog
<message name="IDS_PRINT_PREVIEW_NATIVE_DIALOG" desc="Option offering the user to open the native print dialog, displayed when the PDF viewer is missing or when print preview fails.">
Print using system dialog…
</message>
<if expr="is_macosx">
......
......@@ -541,8 +541,8 @@ Chrome supports. -->
<message name="IDS_PRINT_PREVIEW_NO_PLUGIN" desc="Message to display when the PDF viewer is missing.">
Google Chrome cannot show the print preview when the built-in PDF viewer is disabled. In order to see the preview, please visit <ph name="BEGIN_LINK">&lt;a target="_blank" rel="noreferrer" href="$1"&gt;</ph>$1<ph name="END_LINK">&lt;/a&gt;</ph>, enable the "Chrome PDF Viewer", and try again.
</message>
<message name="IDS_PRINT_PREVIEW_NATIVE_DIALOG" desc="Option offering the user to open the native print dialog, displayed when the PDF viewer is missing.">
Launch native print dialog
<message name="IDS_PRINT_PREVIEW_NATIVE_DIALOG" desc="Option offering the user to open the native print dialog, displayed when the PDF viewer is missing or when print preview fails.">
Print using system dialog…
</message>
<if expr="is_macosx">
......
......@@ -808,7 +808,9 @@ function displayErrorMessageWithButton(
* Called from PrintPreviewMessageHandler::OnPrintPreviewFailed().
*/
function printPreviewFailed() {
displayErrorMessage(localStrings.getString('previewFailed'));
displayErrorMessageWithButton(localStrings.getString('previewFailed'),
localStrings.getString('launchNativeDialog'),
launchNativePrintDialog);
}
/**
......
......@@ -76,6 +76,7 @@ enum UserActionBuckets {
PREVIEW_FAILED,
PREVIEW_STARTED,
INITIATOR_TAB_CRASHED,
INITIATOR_TAB_CLOSED,
USERACTION_BUCKET_BOUNDARY
};
......@@ -495,11 +496,8 @@ void PrintPreviewHandler::HandleGetPreview(const ListValue* args) {
TabContents* initiator_tab = GetInitiatorTab();
if (!initiator_tab) {
if (!reported_failed_preview_) {
ReportUserActionHistogram(PREVIEW_FAILED);
reported_failed_preview_ = true;
}
print_preview_ui->OnPrintPreviewFailed();
ReportUserActionHistogram(INITIATOR_TAB_CLOSED);
print_preview_ui->OnInitiatorTabClosed();
return;
}
......@@ -890,6 +888,13 @@ void PrintPreviewHandler::OnTabDestroyed() {
wrapper->print_view_manager()->set_observer(NULL);
}
void PrintPreviewHandler::OnPrintPreviewFailed() {
if (reported_failed_preview_)
return;
reported_failed_preview_ = true;
ReportUserActionHistogram(PREVIEW_FAILED);
}
void PrintPreviewHandler::FileSelected(const FilePath& path,
int index, void* params) {
PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_);
......
......@@ -55,6 +55,9 @@ class PrintPreviewHandler : public WebUIMessageHandler,
// observer.
void OnTabDestroyed();
// Called when print preview failed.
void OnPrintPreviewFailed();
private:
friend class PrintSystemTaskProxy;
......
......@@ -224,6 +224,7 @@ void PrintPreviewUI::OnCancelPendingPreviewRequest() {
}
void PrintPreviewUI::OnPrintPreviewFailed() {
handler_->OnPrintPreviewFailed();
CallJavascriptFunction("printPreviewFailed");
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment