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

Unified 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 side-by-side diff with in-line comments
Download patch
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];
},

Powered by Google App Engine
This is Rietveld 408576698