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

Unified Diff: chrome/browser/resources/print_preview.js

Issue 7003089: Print Preview: Changing displayed error message when PDF Viewer is missing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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/resources/print_preview.html ('k') | chrome/browser/ui/webui/print_preview_data_source.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/print_preview.js
diff --git a/chrome/browser/resources/print_preview.js b/chrome/browser/resources/print_preview.js
index 2b5d938fcebcdcfd4a25ca8097bb8e2281cf4e3a..8d41465f06ed4489ea751c944daa319d53ff20b1 100644
--- a/chrome/browser/resources/print_preview.js
+++ b/chrome/browser/resources/print_preview.js
@@ -42,7 +42,10 @@ function onLoad() {
$('cancel-button').addEventListener('click', handleCancelButtonClick);
if (!checkCompatiblePluginExists()) {
- displayErrorMessage(localStrings.getString('noPlugin'), false);
+ var errorButton = $('error-button');
+ errorButton.onclick = showSystemDialog;
+ errorButton.innerHTML = localStrings.getString('launchNativeDialog');
James Hawkins 2011/06/09 16:59:52 s/innerHTML/value/ It's just text.
dpapad 2011/06/09 17:21:25 I tried value, but strangely it does not set the t
+ displayErrorMessage(localStrings.getString('noPlugin'), true);
$('mainview').parentElement.removeChild($('dummy-viewer'));
return;
}
@@ -141,9 +144,9 @@ function showSystemDialog() {
* @param {string} initiatorTabURL The URL of the initiator tab.
*/
function onInitiatorTabClosed(initiatorTabURL) {
- $('reopen-page').addEventListener('click', function() {
- window.location = initiatorTabURL;
- });
+ var errorButton = $('error-button');
+ errorButton.innerHTML = localStrings.getString('reopenPage');
+ errorButton.onclick = function() { window.location = initiatorTabURL; };
displayErrorMessage(localStrings.getString('initiatorTabClosed'), true);
}
@@ -437,8 +440,10 @@ function setColor(color) {
/**
* Display an error message in the center of the preview area.
* @param {string} errorMessage The error message to be displayed.
- * @param {boolean} showButton Indivates whether the "Reopen the page" button
- * should be displayed.
+ * @param {boolean} showButton Indicates whether the error-button should be
James Hawkins 2011/06/09 16:59:52 This is fragile; just have the call site show the
dpapad 2011/06/09 17:21:25 Done. Made it a little more flexible.
+ * displayed. Callers of this function have the responsibility to attach a
+ * listener to the button and also set the displayed text before calling this
+ * function.
*/
function displayErrorMessage(errorMessage, showButton) {
$('overlay-layer').classList.remove('invisible');
@@ -446,9 +451,9 @@ function displayErrorMessage(errorMessage, showButton) {
$('error-text').innerHTML = errorMessage;
$('error-text').classList.remove('hidden');
if (showButton)
- $('reopen-page').classList.remove('hidden');
+ $('error-button').classList.remove('hidden');
else
- $('reopen-page').classList.add('hidden');
+ $('error-button').classList.add('hidden');
removeEventListeners();
var pdfViewer = $('pdf-viewer');
« no previous file with comments | « chrome/browser/resources/print_preview.html ('k') | chrome/browser/ui/webui/print_preview_data_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698