| Index: chrome/browser/resources/chromeos/login/user_pod_row.js
|
| ===================================================================
|
| --- chrome/browser/resources/chromeos/login/user_pod_row.js (revision 232150)
|
| +++ chrome/browser/resources/chromeos/login/user_pod_row.js (working copy)
|
| @@ -2,8 +2,6 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -<include src="wallpaper_loader.js"></include>
|
| -
|
| /**
|
| * @fileoverview User pod row implementation.
|
| */
|
| @@ -24,6 +22,20 @@
|
| var PRESELECT_FIRST_POD = true;
|
|
|
| /**
|
| + * Wallpaper load delay in milliseconds.
|
| + * @type {number}
|
| + * @const
|
| + */
|
| + var WALLPAPER_LOAD_DELAY_MS = 500;
|
| +
|
| + /**
|
| + * Wallpaper load delay in milliseconds. TODO(nkostylev): Tune this constant.
|
| + * @type {number}
|
| + * @const
|
| + */
|
| + var WALLPAPER_BOOT_LOAD_DELAY_MS = 100;
|
| +
|
| + /**
|
| * Maximum time for which the pod row remains hidden until all user images
|
| * have been loaded.
|
| * @type {number}
|
| @@ -947,9 +959,17 @@
|
| // Whether this user pod row is shown for the first time.
|
| firstShown_: true,
|
|
|
| + // Whether the initial wallpaper load after boot has been requested. Used
|
| + // only if |Oobe.getInstance().shouldLoadWallpaperOnBoot()| is true.
|
| + bootWallpaperLoaded_: false,
|
| +
|
| // True if inside focusPod().
|
| insideFocusPod_: false,
|
|
|
| + // True if user pod has been activated with keyboard.
|
| + // In case of activation with keyboard we delay wallpaper change.
|
| + keyboardActivated_: false,
|
| +
|
| // Focused pod.
|
| focusedPod_: undefined,
|
|
|
| @@ -959,8 +979,9 @@
|
| // Pod that was most recently focused, if any.
|
| lastFocusedPod_: undefined,
|
|
|
| - // Note: created only in decorate() !
|
| - wallpaperLoader_: undefined,
|
| + // When moving through users quickly at login screen, set a timeout to
|
| + // prevent loading intermediate wallpapers.
|
| + loadWallpaperTimeout_: null,
|
|
|
| // Pods whose initial images haven't been loaded yet.
|
| podsWithPendingImages_: [],
|
| @@ -977,7 +998,6 @@
|
| mousemove: [this.handleMouseMove_.bind(this), false],
|
| keydown: [this.handleKeyDown.bind(this), false]
|
| };
|
| - this.wallpaperLoader_ = new login.WallpaperLoader();
|
| },
|
|
|
| /**
|
| @@ -1222,7 +1242,7 @@
|
| }
|
| this.insideFocusPod_ = true;
|
|
|
| - this.wallpaperLoader_.reset();
|
| + clearTimeout(this.loadWallpaperTimeout_);
|
| for (var i = 0, pod; pod = this.pods[i]; ++i) {
|
| if (!this.isSinglePod) {
|
| pod.isActionBoxMenuActive = false;
|
| @@ -1246,8 +1266,15 @@
|
| podToFocus.classList.add('focused');
|
| podToFocus.reset(true); // Reset and give focus.
|
| chrome.send('focusPod', [podToFocus.user.emailAddress]);
|
| -
|
| - this.wallpaperLoader_.scheduleLoad(podToFocus.user.emailAddress);
|
| + if (hadFocus && this.keyboardActivated_) {
|
| + // Delay wallpaper loading to let user tab through pods without lag.
|
| + this.loadWallpaperTimeout_ = window.setTimeout(
|
| + this.loadWallpaper_.bind(this), WALLPAPER_LOAD_DELAY_MS);
|
| + } else if (!this.firstShown_) {
|
| + // Load wallpaper immediately if there no pod was focused
|
| + // previously, and it is not a boot into user pod list case.
|
| + this.loadWallpaper_();
|
| + }
|
| this.firstShown_ = false;
|
| this.lastFocusedPod_ = podToFocus;
|
| }
|
| @@ -1256,19 +1283,20 @@
|
| },
|
|
|
| /**
|
| - * Resets wallpaper to the last active user's wallpaper, if any.
|
| + * Loads wallpaper for the active user pod, if any.
|
| + * @private
|
| */
|
| - loadLastWallpaper: function() {
|
| - if (this.lastFocusedPod_)
|
| - this.wallpaperLoader_.scheduleLoad(this.lastFocusedPod_.user.username);
|
| + loadWallpaper_: function() {
|
| + if (this.focusedPod_)
|
| + chrome.send('loadWallpaper', [this.focusedPod_.user.username]);
|
| },
|
|
|
| /**
|
| - * Handles 'onWallpaperLoaded' event. Recalculates statistics and
|
| - * [re]schedules next wallpaper load.
|
| + * Resets wallpaper to the last active user's wallpaper, if any.
|
| */
|
| - onWallpaperLoaded: function(email) {
|
| - this.wallpaperLoader_.onWallpaperLoaded(email);
|
| + loadLastWallpaper: function() {
|
| + if (this.lastFocusedPod_)
|
| + chrome.send('loadWallpaper', [this.lastFocusedPod_.user.username]);
|
| },
|
|
|
| /**
|
| @@ -1532,7 +1560,13 @@
|
| focusedPod.reset(true);
|
| // Notify screen that it is ready.
|
| screen.onShow();
|
| - self.wallpaperLoader_.scheduleLoad(focusedPod.user.username);
|
| + // Boot transition: load wallpaper.
|
| + if (!self.bootWallpaperLoaded_ &&
|
| + Oobe.getInstance().shouldLoadWallpaperOnBoot()) {
|
| + self.loadWallpaperTimeout_ = window.setTimeout(
|
| + self.loadWallpaper_.bind(self), WALLPAPER_BOOT_LOAD_DELAY_MS);
|
| + self.bootWallpaperLoaded_ = true;
|
| + }
|
| }
|
| });
|
| // Guard timer for 1 second -- it would conver all possible animations.
|
|
|