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

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: merge 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 bootWallpaperLoaded_: false,
455
454 // True if inside focusPod(). 456 // True if inside focusPod().
455 insideFocusPod_: false, 457 insideFocusPod_: false,
456 458
457 // Focused pod. 459 // Focused pod.
458 focusedPod_: undefined, 460 focusedPod_: undefined,
459 461
460 // Activated pod, i.e. the pod of current login attempt. 462 // Activated pod, i.e. the pod of current login attempt.
461 activatedPod_: undefined, 463 activatedPod_: undefined,
462 464
463 // When moving through users quickly at login screen, set a timeout to 465 // 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; 689 this.focusedPod_ = podToFocus;
688 if (podToFocus) { 690 if (podToFocus) {
689 podToFocus.classList.remove('faded'); 691 podToFocus.classList.remove('faded');
690 podToFocus.classList.add('focused'); 692 podToFocus.classList.add('focused');
691 podToFocus.reset(true); // Reset and give focus. 693 podToFocus.reset(true); // Reset and give focus.
692 this.scrollPodIntoView(podToFocus); 694 this.scrollPodIntoView(podToFocus);
693 if (hadFocus) { 695 if (hadFocus) {
694 // Delay wallpaper loading to let user tab through pods without lag. 696 // Delay wallpaper loading to let user tab through pods without lag.
695 this.loadWallpaperTimeout_ = window.setTimeout( 697 this.loadWallpaperTimeout_ = window.setTimeout(
696 this.loadWallpaper_.bind(this), WALLPAPER_LOAD_DELAY_MS); 698 this.loadWallpaper_.bind(this), WALLPAPER_LOAD_DELAY_MS);
697 } else { 699 } else if (!this.firstShown_) {
698 if (!this.firstShown_) { 700 // Load wallpaper immediately if there no pod was focused
699 // Load wallpaper immediately if there no pod was focused 701 // 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. 702 this.loadWallpaper_();
701 this.loadWallpaper_(); 703 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 } 704 }
713 } else { 705 } else {
714 chrome.send('userDeselected'); 706 chrome.send('userDeselected');
715 } 707 }
716 this.insideFocusPod_ = false; 708 this.insideFocusPod_ = false;
717 }, 709 },
718 710
719 loadWallpaper_: function() { 711 loadWallpaper_: function() {
720 if (this.focusedPod_) 712 if (this.focusedPod_)
721 chrome.send('userSelectedDelayed', [this.focusedPod_.user.username]); 713 chrome.send('userSelectedDelayed', [this.focusedPod_.user.username]);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 }, 878 },
887 879
888 /** 880 /**
889 * Called right after the pod row is shown. 881 * Called right after the pod row is shown.
890 */ 882 */
891 handleAfterShow: function() { 883 handleAfterShow: function() {
892 // Force input focus for user pod on show and once transition ends. 884 // Force input focus for user pod on show and once transition ends.
893 if (this.focusedPod_) { 885 if (this.focusedPod_) {
894 var focusedPod = this.focusedPod_; 886 var focusedPod = this.focusedPod_;
895 var screen = this.parentNode; 887 var screen = this.parentNode;
888 var self = this;
896 focusedPod.addEventListener('webkitTransitionEnd', function f(e) { 889 focusedPod.addEventListener('webkitTransitionEnd', function f(e) {
897 if (e.target == focusedPod) { 890 if (e.target == focusedPod) {
898 focusedPod.removeEventListener('webkitTransitionEnd', f); 891 focusedPod.removeEventListener('webkitTransitionEnd', f);
899 focusedPod.reset(true); 892 focusedPod.reset(true);
900 // Notify screen that it is ready. 893 // Notify screen that it is ready.
901 screen.onShow(); 894 screen.onShow();
895 // Boot transition: load wallpaper.
896 if (!self.bootWallpaperLoaded_ &&
897 Oobe.getInstance().shouldLoadWallpaperOnBoot()) {
898 self.loadWallpaperTimeout_ = window.setTimeout(
899 self.loadWallpaper_.bind(self), WALLPAPER_BOOT_LOAD_DELAY_MS);
900 self.bootWallpaperLoaded_ = true;
901 }
902 } 902 }
903 }); 903 });
904 } 904 }
905 }, 905 },
906 906
907 /** 907 /**
908 * Called right before the pod row is shown. 908 * Called right before the pod row is shown.
909 */ 909 */
910 handleBeforeShow: function() { 910 handleBeforeShow: function() {
911 for (var event in this.listeners_) { 911 for (var event in this.listeners_) {
(...skipping 22 matching lines...) Expand all
934 handlePodImageLoad: function(pod) { 934 handlePodImageLoad: function(pod) {
935 var index = this.podsWithPendingImages_.indexOf(pod); 935 var index = this.podsWithPendingImages_.indexOf(pod);
936 if (index == -1) { 936 if (index == -1) {
937 return; 937 return;
938 } 938 }
939 939
940 this.podsWithPendingImages_.splice(index, 1); 940 this.podsWithPendingImages_.splice(index, 1);
941 if (this.podsWithPendingImages_.length == 0) { 941 if (this.podsWithPendingImages_.length == 0) {
942 this.classList.remove('images-loading'); 942 this.classList.remove('images-loading');
943 chrome.send('userImagesLoaded'); 943 chrome.send('userImagesLoaded');
944 // Report back user pods being painted.
945 window.webkitRequestAnimationFrame(function() {
946 chrome.send('loginVisible');
947 });
948 } 944 }
949 } 945 }
950 }; 946 };
951 947
952 return { 948 return {
953 PodRow: PodRow 949 PodRow: PodRow
954 }; 950 };
955 }); 951 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698