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

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

Issue 8223009: Print Preview: Keep the cancel button enabled whenever possible. Hook up the escape key to cancel. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | « no previous file | chrome/browser/resources/print_preview/print_preview.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,16 +38,27 @@
*/
addEventListeners: function() {
this.cancelButton_.onclick = function() {
- chrome.send('closePrintPreviewTab');
- };
+ this.disableCancelButton();
+ closePrintPreviewTab();
+ }.bind(this);
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));
},
/**
+ * Disables the cancel button and removes its keydown event listener.
+ */
+ disableCancelButton: function() {
+ window.onkeydown = null;
+ this.cancelButton_.disabled = true;
+ },
+
+ /**
* Listener executing whenever |this.printButton_| is clicked.
* @private
*/
@@ -58,6 +69,7 @@
this.cancelButton_.classList.add('loading');
this.summary_.innerHTML = localStrings.getString('printing');
}
+ this.disableCancelButton();
requestToPrintDocument();
},
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/print_preview.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698