diff options
author | dpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-23 19:25:13 +0000 |
---|---|---|
committer | dpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-23 19:25:13 +0000 |
commit | ba693e5adbcd23d44c3e47a980e3093ab79432d3 (patch) | |
tree | 801a09b8c3ab9cb3eaf40a037dbb4d0d4c74152e | |
parent | 4cd82f72da57dac8a4b810d8a99fbe5b379cf593 (diff) | |
download | chromium_src-ba693e5adbcd23d44c3e47a980e3093ab79432d3.zip chromium_src-ba693e5adbcd23d44c3e47a980e3093ab79432d3.tar.gz chromium_src-ba693e5adbcd23d44c3e47a980e3093ab79432d3.tar.bz2 |
Print Preview: Changing error message when initiator tab closes.
Adding a button instead of a link to allow the user to reopen the initiator page.
BUG=83244
TEST=See bug description
Review URL: http://codereview.chromium.org/7051026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86321 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/generated_resources.grd | 7 | ||||
-rw-r--r-- | chrome/browser/resources/print_preview.css | 2 | ||||
-rw-r--r-- | chrome/browser/resources/print_preview.html | 13 | ||||
-rw-r--r-- | chrome/browser/resources/print_preview.js | 21 | ||||
-rw-r--r-- | chrome/browser/ui/webui/print_preview_ui_html_source.cc | 2 |
5 files changed, 32 insertions, 13 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index c2e57e1..ae3d2fb 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -5571,8 +5571,11 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_PRINT_PREVIEW_FAILED" desc="Message to display when print preview fails."> Print preview failed. </message> - <message name="IDS_PRINT_PREVIEW_INITIATOR_TAB_CLOSED" desc="Message to display when print preview fails, because the user closed the tab that initiated the print preview before the preview was generated."> - Print preview failed because the page you are trying to print has been closed. Please click <a href="<ph name="INITIATOR_TAB_URL">$1<ex>http://www.google.com</ex></ph>">here</a> to reopen the page and try printing again. + <message name="IDS_PRINT_PREVIEW_INITIATOR_TAB_CLOSED" desc="Error message displayed when print preview fails because the user closed the tab that initiated the print preview."> + Print preview failed because the page you were trying to print has been closed. + </message> + <message name="IDS_PRINT_PREVIEW_REOPEN_PAGE" desc="Text for button displayed when print preview fails because the user closed the tab that initiated the print preview. Clicking the button reopens the page that was closed."> + Reopen the page </message> <message name="IDS_PRINT_PREVIEW_PRINT_BUTTON" desc="Print button."> Print diff --git a/chrome/browser/resources/print_preview.css b/chrome/browser/resources/print_preview.css index f670b2b..89dd77f 100644 --- a/chrome/browser/resources/print_preview.css +++ b/chrome/browser/resources/print_preview.css @@ -671,7 +671,7 @@ select { pointer-events: none; } -.messages { +#messages { color: #404040; font-size: 15px; left: 25%; diff --git a/chrome/browser/resources/print_preview.html b/chrome/browser/resources/print_preview.html index 33c6039..ec4c292 100644 --- a/chrome/browser/resources/print_preview.html +++ b/chrome/browser/resources/print_preview.html @@ -115,11 +115,16 @@ </div> <div id="mainview"> <div id="dancing-dots" class="invisible"> - <div id="dancing-dots-text" class="messages"> - <span id="loading" i18n-content="loading"></span> - <span><span>.</span><span>.</span><span>.</span></span> + <div id="messages"> + <div id="dancing-dots-text"> + <span id="loading" i18n-content="loading"></span> + <span><span>.</span><span>.</span><span>.</span></span> + </div> + <div id="error-text" class="hidden"></div> + <br> + <button id="reopen-page" class="hidden" + i18n-content="reopenPage"></button> </div> - <div id="error-text" class="messages hidden"></div> </div> </div> <object id="dummy-viewer" type="application/pdf" diff --git a/chrome/browser/resources/print_preview.js b/chrome/browser/resources/print_preview.js index b9b935f..9bc3731 100644 --- a/chrome/browser/resources/print_preview.js +++ b/chrome/browser/resources/print_preview.js @@ -47,7 +47,7 @@ function onLoad() { $('cancel-button').addEventListener('click', handleCancelButtonClick); if (!checkCompatiblePluginExists()) { - displayErrorMessage(localStrings.getString('noPlugin')); + displayErrorMessage(localStrings.getString('noPlugin'), false); $('mainview').parentElement.removeChild($('dummy-viewer')); return; } @@ -101,8 +101,10 @@ function showSystemDialog() { * @param {string} initiatorTabURL The URL of the initiator tab. */ function onInitiatorTabClosed(initiatorTabURL) { - displayErrorMessage(localStrings.getStringF('initiatorTabClosed', - initiatorTabURL)); + $('reopen-page').addEventListener('click', function() { + window.location = initiatorTabURL; + }); + displayErrorMessage(localStrings.getString('initiatorTabClosed'), true); } /** @@ -383,14 +385,21 @@ function setColor(color) { /** * Display an error message in the center of the preview area. - * @param (string) errorMessage The error message to be displayed. + * @param {string} errorMessage The error message to be displayed. + * @param {boolean} showButton Indivates whether the "Reopen the page" button + * should be displayed. */ -function displayErrorMessage(errorMessage) { +function displayErrorMessage(errorMessage, showButton) { isPreviewStillLoading = false; $('dancing-dots').classList.remove('invisible'); $('dancing-dots-text').classList.add('hidden'); $('error-text').innerHTML = errorMessage; $('error-text').classList.remove('hidden'); + if (showButton) + $('reopen-page').classList.remove('hidden'); + else + $('reopen-page').classList.add('hidden'); + setControlsDisabled(true); var pdfViewer = $('pdf-viewer'); @@ -403,7 +412,7 @@ function displayErrorMessage(errorMessage) { * Called from PrintPreviewMessageHandler::OnPrintPreviewFailed(). */ function printPreviewFailed() { - displayErrorMessage(localStrings.getString('previewFailed')); + displayErrorMessage(localStrings.getString('previewFailed'), false); } /** diff --git a/chrome/browser/ui/webui/print_preview_ui_html_source.cc b/chrome/browser/ui/webui/print_preview_ui_html_source.cc index be4b583..024da8c 100644 --- a/chrome/browser/ui/webui/print_preview_ui_html_source.cc +++ b/chrome/browser/ui/webui/print_preview_ui_html_source.cc @@ -40,6 +40,8 @@ void SetLocalizedStrings(DictionaryValue* localized_strings) { l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_FAILED)); localized_strings->SetString(std::string("initiatorTabClosed"), l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_INITIATOR_TAB_CLOSED)); + localized_strings->SetString(std::string("reopenPage"), + l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_REOPEN_PAGE)); localized_strings->SetString(std::string("printButton"), l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_PRINT_BUTTON)); |