| 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 ca343b2e90386434eff0b825f3037bc075960652..de93c08df1b17741ac5612be76bb7a37cf141619 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,
|
| @@ -92,5 +105,40 @@ Polymer({
|
| */
|
| computeSubmitClass_: function(value) {
|
| return value.length > 0 ? 'ready-background' : '';
|
| + },
|
| +
|
| + /**
|
| + * Computes whether the input type for the pin input should be password or
|
| + * numerical.
|
| + * @private
|
| + */
|
| + computeInputType_: function(enablePassword) {
|
| + return enablePassword ? 'password' : 'number';
|
| + },
|
| +
|
| + /**
|
| + * Computes the value of the pin input placeholder.
|
| + * @private
|
| + */
|
| + computeInputPlaceholder_: function(enablePassword) {
|
| + return enablePassword ? this.i18n('pinKeyboardPlaceholderPinPassword') :
|
| + this.i18n('pinKeyboardPlaceholderPin');
|
| + },
|
| +
|
| + /**
|
| + * Computes the direction of the pin input.
|
| + * @private
|
| + */
|
| + 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'.
|
| + //
|
| + // Since we still support users entering their passwords through the PIN
|
| + // keyboard, we swap the input box to rtl when we think it is a password
|
| + // (just numbers), if the document direction is rtl.
|
| + var enableRtl = (document.dir == 'rtl') && !Number.isInteger(+password);
|
| + return enableRtl ? 'input-non-pin' : '';
|
| }
|
| });
|
|
|