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

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

Issue 11093025: Merge 160358 - Fix wallpaper change on login screen. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1271/src/
Patch Set: Created 8 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 // Whether this user pod row is shown for the first time. 409 // Whether this user pod row is shown for the first time.
410 firstShown_: true, 410 firstShown_: true,
411 411
412 // Whether the initial wallpaper load after boot has been requested. Used 412 // Whether the initial wallpaper load after boot has been requested. Used
413 // only if |Oobe.getInstance().shouldLoadWallpaperOnBoot()| is true. 413 // only if |Oobe.getInstance().shouldLoadWallpaperOnBoot()| is true.
414 bootWallpaperLoaded_: false, 414 bootWallpaperLoaded_: false,
415 415
416 // True if inside focusPod(). 416 // True if inside focusPod().
417 insideFocusPod_: false, 417 insideFocusPod_: false,
418 418
419 // True if user pod has been activated with keyboard.
420 // In case of activation with keyboard we delay wallpaper change.
421 keyboardActivated_: false,
422
419 // Focused pod. 423 // Focused pod.
420 focusedPod_: undefined, 424 focusedPod_: undefined,
421 425
422 // Activated pod, i.e. the pod of current login attempt. 426 // Activated pod, i.e. the pod of current login attempt.
423 activatedPod_: undefined, 427 activatedPod_: undefined,
424 428
425 // When moving through users quickly at login screen, set a timeout to 429 // When moving through users quickly at login screen, set a timeout to
426 // prevent loading intermediate wallpapers. 430 // prevent loading intermediate wallpapers.
427 loadWallpaperTimeout_: null, 431 loadWallpaperTimeout_: null,
428 432
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 return this.focusedPod_ == pod; 621 return this.focusedPod_ == pod;
618 }, 622 },
619 623
620 /** 624 /**
621 * Focuses a given user pod or clear focus when given null. 625 * Focuses a given user pod or clear focus when given null.
622 * @param {UserPod=} podToFocus User pod to focus (undefined clears focus). 626 * @param {UserPod=} podToFocus User pod to focus (undefined clears focus).
623 * @param {boolean=} opt_force If true, forces focus update even when 627 * @param {boolean=} opt_force If true, forces focus update even when
624 * podToFocus is already focused. 628 * podToFocus is already focused.
625 */ 629 */
626 focusPod: function(podToFocus, opt_force) { 630 focusPod: function(podToFocus, opt_force) {
627 if (this.isFocused(podToFocus) && !opt_force) 631 if (this.isFocused(podToFocus) && !opt_force) {
632 this.keyboardActivated_ = false;
628 return; 633 return;
634 }
629 635
630 // Make sure there's only one focusPod operation happening at a time. 636 // Make sure there's only one focusPod operation happening at a time.
631 if (this.insideFocusPod_) 637 if (this.insideFocusPod_) {
638 this.keyboardActivated_ = false;
632 return; 639 return;
640 }
633 this.insideFocusPod_ = true; 641 this.insideFocusPod_ = true;
634 642
635 clearTimeout(this.loadWallpaperTimeout_); 643 clearTimeout(this.loadWallpaperTimeout_);
636 for (var i = 0, pod; pod = this.pods[i]; ++i) { 644 for (var i = 0, pod; pod = this.pods[i]; ++i) {
637 pod.activeRemoveButton = false; 645 pod.activeRemoveButton = false;
638 if (pod != podToFocus) { 646 if (pod != podToFocus) {
639 pod.classList.remove('focused'); 647 pod.classList.remove('focused');
640 pod.classList.remove('faded'); 648 pod.classList.remove('faded');
641 pod.reset(false); 649 pod.reset(false);
642 } 650 }
643 } 651 }
644 652
645 var hadFocus = !!this.focusedPod_; 653 var hadFocus = !!this.focusedPod_;
646 this.focusedPod_ = podToFocus; 654 this.focusedPod_ = podToFocus;
647 if (podToFocus) { 655 if (podToFocus) {
648 podToFocus.classList.remove('faded'); 656 podToFocus.classList.remove('faded');
649 podToFocus.classList.add('focused'); 657 podToFocus.classList.add('focused');
650 podToFocus.reset(true); // Reset and give focus. 658 podToFocus.reset(true); // Reset and give focus.
651 this.scrollPodIntoView(podToFocus); 659 this.scrollPodIntoView(podToFocus);
652 if (hadFocus) { 660 if (hadFocus && this.keyboardActivated_) {
653 // Delay wallpaper loading to let user tab through pods without lag. 661 // Delay wallpaper loading to let user tab through pods without lag.
654 this.loadWallpaperTimeout_ = window.setTimeout( 662 this.loadWallpaperTimeout_ = window.setTimeout(
655 this.loadWallpaper_.bind(this), WALLPAPER_LOAD_DELAY_MS); 663 this.loadWallpaper_.bind(this), WALLPAPER_LOAD_DELAY_MS);
656 } else if (!this.firstShown_) { 664 } else if (!this.firstShown_) {
657 // Load wallpaper immediately if there no pod was focused 665 // Load wallpaper immediately if there no pod was focused
658 // previously, and it is not a boot into user pod list case. 666 // previously, and it is not a boot into user pod list case.
659 this.loadWallpaper_(); 667 this.loadWallpaper_();
660 this.firstShown_ = false;
661 } 668 }
669 this.firstShown_ = false;
662 } else { 670 } else {
663 chrome.send('userDeselected'); 671 chrome.send('userDeselected');
664 } 672 }
665 this.insideFocusPod_ = false; 673 this.insideFocusPod_ = false;
674 this.keyboardActivated_ = false;
666 }, 675 },
667 676
668 loadWallpaper_: function() { 677 loadWallpaper_: function() {
669 if (this.focusedPod_) 678 if (this.focusedPod_)
670 chrome.send('userSelectedDelayed', [this.focusedPod_.user.username]); 679 chrome.send('userSelectedDelayed', [this.focusedPod_.user.username]);
671 }, 680 },
672 681
673 /** 682 /**
674 * Returns the currently activated pod. 683 * Returns the currently activated pod.
675 * @type {UserPod} 684 * @type {UserPod}
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 * Handler of keydown event. 806 * Handler of keydown event.
798 * @param {Event} e KeyDown Event object. 807 * @param {Event} e KeyDown Event object.
799 */ 808 */
800 handleKeyDown: function(e) { 809 handleKeyDown: function(e) {
801 if (this.disabled) 810 if (this.disabled)
802 return; 811 return;
803 var editing = e.target.tagName == 'INPUT' && e.target.value; 812 var editing = e.target.tagName == 'INPUT' && e.target.value;
804 switch (e.keyIdentifier) { 813 switch (e.keyIdentifier) {
805 case 'Left': 814 case 'Left':
806 if (!editing) { 815 if (!editing) {
816 this.keyboardActivated_ = true;
807 if (this.focusedPod_ && this.focusedPod_.previousElementSibling) 817 if (this.focusedPod_ && this.focusedPod_.previousElementSibling)
808 this.focusPod(this.focusedPod_.previousElementSibling); 818 this.focusPod(this.focusedPod_.previousElementSibling);
809 else 819 else
810 this.focusPod(this.lastElementChild); 820 this.focusPod(this.lastElementChild);
811 821
812 e.stopPropagation(); 822 e.stopPropagation();
813 } 823 }
814 break; 824 break;
815 case 'Right': 825 case 'Right':
816 if (!editing) { 826 if (!editing) {
827 this.keyboardActivated_ = true;
817 if (this.focusedPod_ && this.focusedPod_.nextElementSibling) 828 if (this.focusedPod_ && this.focusedPod_.nextElementSibling)
818 this.focusPod(this.focusedPod_.nextElementSibling); 829 this.focusPod(this.focusedPod_.nextElementSibling);
819 else 830 else
820 this.focusPod(this.firstElementChild); 831 this.focusPod(this.firstElementChild);
821 832
822 e.stopPropagation(); 833 e.stopPropagation();
823 } 834 }
824 break; 835 break;
825 case 'Enter': 836 case 'Enter':
826 if (this.focusedPod_) { 837 if (this.focusedPod_) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 this.classList.remove('images-loading'); 910 this.classList.remove('images-loading');
900 chrome.send('userImagesLoaded'); 911 chrome.send('userImagesLoaded');
901 } 912 }
902 } 913 }
903 }; 914 };
904 915
905 return { 916 return {
906 PodRow: PodRow 917 PodRow: PodRow
907 }; 918 };
908 }); 919 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698