| OLD | NEW |
| 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * 'pin-keyboard' is a keyboard that can be used to enter PINs or more generally | 7 * 'pin-keyboard' is a keyboard that can be used to enter PINs or more generally |
| 8 * numeric values. | 8 * numeric values. |
| 9 * | 9 * |
| 10 * Properties: | 10 * Properties: |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 * Fires an update event with the current PIN value. The event will only be | 55 * Fires an update event with the current PIN value. The event will only be |
| 56 * fired if the PIN value has actually changed. | 56 * fired if the PIN value has actually changed. |
| 57 * @param {string} value | 57 * @param {string} value |
| 58 * @param {string} previous | 58 * @param {string} previous |
| 59 */ | 59 */ |
| 60 onPinValueChange_: function(value, previous) { | 60 onPinValueChange_: function(value, previous) { |
| 61 if (value != previous) | 61 if (value != previous) |
| 62 this.fire('pin-change', { pin: value }); | 62 this.fire('pin-change', { pin: value }); |
| 63 }, | 63 }, |
| 64 | 64 |
| 65 /** Called when the user wants to erase the last character of the entered |
| 66 * PIN value. |
| 67 */ |
| 68 onPinClear_: function() { |
| 69 this.value = this.value.substring(0, this.value.length - 1); |
| 70 }, |
| 71 |
| 65 /** Called when a key event is pressed while the input element has focus. */ | 72 /** Called when a key event is pressed while the input element has focus. */ |
| 66 onInputKeyDown_: function(event) { | 73 onInputKeyDown_: function(event) { |
| 67 // Up/down pressed, swallow the event to prevent the input value from | 74 // Up/down pressed, swallow the event to prevent the input value from |
| 68 // being incremented or decremented. | 75 // being incremented or decremented. |
| 69 if (event.keyCode == 38 || event.keyCode == 40) { | 76 if (event.keyCode == 38 || event.keyCode == 40) { |
| 70 event.preventDefault(); | 77 event.preventDefault(); |
| 71 return; | 78 return; |
| 72 } | 79 } |
| 73 | 80 |
| 74 // Enter pressed. | 81 // Enter pressed. |
| 75 if (event.keyCode == 13) { | 82 if (event.keyCode == 13) { |
| 76 this.firePinSubmitEvent_(); | 83 this.firePinSubmitEvent_(); |
| 77 event.preventDefault(); | 84 event.preventDefault(); |
| 78 return; | 85 return; |
| 79 } | 86 } |
| 80 } | 87 } |
| 81 }); | 88 }); |
| OLD | NEW |