Chromium Code Reviews| 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 |
| index dfc111d4c5fcd7c32df8aa1e7a95762d0894bfbb..e2fc832ac4568c5a7064ed84af6c02c4f3ab0682 100644 |
| --- a/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js |
| +++ b/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js |
| @@ -25,7 +25,20 @@ |
| Polymer({ |
| is: 'pin-keyboard', |
| + behaviors: [ |
| + I18nBehavior, |
| + ], |
| + |
| properties: { |
| + /** |
| + * Whether or not the keyboard's input element should be numerical |
| + * or password. |
| + */ |
| + enablePassword: { |
| + type: Boolean, |
| + value: false |
| + }, |
| + |
| /** The value stored in the keyboard's input element. */ |
| value: { |
| type: String, |
| @@ -84,5 +97,37 @@ Polymer({ |
| event.preventDefault(); |
| return; |
| } |
| + }, |
| + |
| + /** |
| + * @private |
|
xiyuan
2016/06/30 22:54:14
nit: move this to the end of jsdoc, here and other
|
| + * Computes whether the input type for the pin input should be password or |
| + * numerical. |
| + */ |
| + computeInputType_: function(enablePassword) { |
| + return enablePassword ? 'password' : 'number'; |
| + }, |
| + |
| + /** |
| + * @private |
| + * Computes the value of the pin input placeholder. |
| + */ |
| + computeInputPlaceholder_: function(enablePassword) { |
| + return enablePassword ? this.i18n('pinKeyboardPlaceholderPinPassword') : |
| + this.i18n('pinKeyboardPlaceholderPin'); |
| + }, |
| + |
| + /** |
| + * @private |
| + * Computes the direction of the pin input. |
| + */ |
| + computeInputClass_: function(password) { |
| + // +password will convert a string to a number or to NaN if that's not |
| + // possible. Number.isInteger will verify the value is not a NaN and that it |
| + // does not contain decimals. |
| + // |
| + // This heuristic will fail for inputs like '1.0'. |
| + var enableRtl = (document.dir == 'rtl') && !Number.isInteger(+password); |
| + return enableRtl ? 'input-non-pin' : ''; |
|
xiyuan
2016/06/30 22:54:14
I am not quite follow. What are we trying to do he
jdufault
2016/06/30 22:58:19
The complication here is that the PIN keyboard acc
xiyuan
2016/06/30 23:09:34
emm, would the default behavior of number input wo
|
| } |
| }); |