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

Unified Diff: chrome/browser/resources/print_preview/common/overlay.js

Issue 540563002: Export vendor capabilities to the CJT ticket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/data/app_state.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/data/app_state.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698