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

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

Issue 10207030: Asynchronously load wallpapers when user pod is selected. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nit Created 8 years, 8 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 149b3175eb580fab6afd6c04f64a8ce12a7dd471..f19db47b985ddd672a0f7ab42558d307290b6178 100644
--- a/chrome/browser/resources/chromeos/login/user_pod_row.js
+++ b/chrome/browser/resources/chromeos/login/user_pod_row.js
@@ -8,13 +8,16 @@
cr.define('login', function() {
// Pod width. 170px Pod + 10px padding + 10px margin on both sides.
- const POD_WIDTH = 170 + 2 * (10 + 10);
+ var POD_WIDTH = 170 + 2 * (10 + 10);
James Hawkins 2012/04/26 20:37:37 /** const */ var POD_WIDTH
bshe 2012/04/27 18:07:21 Done.
+
+ // Wallpaper load delay in milliseconds.
+ var WALLPAPER_LOAD_DELAY_MS = 800;
/**
* Oauth token status. These must match UserManager::OAuthTokenStatus.
* @enum {number}
*/
- const OAuthTokenStatus = {
+ var OAuthTokenStatus = {
UNKNOWN: 0,
INVALID: 1,
VALID: 2
@@ -24,7 +27,7 @@ cr.define('login', function() {
* Tab order for user pods. Update these when adding new controls.
* @enum {number}
*/
- const UserPodTabOrder = {
+ var UserPodTabOrder = {
POD_INPUT: 1, // Password input fields (and whole pods themselves).
HEADER_BAR: 2, // Buttons on the header bar (Shutdown, Add User).
REMOVE_USER: 3 // Remove ('X') buttons.
@@ -457,6 +460,10 @@ cr.define('login', function() {
// Activated pod, i.e. the pod of current login attempt.
activatedPod_: undefined,
+ // When quickly move through users at login screen, we need to set a
James Hawkins 2012/04/26 20:37:37 nit: Grammar is off here, "When quickly move throu
bshe 2012/04/27 18:07:21 Done.
+ // timeout to prevent loading intermediate wallpapers.
+ loadWallpaperTimeout_: null,
+
// Pods whose initial images haven't been loaded yet.
podsWithPendingImages_: [],
@@ -632,6 +639,7 @@ cr.define('login', function() {
if (this.focusedPod_ == podToFocus && !opt_force)
return;
+ clearTimeout(this.loadWallpaperTimeout_);
for (var i = 0, pod; pod = this.pods[i]; ++i) {
pod.activeRemoveButton = false;
if (pod != podToFocus) {
@@ -647,6 +655,9 @@ cr.define('login', function() {
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]);
James Hawkins 2012/04/26 20:37:37 nit: Indentation is off.
bshe 2012/04/27 18:07:21 Done.
+ }, WALLPAPER_LOAD_DELAY_MS);
}
},

Powered by Google App Engine
This is Rietveld 408576698