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

Side by Side Diff: ui/login/account_picker/user_pod_row.js

Issue 488563002: Desktop user manager focuses correct pod on load. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Do not focus first pod by default. Created 6 years, 4 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 | « ui/login/account_picker/screen_account_picker.js ('k') | 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 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
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
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
2682 // The desktop User Manager can send the index of a pod that should be
2683 // initially focused in url hash.
2684 var podIndex = parseInt(window.location.hash.substr(1));
2685 if (isNaN(podIndex) || podIndex >= this.pods.length)
2686 return null;
2687 return this.pods[podIndex];
2688 }
2691 2689
2692 var lockedPod = this.lockedPod; 2690 var lockedPod = this.lockedPod;
2693 if (lockedPod) 2691 if (lockedPod)
2694 return lockedPod; 2692 return lockedPod;
2695 for (var i = 0, pod; pod = this.pods[i]; ++i) { 2693 for (var i = 0, pod; pod = this.pods[i]; ++i) {
2696 if (!pod.multiProfilesPolicyApplied) { 2694 if (!pod.multiProfilesPolicyApplied) {
2697 return pod; 2695 return pod;
2698 } 2696 }
2699 } 2697 }
2700 return this.pods[0]; 2698 return this.pods[0];
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
2989 if (pod && pod.multiProfilesPolicyApplied) { 2987 if (pod && pod.multiProfilesPolicyApplied) {
2990 pod.userTypeBubbleElement.classList.remove('bubble-shown'); 2988 pod.userTypeBubbleElement.classList.remove('bubble-shown');
2991 } 2989 }
2992 } 2990 }
2993 }; 2991 };
2994 2992
2995 return { 2993 return {
2996 PodRow: PodRow 2994 PodRow: PodRow
2997 }; 2995 };
2998 }); 2996 });
OLDNEW
« no previous file with comments | « ui/login/account_picker/screen_account_picker.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698