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 88fa9278c24bbc0b6bfc51917402b1d18ee7b493..160fa88634be31378f6e06ad5456d171cbc53128 100644 |
| --- a/ui/login/account_picker/user_pod_row.js |
| +++ b/ui/login/account_picker/user_pod_row.js |
| @@ -735,13 +735,6 @@ cr.define('login', function() { |
| this.actionBoxRemoveUserWarningButtonElement.addEventListener('keydown', |
| this.handleRemoveUserConfirmationKeyDown_.bind(this)); |
| - var pinKeyboard = $('pin-keyboard'); |
| - // The pin keyboard is not present on the md user manager. |
| - if (pinKeyboard) { |
| - pinKeyboard.addEventListener('submit', |
| - this.handlePinSubmitted_.bind(this)); |
| - } |
| - |
| var customIcon = this.customIconElement; |
| customIcon.parentNode.replaceChild(new UserPodCustomIcon(), customIcon); |
| }, |
| @@ -755,6 +748,11 @@ cr.define('login', function() { |
| this.passwordElement.addEventListener('keypress', |
| this.handlePasswordKeyPress_.bind(this)); |
| + if (this.pinKeyboard) { |
| + this.pinKeyboard.addEventListener('submit', |
| + this.handlePinSubmitted_.bind(this)); |
| + } |
| + |
| this.imageElement.addEventListener('load', |
| this.parentNode.handlePodImageLoad.bind(this.parentNode, this)); |
| @@ -837,6 +835,14 @@ cr.define('login', function() { |
| }, |
| /** |
| + * Gets the authorization element of the pod. |
| + * @type {!HTMLDivElement} |
| + */ |
| + get authElement() { |
| + return this.querySelector('.auth-container'); |
| + }, |
| + |
| + /** |
| * Gets image element. |
| * @type {!HTMLImageElement} |
| */ |
| @@ -886,6 +892,22 @@ cr.define('login', function() { |
| }, |
| /** |
| + * Gets the pin-container of the pod. |
| + * @type {!HTMLDivElement} |
| + */ |
| + get pinContainer() { |
| + return this.querySelector('.pin-container'); |
| + }, |
| + |
| + /** |
| + * Gets the pin-keyboard of the pod. |
| + * @type {!HTMLElement} |
| + */ |
| + get pinKeyboard() { |
| + return this.querySelector('pin-keyboard'); |
| + }, |
| + |
| + /** |
| * Gets user online sign in hint element. |
| * @type {!HTMLDivElement} |
| */ |
| @@ -894,6 +916,14 @@ cr.define('login', function() { |
| }, |
| /** |
| + * Gets the signed in indicator of the pod. |
| + * @type {!HTMLDivElement} |
| + */ |
| + get signInElement() { |
| + return this.querySelector('.signed-in-indicator'); |
| + }, |
| + |
| + /** |
| * Gets the container holding the launch app button. |
| * @type {!HTMLButtonElement} |
| */ |
| @@ -1094,6 +1124,23 @@ cr.define('login', function() { |
| } |
| }, |
| + setPinVisibility: function(visible) { |
| + var elements = [this, this.authElement, this.imageElement, |
| + this.signInElement, this.pinContainer]; |
| + |
| + for (var idx = 0; idx < elements.length; idx++) { |
| + var currentElement = elements[idx]; |
| + if (visible) { |
| + currentElement.classList.add('pin-enabled'); |
| + currentElement.classList.remove('pin-disabled'); |
| + } |
| + else { |
|
xiyuan
2016/06/24 21:19:09
nit: move it to line 1136
sammiequon
2016/06/24 22:06:39
Done.
|
| + currentElement.classList.remove('pin-enabled'); |
| + currentElement.classList.add('pin-disabled'); |
|
xiyuan
2016/06/24 21:19:10
nit: we replace the if with:
currentElement.class
sammiequon
2016/06/24 22:06:39
Done.
|
| + } |
| + } |
| + }, |
| + |
| setUserPodIconType: function(userTypeClass) { |
| this.userTypeIconAreaElement.classList.add(userTypeClass); |
| this.userTypeIconAreaElement.hidden = false; |
| @@ -2510,6 +2557,11 @@ cr.define('login', function() { |
| userPod.initialize(); |
| }, |
| + setFocusedPodPinVisibility: function(visible) { |
| + if (this.focusedPod_ && this.focusedPod_.user.showPin) |
| + this.focusedPod_.setPinVisibility(visible); |
| + }, |
| + |
| /** |
| * Runs app with a given id from the list of loaded apps. |
| * @param {!string} app_id of an app to run. |