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 7d1eb8b4ff7c72098d641cb618f184157231c901..c8f3655e4a4964e3277c13fb492d1a7ed98950bd 100644 |
--- a/chrome/browser/resources/chromeos/login/user_pod_row.js |
+++ b/chrome/browser/resources/chromeos/login/user_pod_row.js |
@@ -659,18 +659,31 @@ cr.define('login', function() { |
} |
} |
+ var hadFocus = !!this.focusedPod_; |
this.focusedPod_ = podToFocus; |
if (podToFocus) { |
podToFocus.classList.remove('faded'); |
podToFocus.classList.add('focused'); |
podToFocus.reset(true); // Reset and give focus. |
this.scrollPodIntoView(podToFocus); |
- this.loadWallpaperTimeout_ = window.setTimeout(function() { |
- chrome.send('userSelectedDelayed', [podToFocus.user.username]); |
- }, WALLPAPER_LOAD_DELAY_MS); |
+ // Load wallpaper immediately if there no pod was focused previously, |
+ // otherwise delay loading to let user tab through pods without lag. |
+ if (hadFocus) { |
+ this.loadWallpaperTimeout_ = window.setTimeout( |
+ this.loadWallpaper_.bind(this), WALLPAPER_LOAD_DELAY_MS); |
+ } else { |
+ this.loadWallpaper_(); |
+ } |
+ } else { |
+ // TODO(ivankr): reset wallpaper. |
} |
}, |
+ loadWallpaper_: function() { |
+ if (this.focusedPod_) |
+ chrome.send('userSelectedDelayed', [this.focusedPod_.user.username]); |
+ }, |
+ |
/** |
* Returns the currently activated pod. |
* @type {UserPod} |