Index: chrome/browser/resources/print_preview/settings/copies_settings.js |
diff --git a/chrome/browser/resources/print_preview/settings/copies_settings.js b/chrome/browser/resources/print_preview/settings/copies_settings.js |
index 189ada79c46ae29f58e0a0a15351458d3f1c6ccc..0c6e783c880a78c317b094cea6bc92fbaab8e59d 100644 |
--- a/chrome/browser/resources/print_preview/settings/copies_settings.js |
+++ b/chrome/browser/resources/print_preview/settings/copies_settings.js |
@@ -75,6 +75,10 @@ cr.define('print_preview', function() { |
fadeOutOption(this.getElement(), true); |
this.tracker.add( |
this.getChildElement('input.copies'), |
+ 'keydown', |
+ this.onTextfieldKeyDown_.bind(this)); |
+ this.tracker.add( |
+ this.getChildElement('input.copies'), |
'input', |
this.onTextfieldInput_.bind(this)); |
this.tracker.add( |
@@ -168,6 +172,7 @@ cr.define('print_preview', function() { |
* @private |
*/ |
onTextfieldTimeout_: function() { |
+ this.textfieldTimeout_ = null; |
var copiesVal = this.getChildElement('input.copies').value; |
if (copiesVal != '') { |
this.copiesTicketItem_.updateValue(copiesVal); |
@@ -175,6 +180,20 @@ cr.define('print_preview', function() { |
}, |
/** |
+ * Called when a key is pressed on the custom input. |
+ * @param {Event} event Contains the key that was pressed. |
+ * @private |
+ */ |
+ onTextfieldKeyDown_: function(event) { |
+ if (event.keyCode == 13 /*enter*/) { |
+ if (this.textfieldTimeout_) { |
+ clearTimeout(this.textfieldTimeout_); |
+ } |
+ this.onTextfieldTimeout_(); |
+ } |
+ }, |
+ |
+ /** |
* Called when a input event occurs on the textfield. Starts an input |
* timeout. |
* @private |