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

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: Fix typo and nits 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
« no previous file with comments | « chrome/test/data/webui/profile_window_browsertest.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..eae6f1015017d6bc0f1803201103003b7d3f45ff 100644
--- a/ui/login/account_picker/user_pod_row.js
+++ b/ui/login/account_picker/user_pod_row.js
@@ -3002,21 +3002,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 (var i = 0, pod; pod = this.pods[i]; ++i) {
+ 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];
},
« no previous file with comments | « chrome/test/data/webui/profile_window_browsertest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698