Chromium Code Reviews| Index: chrome/browser/resources/print_preview/print_header.js |
| =================================================================== |
| --- chrome/browser/resources/print_preview/print_header.js (revision 104750) |
| +++ chrome/browser/resources/print_preview/print_header.js (working copy) |
| @@ -38,13 +38,16 @@ |
| */ |
| addEventListeners: function() { |
| this.cancelButton_.onclick = function() { |
| - chrome.send('closePrintPreviewTab'); |
| + printHeader.disableCancelButton_(); |
| + closePrintPreviewTab(); |
|
dpapad
2011/10/10 20:10:49
From within PrintHeader "this" should be used and
Lei Zhang
2011/10/10 20:53:13
Done.
|
| }; |
| this.printButton_.onclick = this.onPrintButtonClicked_.bind(this); |
| document.addEventListener('updateSummary', |
| this.updateSummary_.bind(this)); |
| document.addEventListener('updatePrintButton', |
| this.updatePrintButton_.bind(this)); |
| + document.addEventListener('disableCancelButton', |
| + this.disableCancelButton_.bind(this)); |
| }, |
| /** |
| @@ -58,10 +61,20 @@ |
| this.cancelButton_.classList.add('loading'); |
| this.summary_.innerHTML = localStrings.getString('printing'); |
| } |
| + cr.dispatchSimpleEvent(document, 'disableCancelButton'); |
| requestToPrintDocument(); |
| }, |
| /** |
| + * Disables the cancel button and removes its keydown event listener. |
| + * @private |
| + */ |
| + disableCancelButton_: function() { |
| + window.onkeydown = null; |
| + this.cancelButton_.disabled = true; |
| + }, |
| + |
| + /** |
| * Updates the state of |this.printButton_| depending on the user selection. |
| * The button is enabled only when the following conditions are true. |
| * 1) The selected page ranges are valid. |