Chromium Code Reviews| Index: ui/login/account_picker/user_pod_row.js |
| diff --git a/ui/login/account_picker/user_pod_row.js b/ui/login/account_picker/user_pod_row.js |
| index c36496d08a4a503ebf0f7d286d8951430160ce45..31083eaa22817ed23790f78c240942c7825a03fc 100644 |
| --- a/ui/login/account_picker/user_pod_row.js |
| +++ b/ui/login/account_picker/user_pod_row.js |
| @@ -2995,6 +2995,7 @@ cr.define('login', function() { |
| * @type {?UserPod} |
| */ |
| get preselectedPod() { |
| + var i, pod; |
| var isDesktopUserManager = Oobe.getInstance().displayType == |
| DISPLAY_TYPE.DESKTOP_USER_MANAGER; |
| if (isDesktopUserManager) { |
| @@ -3002,21 +3003,23 @@ cr.define('login', function() { |
| if (this.pods.length == 1) |
| return null; |
| - // The desktop User Manager can send the index of a pod that should be |
| - // initially focused in url hash. |
| - var podIndex = parseInt(window.location.hash.substr(1)); |
| - if (isNaN(podIndex) || podIndex >= this.pods.length) |
| - return null; |
| - return this.pods[podIndex]; |
| + // The desktop User Manager can send an URI encoded profile path in the |
| + // url hash, that indicates a pod that should be initially focused. |
| + var focusedProfilePath = |
| + decodeURIComponent(window.location.hash.substr(1)); |
| + 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
|
| + if (focusedProfilePath === pod.user.profilePath) |
| + return pod; |
| + } |
| + return null; |
| } |
| var lockedPod = this.lockedPod; |
| if (lockedPod) |
| return lockedPod; |
| - for (var i = 0, pod; pod = this.pods[i]; ++i) { |
| - if (!pod.multiProfilesPolicyApplied) { |
| + for (i = 0; pod = this.pods[i]; ++i) { |
| + if (!pod.multiProfilesPolicyApplied) |
| return pod; |
| - } |
| } |
| return this.pods[0]; |
| }, |