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

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

Issue 1828143002: Profile path is sent instead of an index to focus a user pod (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add new tests for checking regression. Created 4 years, 9 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
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 2977 matching lines...) Expand 10 before | Expand all | Expand 10 after
2988 return pod; 2988 return pod;
2989 } 2989 }
2990 return null; 2990 return null;
2991 }, 2991 },
2992 2992
2993 /** 2993 /**
2994 * The pod that is preselected on user pod row show. 2994 * The pod that is preselected on user pod row show.
2995 * @type {?UserPod} 2995 * @type {?UserPod}
2996 */ 2996 */
2997 get preselectedPod() { 2997 get preselectedPod() {
2998 var i, pod;
2998 var isDesktopUserManager = Oobe.getInstance().displayType == 2999 var isDesktopUserManager = Oobe.getInstance().displayType ==
2999 DISPLAY_TYPE.DESKTOP_USER_MANAGER; 3000 DISPLAY_TYPE.DESKTOP_USER_MANAGER;
3000 if (isDesktopUserManager) { 3001 if (isDesktopUserManager) {
3001 // On desktop, don't pre-select a pod if it's the only one. 3002 // On desktop, don't pre-select a pod if it's the only one.
3002 if (this.pods.length == 1) 3003 if (this.pods.length == 1)
3003 return null; 3004 return null;
3004 3005
3005 // The desktop User Manager can send the index of a pod that should be 3006 // The desktop User Manager can send an URI encoded profile path in the
3006 // initially focused in url hash. 3007 // url hash, that indicates a pod that should be initially focused.
3007 var podIndex = parseInt(window.location.hash.substr(1)); 3008 var focusedProfilePath =
3008 if (isNaN(podIndex) || podIndex >= this.pods.length) 3009 decodeURIComponent(window.location.hash.substr(1));
3009 return null; 3010 for (i = 0; pod = this.pods[i]; ++i) {
Dan Beam 2016/03/30 17:53:29 nit: i would just put for (var i = 0, pod; ...
lwchkg 2016/03/31 14:48:16 Done. However I do worry about non-JS coders think
3010 return this.pods[podIndex]; 3011 if (focusedProfilePath === pod.user.profilePath)
3012 return pod;
3013 }
3014 return null;
3011 } 3015 }
3012 3016
3013 var lockedPod = this.lockedPod; 3017 var lockedPod = this.lockedPod;
3014 if (lockedPod) 3018 if (lockedPod)
3015 return lockedPod; 3019 return lockedPod;
3016 for (var i = 0, pod; pod = this.pods[i]; ++i) { 3020 for (i = 0; pod = this.pods[i]; ++i) {
3017 if (!pod.multiProfilesPolicyApplied) { 3021 if (!pod.multiProfilesPolicyApplied)
3018 return pod; 3022 return pod;
3019 }
3020 } 3023 }
3021 return this.pods[0]; 3024 return this.pods[0];
3022 }, 3025 },
3023 3026
3024 /** 3027 /**
3025 * Resets input UI. 3028 * Resets input UI.
3026 * @param {boolean} takeFocus True to take focus. 3029 * @param {boolean} takeFocus True to take focus.
3027 */ 3030 */
3028 reset: function(takeFocus) { 3031 reset: function(takeFocus) {
3029 this.disabled = false; 3032 this.disabled = false;
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
3320 if (pod && pod.multiProfilesPolicyApplied) { 3323 if (pod && pod.multiProfilesPolicyApplied) {
3321 pod.userTypeBubbleElement.classList.remove('bubble-shown'); 3324 pod.userTypeBubbleElement.classList.remove('bubble-shown');
3322 } 3325 }
3323 } 3326 }
3324 }; 3327 };
3325 3328
3326 return { 3329 return {
3327 PodRow: PodRow 3330 PodRow: PodRow
3328 }; 3331 };
3329 }); 3332 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698