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

Unified Diff: chrome/browser/resources/chromeos/login/user_pod_row.js

Issue 10454044: Added support for animated/nonanimated user image. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 7 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: 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;

Powered by Google App Engine
This is Rietveld 408576698