Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2623 this.lastFocusedPod_ = podToFocus; | 2623 this.lastFocusedPod_ = podToFocus; |
| 2624 | 2624 |
| 2625 if (Oobe.getInstance().virtualKeyboardShown) | 2625 if (Oobe.getInstance().virtualKeyboardShown) |
| 2626 this.scrollFocusedPodIntoView(); | 2626 this.scrollFocusedPodIntoView(); |
| 2627 } | 2627 } |
| 2628 this.insideFocusPod_ = false; | 2628 this.insideFocusPod_ = false; |
| 2629 this.keyboardActivated_ = false; | 2629 this.keyboardActivated_ = false; |
| 2630 }, | 2630 }, |
| 2631 | 2631 |
| 2632 /** | 2632 /** |
| 2633 * Focuses a given user pod by index or clear focus when given null. | |
| 2634 * @param {int=} podToFocus index of User pod to focus. | |
| 2635 * @param {boolean=} opt_force If true, forces focus update even when | |
| 2636 * podToFocus is already focused. | |
| 2637 */ | |
| 2638 focusPodByIndex: function(podToFocus, opt_force) { | |
| 2639 if (podToFocus < this.pods.length) | |
| 2640 this.focusPod(this.pods[podToFocus], opt_force); | |
| 2641 }, | |
| 2642 | |
| 2643 /** | |
| 2644 * Resets wallpaper to the last active user's wallpaper, if any. | 2633 * Resets wallpaper to the last active user's wallpaper, if any. |
| 2645 */ | 2634 */ |
| 2646 loadLastWallpaper: function() { | 2635 loadLastWallpaper: function() { |
| 2647 if (this.lastFocusedPod_ && !this.lastFocusedPod_.user.isApp) | 2636 if (this.lastFocusedPod_ && !this.lastFocusedPod_.user.isApp) |
| 2648 chrome.send('loadWallpaper', [this.lastFocusedPod_.user.username]); | 2637 chrome.send('loadWallpaper', [this.lastFocusedPod_.user.username]); |
| 2649 }, | 2638 }, |
| 2650 | 2639 |
| 2651 /** | 2640 /** |
| 2652 * Returns the currently activated pod. | 2641 * Returns the currently activated pod. |
| 2653 * @type {UserPod} | 2642 * @type {UserPod} |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 2676 return pod; | 2665 return pod; |
| 2677 } | 2666 } |
| 2678 return null; | 2667 return null; |
| 2679 }, | 2668 }, |
| 2680 | 2669 |
| 2681 /** | 2670 /** |
| 2682 * The pod that is preselected on user pod row show. | 2671 * The pod that is preselected on user pod row show. |
| 2683 * @type {?UserPod} | 2672 * @type {?UserPod} |
| 2684 */ | 2673 */ |
| 2685 get preselectedPod() { | 2674 get preselectedPod() { |
| 2686 // On desktop, don't pre-select a pod if it's the only one. | |
| 2687 var isDesktopUserManager = Oobe.getInstance().displayType == | 2675 var isDesktopUserManager = Oobe.getInstance().displayType == |
| 2688 DISPLAY_TYPE.DESKTOP_USER_MANAGER; | 2676 DISPLAY_TYPE.DESKTOP_USER_MANAGER; |
| 2689 if (isDesktopUserManager && this.pods.length == 1) | 2677 if (isDesktopUserManager) { |
| 2690 return null; | 2678 // On desktop, don't pre-select a pod if it's the only one. |
| 2679 if (this.pods.length == 1) | |
| 2680 return null; | |
| 2681 // The desktop User Manager can send the index of a pod that should be | |
| 2682 // initially focused in url hash. | |
| 2683 var podIndex = parseInt(window.location.hash.substr(1)); | |
| 2684 if (!isNaN(podIndex) && podIndex < this.pods.length) | |
| 2685 return this.pods[podIndex]; | |
|
noms (inactive)
2014/08/19 14:40:07
I would actually return null on the desktop if we
| |
| 2686 } | |
| 2691 | 2687 |
| 2692 var lockedPod = this.lockedPod; | 2688 var lockedPod = this.lockedPod; |
| 2693 if (lockedPod) | 2689 if (lockedPod) |
| 2694 return lockedPod; | 2690 return lockedPod; |
| 2695 for (var i = 0, pod; pod = this.pods[i]; ++i) { | 2691 for (var i = 0, pod; pod = this.pods[i]; ++i) { |
| 2696 if (!pod.multiProfilesPolicyApplied) { | 2692 if (!pod.multiProfilesPolicyApplied) { |
| 2697 return pod; | 2693 return pod; |
| 2698 } | 2694 } |
| 2699 } | 2695 } |
| 2700 return this.pods[0]; | 2696 return this.pods[0]; |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2989 if (pod && pod.multiProfilesPolicyApplied) { | 2985 if (pod && pod.multiProfilesPolicyApplied) { |
| 2990 pod.userTypeBubbleElement.classList.remove('bubble-shown'); | 2986 pod.userTypeBubbleElement.classList.remove('bubble-shown'); |
| 2991 } | 2987 } |
| 2992 } | 2988 } |
| 2993 }; | 2989 }; |
| 2994 | 2990 |
| 2995 return { | 2991 return { |
| 2996 PodRow: PodRow | 2992 PodRow: PodRow |
| 2997 }; | 2993 }; |
| 2998 }); | 2994 }); |
| OLD | NEW |