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..c10b989d5e4edb26350ebf79409ed6a3b7b3e1f5 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,17 @@ cr.define('login', function() { |
this.setAuthType(initialAuthType, null); |
this.userClickAuthAllowed_ = false; |
+ |
+ // Lazy load the assets need for the polymer submit button. |
jdufault
2016/08/30 18:21:58
This is going to always load the PIN keyboard. Thi
sammiequon
2016/08/30 19:44:35
As per our offline chat we will keep this seperate
|
+ if (cr.ui.login.ResourceLoader.alreadyLoadedAssets('userpod-polymer')) |
jdufault
2016/08/30 18:21:58
'custom-elements'
sammiequon
2016/08/30 19:44:35
As per our offline chat we will keep this seperate
|
+ return; |
+ |
+ cr.ui.login.ResourceLoader.registerAssets({ |
+ id: 'userpod-polymer', |
jdufault
2016/08/30 18:21:58
'custom-elements'
sammiequon
2016/08/30 19:44:35
As per our offline chat we will keep this seperate
|
+ html: [{ url: 'chrome://oobe/custom_elements.html'}] |
+ }); |
+ cr.ui.login.ResourceLoader.loadAssetsOnIdle('userpod-polymer', |
+ function() {}); |
jdufault
2016/08/30 18:21:58
emit function
sammiequon
2016/08/30 19:44:35
Do we need to still emit function?
|
}, |
/** |
@@ -789,6 +804,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 +899,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 +1136,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 +2628,28 @@ cr.define('login', function() { |
userPod.initialize(); |
}, |
+ /** |
+ * 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); |
}, |
+ /** |
+ * 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_) |
+ this.focusedPod_.setErrorDisplay(visible); |
+ }, |
+ |
+ /** |
+ * 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); |