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

Side by Side Diff: chrome/browser/resources/pdf/elements/viewer-password-screen/viewer-password-screen.js

Issue 2358553002: PDF: Use KeyboardEvent.code instead of keyCode.
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/pdf/pdf.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 Polymer({ 5 Polymer({
6 is: 'viewer-password-screen', 6 is: 'viewer-password-screen',
7 7
8 properties: { 8 properties: {
9 invalid: Boolean, 9 invalid: Boolean,
10 10
(...skipping 16 matching lines...) Expand all
27 27
28 deny: function() { 28 deny: function() {
29 this.$.password.disabled = false; 29 this.$.password.disabled = false;
30 this.$.submit.disabled = false; 30 this.$.submit.disabled = false;
31 this.invalid = true; 31 this.invalid = true;
32 this.$.password.focus(); 32 this.$.password.focus();
33 this.$.password.select(); 33 this.$.password.select();
34 }, 34 },
35 35
36 handleKey: function(e) { 36 handleKey: function(e) {
37 if (e.keyCode == 13) 37 if (e.code == 'Enter')
38 this.submit(); 38 this.submit();
39 }, 39 },
40 40
41 submit: function() { 41 submit: function() {
42 if (this.$.password.value.length == 0) 42 if (this.$.password.value.length == 0)
43 return; 43 return;
44 this.$.password.disabled = true; 44 this.$.password.disabled = true;
45 this.$.submit.disabled = true; 45 this.$.submit.disabled = true;
46 this.fire('password-submitted', {password: this.$.password.value}); 46 this.fire('password-submitted', {password: this.$.password.value});
47 }, 47 },
48 48
49 activeChanged: function() { 49 activeChanged: function() {
50 if (this.active) { 50 if (this.active) {
51 this.$.dialog.open(); 51 this.$.dialog.open();
52 this.$.password.focus(); 52 this.$.password.focus();
53 } else { 53 } else {
54 this.$.dialog.close(); 54 this.$.dialog.close();
55 } 55 }
56 } 56 }
57 }); 57 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/pdf/pdf.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698