Chromium Code Reviews| Index: chrome/browser/resources/chromeos/login/user_pod_row.js |
| diff --git a/chrome/browser/resources/chromeos/login/user_pod_row.js b/chrome/browser/resources/chromeos/login/user_pod_row.js |
| index eafb56a9dde2bee0411a7b546bdc605ffa887a5a..c3ab1a6d54f20882a2467289ed157c78e0ee2af4 100644 |
| --- a/chrome/browser/resources/chromeos/login/user_pod_row.js |
| +++ b/chrome/browser/resources/chromeos/login/user_pod_row.js |
| @@ -303,12 +303,19 @@ cr.define('login', function() { |
| '?id=' + UserPod.userImageSalt_[this.user.username]; |
| this.nameElement.textContent = this.user_.displayName; |
| - this.actionBoxAreaElement.hidden = this.user_.publicAccount; |
| - this.actionBoxMenuRemoveElement.hidden = !this.user_.canRemove; |
| this.signedInIndicatorElement.hidden = !this.user_.signedIn; |
| var needSignin = this.needGaiaSignin; |
| this.passwordElement.hidden = needSignin; |
| + this.signinButtonElement.hidden = !needSignin; |
| + |
| + this.updateActionBoxArea(); |
| + }, |
| + |
| + updateActionBoxArea: function() { |
| + this.actionBoxAreaElement.hidden = this.user_.publicAccount; |
| + this.actionBoxMenuRemoveElement.hidden = !this.user_.canRemove; |
| + |
| this.actionBoxAreaElement.setAttribute( |
| 'aria-label', loadTimeData.getStringF( |
| 'podMenuButtonAccessibleName', this.user_.emailAddress)); |
| @@ -326,7 +333,6 @@ cr.define('login', function() { |
| loadTimeData.getString('removeUser'); |
| this.passwordElement.setAttribute('aria-label', loadTimeData.getStringF( |
| 'passwordFieldAccessibleName', this.user_.emailAddress)); |
| - this.signinButtonElement.hidden = !needSignin; |
| this.userTypeIconAreaElement.hidden = !this.user_.locallyManagedUser; |
| }, |
| @@ -566,6 +572,7 @@ cr.define('login', function() { |
| handleMouseDown_: function(e) { |
| if (this.parentNode.disabled) |
| return; |
| + |
| if (!this.signinButtonElement.hidden && !this.isActionBoxMenuActive) { |
| this.showSigninUI(); |
| // Prevent default so that we don't trigger 'focus' event. |
| @@ -756,6 +763,77 @@ cr.define('login', function() { |
| }; |
| /** |
| + * Creates a user pod to be used only in desktop chrome. |
| + * @constructor |
| + * @extends {UserPod} |
| + */ |
| + var DesktopUserPod = cr.ui.define(function() { |
| + // Don't just instantiate a UserPod(), as this will call decorate() on the |
| + // parent object, and add duplicate event listeners. |
| + var node = $('user-pod-template').cloneNode(true); |
| + node.removeAttribute('id'); |
| + return node; |
| + }); |
| + |
| + DesktopUserPod.prototype = { |
| + __proto__: UserPod.prototype, |
| + |
| + /** @override */ |
| + decorate: function() { |
| + UserPod.prototype.decorate.call(this); |
| + }, |
| + |
| + /** @override */ |
| + focusInput: function() { |
| + var isLockedUser = this.user.needsSignin; |
|
Nikita (slow)
2013/06/11 18:22:16
Will we have concept of locked user on Chrome desk
noms (inactive)
2013/06/11 19:39:41
Yes. Signed in users will be able to "sign out" an
|
| + this.signinButtonElement.hidden = isLockedUser; |
| + this.passwordElement.hidden = !isLockedUser; |
| + |
| + // Move tabIndex from the whole pod to the main input. |
| + this.tabIndex = -1; |
| + this.mainInput.tabIndex = UserPodTabOrder.POD_INPUT; |
| + this.mainInput.focus(); |
| + }, |
| + |
| + /** @override */ |
| + update: function() { |
| + this.imageElement.src = this.user.userImage; |
| + this.nameElement.textContent = this.user_.displayName; |
| + var isLockedUser = this.user.needsSignin; |
| + this.passwordElement.hidden = !isLockedUser; |
| + this.signinButtonElement.hidden = isLockedUser; |
| + |
| + UserPod.prototype.updateActionBoxArea.call(this); |
| + }, |
| + |
| + /** @override */ |
| + activate: function() { |
| + Oobe.launchUser(this.user.emailAddress, this.user.displayName); |
| + return true; |
| + }, |
| + |
| + /** @override */ |
| + handleMouseDown_: function(e) { |
| + if (this.parentNode.disabled) |
| + return; |
| + |
| + // Don't sign in until the user presses the button. Just activate the pod. |
| + Oobe.clearErrors(); |
| + this.disabled = true; |
|
Nikita (slow)
2013/06/11 18:22:16
Why user pod is disabled?
noms
2013/06/12 20:41:54
I copied the code from the standard user pod, but
|
| + this.parentNode.lastFocusedPod_ = |
| + this.parentNode.getPodWithUsername_(this.user.emailAddress); |
| + }, |
| + |
| + /** @override */ |
| + handleRemoveCommandClick_: function(e) { |
| + //TODO(noms): Add deletion confirmation overlay before attempting |
| + // to delete the user. |
| + UserPod.prototype.handleRemoveCommandClick_.call(this, e); |
| + |
|
Nikita (slow)
2013/06/11 18:22:16
nit: drop empty line
noms
2013/06/12 20:41:54
Done.
|
| + }, |
| + }; |
| + |
| + /** |
| * Creates a new pod row element. |
| * @constructor |
| * @extends {HTMLDivElement} |
| @@ -861,7 +939,9 @@ cr.define('login', function() { |
| */ |
| createUserPod: function(user) { |
| var userPod; |
| - if (user.publicAccount) |
| + if (user.isDesktopScreen) |
|
Nikita (slow)
2013/06/11 18:22:16
nit: isDesktopScreen is property of a user but is
noms
2013/06/12 20:41:54
Done.
|
| + userPod = new DesktopUserPod({user: user}); |
| + else if (user.publicAccount) |
| userPod = new PublicAccountUserPod({user: user}); |
| else |
| userPod = new UserPod({user: user}); |