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 2e564cbeae4810e56cfd8da92339ba4efcaaf39e..eadbc30e41e811121081c9d38f14b45e6746815c 100644 |
--- a/chrome/browser/resources/chromeos/login/user_pod_row.js |
+++ b/chrome/browser/resources/chromeos/login/user_pod_row.js |
@@ -106,6 +106,16 @@ cr.define('login', function() { |
// TODO(altimofeev): this will trigger when Gaia extension grabs focus. |
this.removeUserButtonElement.addEventListener('blur', |
this.handleRemoveButtonMouseOutOrBlur_.bind(this)); |
+ |
+ // |plainUserImage| and |animatedUserImage| are images for |
+ // |non-animated and animated versions of user image. Used for |
+ // |fast swapping between them (for instance, when user pod |
Ivan Korotkov
2012/05/29 10:50:23
Stray |
Ivan Korotkov
2012/05/29 10:50:23
/swapping/switching/
ygorshenin1
2012/05/30 12:17:34
Done.
|
+ // becomes active). |
+ this.plainUserImage = new Image(); |
+ this.animatedUserImage = new Image(); |
+ // That flag is true, when we show animated (when possible) |
+ // version of user image, and false otherwise. |
+ this.userImageIsAnimated = false; |
}, |
/** |
@@ -141,6 +151,11 @@ cr.define('login', function() { |
resetTabOrder: function() { |
this.tabIndex = UserPodTabOrder.POD_INPUT; |
this.mainInput.tabIndex = -1; |
+ |
+ if (!this.isGuest) { |
+ this.userImageIsAnimated = false; |
+ this.updateUserImage_(); |
+ } |
}, |
/** |
@@ -346,13 +361,32 @@ cr.define('login', function() { |
}, |
/** |
+ * Changes user image to animated or non-animated image from |
+ * internal buffers. |
+ */ |
+ updateUserImage_: function() { |
+ if (!this.isGuest) { |
Ivan Korotkov
2012/05/29 10:50:23
Let's remove this function and move the code to "s
ygorshenin1
2012/05/30 12:17:34
In discussion for crbug.com/114083 it was decided
|
+ this.imageElement.src = this.userImageIsAnimated ? |
+ this.animatedUserImage.src : this.plainUserImage.src; |
+ } |
+ }, |
+ |
+ /** |
* Updates the image element of the user. |
*/ |
updateUserImage: function() { |
- this.imageElement.src = this.isGuest ? |
- 'chrome://theme/IDR_LOGIN_GUEST' : |
- 'chrome://userimage/' + this.user.username + |
- '?id=' + (new Date()).getTime(); |
+ if (this.isGuest) { |
+ this.imageElement.src = 'chrome://theme/IDR_LOGIN_GUEST'; |
+ } else { |
+ var src = 'chrome://userimage/' + this.user.username + |
+ '?id=' + (new Date()).getTime(); |
+ this.plainUserImage.src = src; |
+ |
+ src += '&animated=true'; |
+ this.animatedUserImage.src = src; |
+ |
+ this.updateUserImage_(); |
+ } |
}, |
/** |
@@ -363,6 +397,11 @@ cr.define('login', function() { |
var needSignin = this.needGaiaSignin; |
this.signinButtonElement.hidden = !needSignin; |
this.passwordElement.hidden = needSignin; |
+ |
+ if (!this.userImageIsAnimated) { |
+ this.userImageIsAnimated = true; |
+ this.updateUserImage_(); |
+ } |
} |
// Move tabIndex from the whole pod to the main input. |
this.tabIndex = -1; |