Chromium Code Reviews| 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'); |