| Index: chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js
|
| diff --git a/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js b/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a5cbe3b7c5c1c5616a7a1ababb4cc36f279640c4
|
| --- /dev/null
|
| +++ b/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.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.
|
| + if (event.keyCode == 13) {
|
| + this.onPinSubmit_();
|
| + event.preventDefault();
|
| + }
|
| + }
|
| +});
|
|
|