| Index: chrome/browser/resources/print_preview/common/overlay.js
|
| diff --git a/chrome/browser/resources/print_preview/common/overlay.js b/chrome/browser/resources/print_preview/common/overlay.js
|
| index cb24bcc6f3c1f198a112c20ae7f869baf0502048..4585dd64ae13a19e50a4addfae28fbac4cc04a78 100644
|
| --- a/chrome/browser/resources/print_preview/common/overlay.js
|
| +++ b/chrome/browser/resources/print_preview/common/overlay.js
|
| @@ -40,11 +40,21 @@ cr.define('print_preview', function() {
|
|
|
| this.getElement().addEventListener('keydown', function f(e) {
|
| // Escape pressed -> cancel the dialog.
|
| - if (e.keyCode == 27 && !e.shiftKey && !e.ctrlKey && !e.altKey &&
|
| - !e.metaKey) {
|
| - e.stopPropagation();
|
| - e.preventDefault();
|
| - this.cancel();
|
| + if (!e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey) {
|
| + if (e.keyCode == 27) {
|
| + e.stopPropagation();
|
| + e.preventDefault();
|
| + this.cancel();
|
| + } else if (e.keyCode == 13) {
|
| + var activeElementTag = document.activeElement ?
|
| + document.activeElement.tagName.toUpperCase() : '';
|
| + if (activeElementTag != 'BUTTON' && activeElementTag != 'SELECT') {
|
| + if (this.onEnterPressedInternal()) {
|
| + e.stopPropagation();
|
| + e.preventDefault();
|
| + }
|
| + }
|
| + }
|
| }
|
| }.bind(this));
|
|
|
| @@ -97,6 +107,14 @@ cr.define('print_preview', function() {
|
| onCancelInternal: function() {},
|
|
|
| /**
|
| + * @return {boolean} Whether the event was handled.
|
| + * @protected
|
| + */
|
| + onEnterPressedInternal: function() {
|
| + return false;
|
| + },
|
| +
|
| + /**
|
| * Called when the overlay is clicked. Pulses the page.
|
| * @param {Event} e Contains the element that was clicked.
|
| * @private
|
|
|