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

Side by Side Diff: chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js

Issue 2027683003: Pin keyboard moved to under the user profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 4 years, 6 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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: 'pin-keyboard', 6 is: 'pin-keyboard',
7 7
8 // Called when a keypad number has been tapped. 8 // Called when a keypad number has been tapped.
9 onNumberTap_: function(event, detail) { 9 onNumberTap_: function(event, detail) {
10 var target = event.target; 10 var target = event.target;
11 var value = target.getAttribute('value'); 11 var value = target.getAttribute('value');
12 12
13 var input = this.$$('#pin-input'); 13 var input = this.$$('#pin-input');
14 input.value += value; 14 input.value += value;
15 }, 15 },
16 16
17 // Called when the user wants to clear the PIN.
18 onPinClear_: function() {
19 var pin = this.$$('#pin-input');
20 switch (pin.value.length) {
21 case 0:
22 case 1:
23 pin.value = '';
24 break;
25 default:
26 pin.value = pin.value.substring(0, pin.value.length - 1);
27 break;
28 }
29 },
30
17 // Called when the user wants to submit the PIN. 31 // Called when the user wants to submit the PIN.
18 onPinSubmit_: function() { 32 onPinSubmit_: function() {
19 var pin = this.$$('#pin-input').value; 33 var pin = this.$$('#pin-input').value;
20 this.fire('submit', { pin: pin }); 34 this.fire('submit', { pin: pin });
21 }, 35 },
22 36
23 // Called when a key event is pressed while the input element has focus. 37 // Called when a key event is pressed while the input element has focus.
24 onInputKeyDown_: function(event) { 38 onInputKeyDown_: function(event) {
25 // Up/down pressed, swallow the event to prevent the input value from 39 // Up/down pressed, swallow the event to prevent the input value from
26 // being incremented or decremented. 40 // being incremented or decremented.
27 if (event.keyCode == 38 || event.keyCode == 40) 41 if (event.keyCode == 38 || event.keyCode == 40)
28 event.preventDefault(); 42 event.preventDefault();
29 43
30 // Enter pressed. 44 // Enter pressed.
31 if (event.keyCode == 13) { 45 if (event.keyCode == 13) {
32 this.onPinSubmit_(); 46 this.onPinSubmit_();
33 event.preventDefault(); 47 event.preventDefault();
34 } 48 }
35 } 49 }
36 }); 50 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698