Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2100)

Unified Diff: ui/login/account_picker/user_pod_row.js

Issue 2254623003: Submit button added to user pod. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 dfb2b3ad0cbaf2df2e64bc0bd1ddeec38b5d9d37..1c7bec0c0ac08e8e2280b45f3bfb1e370c9f9c62 100644
--- a/ui/login/account_picker/user_pod_row.js
+++ b/ui/login/account_picker/user_pod_row.js
@@ -755,6 +755,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));
@@ -791,6 +795,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}
*/
@@ -868,6 +890,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}
@@ -1093,6 +1123,10 @@ cr.define('login', function() {
}
},
+ setErrorDisplay: function(visible) {
+ this.submitButton.classList.toggle('error-shown', visible);
+ },
+
toggleTransitions: function(enable) {
this.classList.toggle('flying-pin-pod', enable);
},
@@ -2542,11 +2576,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_)
+ 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.
+ * @param {boolean} visible
+ */
setFocusedPodPinVisibility: function(visible) {
if (this.focusedPod_ && this.focusedPod_.user.showPin)
this.focusedPod_.setPinVisibility(visible);

Powered by Google App Engine
This is Rietveld 408576698