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..a17cb7b69857954271748e55f87ff781c810ed79 100644 |
| --- a/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js |
| +++ b/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js |
| @@ -47,6 +47,22 @@ Polymer({ |
| value: false |
| }, |
| + /** |
| + * The problem to display on the pin keyboard. |
| + */ |
| + problemMessage: { |
|
jdufault
2016/08/24 01:20:18
This should be private (problemMessage_)
sammiequon
2016/08/25 23:50:02
No more problem message.
|
| + type: String, |
| + value: '' |
| + }, |
| + |
| + /** |
| + * Whether the problem is an error or a warning. |
| + */ |
| + problemClass: { |
|
jdufault
2016/08/24 01:20:18
This should be private (problemClass_)
sammiequon
2016/08/25 23:50:02
No more problem message.
|
| + type: String, |
| + value: 'warning' |
| + }, |
| + |
| /** The value stored in the keyboard's input element. */ |
| value: { |
| type: String, |
| @@ -70,6 +86,16 @@ Polymer({ |
| }, |
| /** |
| + * Called when a different problem message wants to be displayed. |
| + * @param {string} problemMessage the message to be displayed |
| + * @param {boolean} isError |
| + */ |
| + setProblem: function(problemMessage, isError) { |
| + this.problemClass = isError ? 'error' : 'warning'; |
| + this.problemMessage = problemMessage; |
| + }, |
| + |
| + /** |
| * Called when a keypad number has been tapped. |
| * @param {!{target: !PaperButtonElement}} event |
| * @private |
| @@ -127,12 +153,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 +191,32 @@ Polymer({ |
| }, |
| /** |
| + * Hides the problem message div if no error is to be shown. |
| + * @param {string} problemMessage |
| + * @private |
| + */ |
| + hasProblemMessage_: function(problemMessage) { |
| + return problemMessage.length > 0; |
| + }, |
| + |
| + /** |
| + * Computes the whether the error message should be shown. |
| + * @param {boolean} problemMessage |
| + * @private |
| + */ |
| + getProblemClass_: function(problemMessage) { |
|
jdufault
2016/08/24 01:20:18
Showing the problem should be controlled by the em
sammiequon
2016/08/25 23:50:02
No more problem message.
|
| + return problemMessage.length > 0 ? 'problem-show' : ''; |
| + }, |
| + |
| + /** |
| + * Computes the direction of the problem message. |
| + * @private |
| + */ |
| + getProblemDirection_: function() { |
| + return document.dir == 'rtl' ? 'problem-rtl' : ''; |
| + }, |
| + |
| + /** |
| * Computes the direction of the pin input. |
| * @param {string} password |
| * @private |
| @@ -178,7 +239,7 @@ Polymer({ |
| * @param {boolean} submitEnabled |
| * @private |
| */ |
| - getSubmitHiddenClass_: function(submitEnabled) { |
| + getSubmitClass_: function(submitEnabled) { |
| return submitEnabled ? '' : 'submit-button-hidden'; |
| } |
| }); |