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

Side by Side Diff: chrome/browser/resources/chromeos/login/user_pod_row.js

Issue 10889024: [cros] Initialize OOBE in parallel when boot animation is disabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Subscription fixes Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview User pod row implementation. 6 * @fileoverview User pod row implementation.
7 */ 7 */
8 8
9 cr.define('login', function() { 9 cr.define('login', function() {
10 /** 10 /**
(...skipping 15 matching lines...) Expand all
26 * @type {number} 26 * @type {number}
27 * @const 27 * @const
28 */ 28 */
29 var WALLPAPER_LOAD_DELAY_MS = 500; 29 var WALLPAPER_LOAD_DELAY_MS = 500;
30 30
31 /** 31 /**
32 * Wallpaper load delay in milliseconds. TODO(nkostylev): Tune this constant. 32 * Wallpaper load delay in milliseconds. TODO(nkostylev): Tune this constant.
33 * @type {number} 33 * @type {number}
34 * @const 34 * @const
35 */ 35 */
36 var WALLPAPER_BOOT_LOAD_DELAY_MS = 500; 36 var WALLPAPER_BOOT_LOAD_DELAY_MS = 100;
37 37
38 /** 38 /**
39 * Maximum time for which the pod row remains hidden until all user images 39 * Maximum time for which the pod row remains hidden until all user images
40 * have been loaded. 40 * have been loaded.
41 * @type {number} 41 * @type {number}
42 * @const 42 * @const
43 */ 43 */
44 var POD_ROW_IMAGES_LOAD_TIMEOUT_MS = 3000; 44 var POD_ROW_IMAGES_LOAD_TIMEOUT_MS = 3000;
45 45
46 /** 46 /**
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 * @extends {HTMLDivElement} 444 * @extends {HTMLDivElement}
445 */ 445 */
446 var PodRow = cr.ui.define('podrow'); 446 var PodRow = cr.ui.define('podrow');
447 447
448 PodRow.prototype = { 448 PodRow.prototype = {
449 __proto__: HTMLDivElement.prototype, 449 __proto__: HTMLDivElement.prototype,
450 450
451 // Whether this user pod row is shown for the first time. 451 // Whether this user pod row is shown for the first time.
452 firstShown_: true, 452 firstShown_: true,
453 453
454 // Whether the initial wallpaper load after boot has been requested. Used
455 // only if |Oobe.getInstance().shouldLoadWallpaperOnBoot()| is true.
456 bootWallpaperLoaded_: false,
457
454 // True if inside focusPod(). 458 // True if inside focusPod().
455 insideFocusPod_: false, 459 insideFocusPod_: false,
456 460
457 // Focused pod. 461 // Focused pod.
458 focusedPod_: undefined, 462 focusedPod_: undefined,
459 463
460 // Activated pod, i.e. the pod of current login attempt. 464 // Activated pod, i.e. the pod of current login attempt.
461 activatedPod_: undefined, 465 activatedPod_: undefined,
462 466
463 // When moving through users quickly at login screen, set a timeout to 467 // When moving through users quickly at login screen, set a timeout to
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 this.focusedPod_ = podToFocus; 691 this.focusedPod_ = podToFocus;
688 if (podToFocus) { 692 if (podToFocus) {
689 podToFocus.classList.remove('faded'); 693 podToFocus.classList.remove('faded');
690 podToFocus.classList.add('focused'); 694 podToFocus.classList.add('focused');
691 podToFocus.reset(true); // Reset and give focus. 695 podToFocus.reset(true); // Reset and give focus.
692 this.scrollPodIntoView(podToFocus); 696 this.scrollPodIntoView(podToFocus);
693 if (hadFocus) { 697 if (hadFocus) {
694 // Delay wallpaper loading to let user tab through pods without lag. 698 // Delay wallpaper loading to let user tab through pods without lag.
695 this.loadWallpaperTimeout_ = window.setTimeout( 699 this.loadWallpaperTimeout_ = window.setTimeout(
696 this.loadWallpaper_.bind(this), WALLPAPER_LOAD_DELAY_MS); 700 this.loadWallpaper_.bind(this), WALLPAPER_LOAD_DELAY_MS);
697 } else { 701 } else if (!this.firstShown_) {
698 if (!this.firstShown_) { 702 // Load wallpaper immediately if there no pod was focused
699 // Load wallpaper immediately if there no pod was focused 703 // previously, and it is not a boot into user pod list case.
700 // previously, and it is not a boot into user pod list case. 704 this.loadWallpaper_();
701 this.loadWallpaper_(); 705 this.firstShown_ = false;
702 } else {
703 // Boot transition. Delay wallpaper load to remove jank
704 // happening when wallpaper load is competing for resources with
705 // login WebUI.
706 if (Oobe.getInstance().shouldLoadWallpaperOnBoot()) {
707 this.loadWallpaperTimeout_ = window.setTimeout(
708 this.loadWallpaper_.bind(this), WALLPAPER_BOOT_LOAD_DELAY_MS);
709 }
710 this.firstShown_ = false;
711 }
712 } 706 }
713 } else { 707 } else {
714 chrome.send('userDeselected'); 708 chrome.send('userDeselected');
715 } 709 }
716 this.insideFocusPod_ = false; 710 this.insideFocusPod_ = false;
717 }, 711 },
718 712
719 loadWallpaper_: function() { 713 loadWallpaper_: function() {
720 if (this.focusedPod_) 714 if (this.focusedPod_)
721 chrome.send('userSelectedDelayed', [this.focusedPod_.user.username]); 715 chrome.send('userSelectedDelayed', [this.focusedPod_.user.username]);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 }, 880 },
887 881
888 /** 882 /**
889 * Called right after the pod row is shown. 883 * Called right after the pod row is shown.
890 */ 884 */
891 handleAfterShow: function() { 885 handleAfterShow: function() {
892 // Force input focus for user pod on show and once transition ends. 886 // Force input focus for user pod on show and once transition ends.
893 if (this.focusedPod_) { 887 if (this.focusedPod_) {
894 var focusedPod = this.focusedPod_; 888 var focusedPod = this.focusedPod_;
895 var screen = this.parentNode; 889 var screen = this.parentNode;
890 var self = this;
896 focusedPod.addEventListener('webkitTransitionEnd', function f(e) { 891 focusedPod.addEventListener('webkitTransitionEnd', function f(e) {
897 if (e.target == focusedPod) { 892 if (e.target == focusedPod) {
898 focusedPod.removeEventListener('webkitTransitionEnd', f); 893 focusedPod.removeEventListener('webkitTransitionEnd', f);
899 focusedPod.reset(true); 894 focusedPod.reset(true);
900 // Notify screen that it is ready. 895 // Notify screen that it is ready.
901 screen.onShow(); 896 screen.onShow();
897 // Boot transition: load wallpaper.
898 if (!self.bootWallpaperLoaded_ &&
899 Oobe.getInstance().shouldLoadWallpaperOnBoot()) {
900 self.loadWallpaperTimeout_ = window.setTimeout(
901 self.loadWallpaper_.bind(self), WALLPAPER_BOOT_LOAD_DELAY_MS);
902 self.bootWallpaperLoaded_ = true;
903 }
902 } 904 }
903 }); 905 });
904 } 906 }
905 }, 907 },
906 908
907 /** 909 /**
908 * Called right before the pod row is shown. 910 * Called right before the pod row is shown.
909 */ 911 */
910 handleBeforeShow: function() { 912 handleBeforeShow: function() {
911 for (var event in this.listeners_) { 913 for (var event in this.listeners_) {
(...skipping 22 matching lines...) Expand all
934 handlePodImageLoad: function(pod) { 936 handlePodImageLoad: function(pod) {
935 var index = this.podsWithPendingImages_.indexOf(pod); 937 var index = this.podsWithPendingImages_.indexOf(pod);
936 if (index == -1) { 938 if (index == -1) {
937 return; 939 return;
938 } 940 }
939 941
940 this.podsWithPendingImages_.splice(index, 1); 942 this.podsWithPendingImages_.splice(index, 1);
941 if (this.podsWithPendingImages_.length == 0) { 943 if (this.podsWithPendingImages_.length == 0) {
942 this.classList.remove('images-loading'); 944 this.classList.remove('images-loading');
943 chrome.send('userImagesLoaded'); 945 chrome.send('userImagesLoaded');
944 // Report back user pods being painted.
945 window.webkitRequestAnimationFrame(function() {
946 chrome.send('loginVisible');
947 });
948 } 946 }
949 } 947 }
950 }; 948 };
951 949
952 return { 950 return {
953 PodRow: PodRow 951 PodRow: PodRow
954 }; 952 };
955 }); 953 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698