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

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

Issue 1933913002: Add a very basic PIN UI implementation that is shared between lock and settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Fix tests by removing a previously unused import that started getting used b/c of resource loader c… Created 4 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 Polymer({
6 is: 'pin-keyboard',
7
8 // Called when a keypad number has been tapped.
9 onNumberTap_: function(event, detail) {
10 var target = event.target;
11 var value = target.getAttribute('value');
12
13 var input = this.$$('#pin-input');
14 input.value += value;
15 },
16
17 // Called when the user wants to submit the PIN.
18 onPinSubmit_: function() {
19 var pin = this.$$('#pin-input').value;
20 this.fire('submit', { pin: pin });
21 },
22
23 // Called when a key event is pressed while the input element has focus.
24 onInputKeyDown_: function(event) {
25 // Up/down pressed, swallow the event to prevent the input value from
26 // being incremented or decremented.
27 if (event.keyCode == 38 || event.keyCode == 40)
28 event.preventDefault();
29
30 // Enter pressed.
31 if (event.keyCode == 13) {
32 this.onPinSubmit_();
33 event.preventDefault();
34 }
35 }
36 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698