| 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..c4b4a193f8ee983635bee4a6cdee4ae57641420d 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,75 @@ 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;
|
| + 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.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);
|
| + },
|
| + };
|
| +
|
| + /**
|
| * Creates a new pod row element.
|
| * @constructor
|
| * @extends {HTMLDivElement}
|
| @@ -861,7 +937,9 @@ cr.define('login', function() {
|
| */
|
| createUserPod: function(user) {
|
| var userPod;
|
| - if (user.publicAccount)
|
| + if (user.isDesktopUser)
|
| + userPod = new DesktopUserPod({user: user});
|
| + else if (user.publicAccount)
|
| userPod = new PublicAccountUserPod({user: user});
|
| else
|
| userPod = new UserPod({user: user});
|
|
|