Chromium Code Reviews| Index: ui/login/account_picker/user_pod_row.js |
| diff --git a/ui/login/account_picker/user_pod_row.js b/ui/login/account_picker/user_pod_row.js |
| index daa92b6f23d8385c220ba387abc0b2249136af38..47074d61d1dc8321ead94556ed58efc559670551 100644 |
| --- a/ui/login/account_picker/user_pod_row.js |
| +++ b/ui/login/account_picker/user_pod_row.js |
| @@ -753,6 +753,10 @@ cr.define('login', function() { |
| this.parentNode.handleKeyDown.bind(this.parentNode)); |
| this.passwordElement.addEventListener('keypress', |
| this.handlePasswordKeyPress_.bind(this)); |
| + this.passwordElement.addEventListener('input', |
| + this.handlePasswordInput_.bind(this)); |
| + this.submitButton.addEventListener('click', |
| + this.handleSubmitButtonClick_.bind(this)); |
| this.imageElement.addEventListener('load', |
| this.parentNode.handlePodImageLoad.bind(this.parentNode, this)); |
| @@ -762,6 +766,18 @@ cr.define('login', function() { |
| this.setAuthType(initialAuthType, null); |
| this.userClickAuthAllowed_ = false; |
| + |
| + // Lazy load the assets need for the polymer submit button. |
| + if (cr.ui.login.ResourceLoader.alreadyLoadedAssets('userpod-polymer')) |
| + return; |
| + |
| + cr.ui.login.ResourceLoader.registerAssets({ |
| + id: 'userpod-polymer', |
| + html: [ |
| + { url: 'chrome://oobe/custom_elements_userpod.html'}] |
|
jdufault
2016/08/30 17:34:18
Cleanup formatting
sammiequon
2016/08/30 18:04:48
Done.
|
| + }); |
| + cr.ui.login.ResourceLoader.loadAssetsOnIdle('userpod-polymer', |
| + function() {}); |
| }, |
| /** |
| @@ -789,6 +805,24 @@ cr.define('login', function() { |
| }, |
| /** |
| + * Handles input changes on password input. |
| + * @param {Event} e Input Event object. |
| + * @private |
| + */ |
| + handlePasswordInput_: function(e) { |
| + this.submitButton.disabled = this.passwordElement.value.length <= 0; |
| + this.setErrorDisplay(false); |
| + }, |
| + |
| + /** |
| + * Handles a click event on submit button. |
| + * @param {Event} e Click event. |
| + */ |
| + handleSubmitButtonClick_: function(e) { |
| + this.parentNode.setActivatedPod(this, e); |
| + }, |
| + |
| + /** |
| * Top edge margin number of pixels. |
| * @type {?number} |
| */ |
| @@ -866,6 +900,14 @@ cr.define('login', function() { |
| }, |
| /** |
| + * Gets submit button. |
| + * @type {!HTMLInputElement} |
| + */ |
| + get submitButton() { |
| + return this.querySelector('.submit-button'); |
| + }, |
| + |
| + /** |
| * Gets the password label, which is used to show a message where the |
| * password field is normally. |
| * @type {!HTMLInputElement} |
| @@ -1095,6 +1137,10 @@ cr.define('login', function() { |
| return this.pinKeyboard && this.pinKeyboard.offsetHeight > 0; |
| }, |
| + setErrorDisplay: function(visible) { |
| + this.submitButton.classList.toggle('error-shown', visible); |
| + }, |
| + |
| toggleTransitions: function(enable) { |
| this.classList.toggle('flying-pin-pod', enable); |
| }, |
| @@ -2583,11 +2629,28 @@ cr.define('login', function() { |
| userPod.initialize(); |
| }, |
| + /** |
| + * Performs visual changes on the user pod if there is an error. |
| + * @param {boolean} visible Whether to show or hide the display. |
| + */ |
| + setFocusedPodErrorDisplay: function(visible) { |
| + if (this.focusedPod_) |
|
jdufault
2016/08/30 17:34:18
Move this so it's defined next to setFocusedPodPin
sammiequon
2016/08/30 18:04:48
Done.
|
| + this.focusedPod_.setErrorDisplay(visible); |
| + }, |
| + |
| + /** |
| + * Enables or disables transitions on the user pod. |
| + * @param {boolean} enable |
| + */ |
| togglePinTransitions: function(enable) { |
| for (var i = 0; i < this.pods.length; ++i) |
| this.pods[i].toggleTransitions(enable); |
| }, |
| + /** |
| + * Shows or hides the pin keyboard for the current focused pod. |
| + * @param {boolean} visible |
| + */ |
| setFocusedPodPinVisibility: function(visible) { |
| if (this.focusedPod_ && this.focusedPod_.user.showPin) |
| this.focusedPod_.setPinVisibility(visible); |