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 9b9ba5dad8b5dc2ba8c528ddea38566061751d5e..56cf0947aa89bb11fa2b52b09f770e81f276fc84 100644 |
| --- a/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js |
| +++ b/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js |
| @@ -47,6 +47,14 @@ Polymer({ |
| value: false |
| }, |
| + /** |
| + * Whether or not to show an error. |
| + */ |
| + errorMessage: { |
| + type: String, |
| + value: '' |
| + }, |
| + |
| /** The value stored in the keyboard's input element. */ |
| value: { |
| type: String, |
| @@ -127,12 +135,21 @@ Polymer({ |
| }, |
| /** |
| - * Changes the color of the submit button if PIN is ready. |
| + * Changes the color of the input text if it is not empty. |
| * @param {string} value |
| * @private |
| */ |
| - getSubmitClass_: function(value) { |
| - return value.length > 0 ? 'ready-background' : ''; |
| + getContentClass_: function(value) { |
| + return value.length > 0 ? 'has-content' : ''; |
| + }, |
| + |
| + /** |
| + * Disables the submit and backspace button if nothing is entered. |
| + * @param {string} value |
| + * @private |
| + */ |
| + hasInput_: function(value) { |
| + return value.length > 0; |
| }, |
| /** |
| @@ -156,6 +173,32 @@ Polymer({ |
| }, |
| /** |
| + * Hides the error message div if no error is to be shown. |
| + * @param {string} errorMessage |
| + * @private |
| + */ |
| + hasErrorMessage_: function(errorMessage) { |
| + return errorMessage.length > 0; |
| + }, |
| + |
| + /** |
| + * Computes the whether the error message should be shown. |
| + * @param {boolean} errorMessage |
| + * @private |
| + */ |
| + getErrorClass_: function(errorMessage) { |
| + return errorMessage.length > 0 ? 'error-show' : ''; |
| + }, |
| + |
| + /** |
| + * Computes the direction of the errorMessage. |
|
jdufault
2016/08/22 20:56:40
nit: error message
sammiequon
2016/08/23 17:30:18
Done.
|
| + * @private |
| + */ |
| + getErrorDirection_: function() { |
| + return document.dir == 'rtl' ? 'error-rtl' : ''; |
| + }, |
| + |
| + /** |
| * Computes the direction of the pin input. |
| * @param {string} password |
| * @private |
| @@ -178,7 +221,7 @@ Polymer({ |
| * @param {boolean} submitEnabled |
| * @private |
| */ |
| - getSubmitHiddenClass_: function(submitEnabled) { |
| + getSubmitClass_: function(submitEnabled) { |
| return submitEnabled ? '' : 'submit-button-hidden'; |
| } |
| }); |