OLD | NEW |
---|---|
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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
419 // True if user pod has been activated with keyboard. | 419 // True if user pod has been activated with keyboard. |
420 // In case of activation with keyboard we delay wallpaper change. | 420 // In case of activation with keyboard we delay wallpaper change. |
421 keyboardActivated_: false, | 421 keyboardActivated_: false, |
422 | 422 |
423 // Focused pod. | 423 // Focused pod. |
424 focusedPod_: undefined, | 424 focusedPod_: undefined, |
425 | 425 |
426 // Activated pod, i.e. the pod of current login attempt. | 426 // Activated pod, i.e. the pod of current login attempt. |
427 activatedPod_: undefined, | 427 activatedPod_: undefined, |
428 | 428 |
429 // Pod that was most recently focused, if any. | |
430 lastFocusedPod_: undefined, | |
Nikita (slow)
2012/10/17 14:51:03
You should probably clear that if user is deleted?
Ivan Korotkov
2012/10/17 15:34:10
Done.
| |
431 | |
429 // When moving through users quickly at login screen, set a timeout to | 432 // When moving through users quickly at login screen, set a timeout to |
430 // prevent loading intermediate wallpapers. | 433 // prevent loading intermediate wallpapers. |
431 loadWallpaperTimeout_: null, | 434 loadWallpaperTimeout_: null, |
432 | 435 |
433 // Pods whose initial images haven't been loaded yet. | 436 // Pods whose initial images haven't been loaded yet. |
434 podsWithPendingImages_: [], | 437 podsWithPendingImages_: [], |
435 | 438 |
436 /** @inheritDoc */ | 439 /** @inheritDoc */ |
437 decorate: function() { | 440 decorate: function() { |
438 this.style.left = 0; | 441 this.style.left = 0; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
660 if (hadFocus && this.keyboardActivated_) { | 663 if (hadFocus && this.keyboardActivated_) { |
661 // Delay wallpaper loading to let user tab through pods without lag. | 664 // Delay wallpaper loading to let user tab through pods without lag. |
662 this.loadWallpaperTimeout_ = window.setTimeout( | 665 this.loadWallpaperTimeout_ = window.setTimeout( |
663 this.loadWallpaper_.bind(this), WALLPAPER_LOAD_DELAY_MS); | 666 this.loadWallpaper_.bind(this), WALLPAPER_LOAD_DELAY_MS); |
664 } else if (!this.firstShown_) { | 667 } else if (!this.firstShown_) { |
665 // Load wallpaper immediately if there no pod was focused | 668 // Load wallpaper immediately if there no pod was focused |
666 // previously, and it is not a boot into user pod list case. | 669 // previously, and it is not a boot into user pod list case. |
667 this.loadWallpaper_(); | 670 this.loadWallpaper_(); |
668 } | 671 } |
669 this.firstShown_ = false; | 672 this.firstShown_ = false; |
670 } else { | 673 this.lastFocusedPod_ = podToFocus; |
671 chrome.send('userDeselected'); | |
672 } | 674 } |
673 this.insideFocusPod_ = false; | 675 this.insideFocusPod_ = false; |
674 this.keyboardActivated_ = false; | 676 this.keyboardActivated_ = false; |
675 }, | 677 }, |
676 | 678 |
679 /** | |
680 * Loads wallpaper for the active user pod, if any. | |
681 */ | |
677 loadWallpaper_: function() { | 682 loadWallpaper_: function() { |
678 if (this.focusedPod_) | 683 if (this.focusedPod_) |
679 chrome.send('userSelectedDelayed', [this.focusedPod_.user.username]); | 684 chrome.send('loadWallpaper', [this.focusedPod_.user.username]); |
680 }, | 685 }, |
681 | 686 |
682 /** | 687 /** |
688 * Resets wallpaper to the last active user's wallpaper, if any. | |
689 */ | |
690 loadLastWallpaper_: function() { | |
691 if (this.lastFocusedPod_) | |
692 chrome.send('loadWallpaper', [this.lastFocusedPod_.user.username]); | |
693 }, | |
694 | |
695 /** | |
683 * Returns the currently activated pod. | 696 * Returns the currently activated pod. |
684 * @type {UserPod} | 697 * @type {UserPod} |
685 */ | 698 */ |
686 get activatedPod() { | 699 get activatedPod() { |
687 return this.activatedPod_; | 700 return this.activatedPod_; |
688 }, | 701 }, |
689 set activatedPod(pod) { | 702 set activatedPod(pod) { |
690 if (pod && pod.activate()) | 703 if (pod && pod.activate()) |
691 this.activatedPod_ = pod; | 704 this.activatedPod_ = pod; |
692 }, | 705 }, |
(...skipping 22 matching lines...) Expand all Loading... | |
715 }, | 728 }, |
716 | 729 |
717 /** | 730 /** |
718 * Resets input UI. | 731 * Resets input UI. |
719 * @param {boolean} takeFocus True to take focus. | 732 * @param {boolean} takeFocus True to take focus. |
720 */ | 733 */ |
721 reset: function(takeFocus) { | 734 reset: function(takeFocus) { |
722 this.disabled = false; | 735 this.disabled = false; |
723 if (this.activatedPod_) | 736 if (this.activatedPod_) |
724 this.activatedPod_.reset(takeFocus); | 737 this.activatedPod_.reset(takeFocus); |
738 this.loadLastWallpaper_(); | |
Nikita (slow)
2012/10/17 14:51:03
I suspect that reset might be called multiple time
bshe
2012/10/17 15:13:50
We will not reload the same built in wallpaper. Bu
Ivan Korotkov
2012/10/17 15:34:10
Fixed, now we only call loadLastWallpaper in respo
| |
725 }, | 739 }, |
726 | 740 |
727 /** | 741 /** |
728 * Shows signin UI. | 742 * Shows signin UI. |
729 * @param {string} email Email for signin UI. | 743 * @param {string} email Email for signin UI. |
730 */ | 744 */ |
731 showSigninUI: function(email) { | 745 showSigninUI: function(email) { |
732 // Clear any error messages that might still be around. | 746 // Clear any error messages that might still be around. |
733 Oobe.clearErrors(); | 747 Oobe.clearErrors(); |
734 this.disabled = true; | 748 this.disabled = true; |
749 this.lastFocusedPod_ = this.getPodWithUsername_(email); | |
735 Oobe.showSigninUI(email); | 750 Oobe.showSigninUI(email); |
736 }, | 751 }, |
737 | 752 |
738 /** | 753 /** |
739 * Updates current image of a user. | 754 * Updates current image of a user. |
740 * @param {string} username User for which to update the image. | 755 * @param {string} username User for which to update the image. |
741 */ | 756 */ |
742 updateUserImage: function(username) { | 757 updateUserImage: function(username) { |
743 var pod = this.getPodWithUsername_(username); | 758 var pod = this.getPodWithUsername_(username); |
744 if (pod) | 759 if (pod) |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
910 this.classList.remove('images-loading'); | 925 this.classList.remove('images-loading'); |
911 chrome.send('userImagesLoaded'); | 926 chrome.send('userImagesLoaded'); |
912 } | 927 } |
913 } | 928 } |
914 }; | 929 }; |
915 | 930 |
916 return { | 931 return { |
917 PodRow: PodRow | 932 PodRow: PodRow |
918 }; | 933 }; |
919 }); | 934 }); |
OLD | NEW |