Chromium Code Reviews| Index: chrome/browser/resources/chromeos/quick_unlock/pin.js |
| diff --git a/chrome/browser/resources/chromeos/quick_unlock/pin.js b/chrome/browser/resources/chromeos/quick_unlock/pin.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..49f3728095767de2ef465e711221e60430d5a5db |
| --- /dev/null |
| +++ b/chrome/browser/resources/chromeos/quick_unlock/pin.js |
| @@ -0,0 +1,36 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +Polymer({ |
| + is: 'pin-keyboard', |
| + |
| + // Called when a keypad number has been tapped. |
| + onNumberTap_: function(event, detail) { |
| + var target = event.target; |
| + var value = target.getAttribute('value'); |
| + |
| + var input = this.$$('#pin-input'); |
| + input.value += value; |
| + }, |
| + |
| + // Called when the user wants to submit the PIN. |
| + onPinSubmit_: function() { |
| + var pin = this.$$('#pin-input').value; |
| + this.fire('submit', { pin: pin }); |
| + }, |
| + |
| + // Called when a key event is pressed while the input element has focus. |
| + onInputKeyDown_: function(event) { |
| + // Up/down pressed, swallow the event to prevent the input value from |
| + // being incremented or decremented. |
| + if (event.keyCode == 38 || event.keyCode == 40) |
| + event.preventDefault(); |
| + |
| + // enter pressed |
|
tommycli
2016/05/04 19:29:03
Enter pressed.
jdufault
2016/05/06 00:05:46
Done.
|
| + if (event.keyCode == 13) { |
| + this.onPinSubmit_(); |
| + event.preventDefault(); |
| + } |
| + } |
| +}); |