| OLD | NEW |
| 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 2984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2995 * @type {?UserPod} | 2995 * @type {?UserPod} |
| 2996 */ | 2996 */ |
| 2997 get preselectedPod() { | 2997 get preselectedPod() { |
| 2998 var isDesktopUserManager = Oobe.getInstance().displayType == | 2998 var isDesktopUserManager = Oobe.getInstance().displayType == |
| 2999 DISPLAY_TYPE.DESKTOP_USER_MANAGER; | 2999 DISPLAY_TYPE.DESKTOP_USER_MANAGER; |
| 3000 if (isDesktopUserManager) { | 3000 if (isDesktopUserManager) { |
| 3001 // On desktop, don't pre-select a pod if it's the only one. | 3001 // On desktop, don't pre-select a pod if it's the only one. |
| 3002 if (this.pods.length == 1) | 3002 if (this.pods.length == 1) |
| 3003 return null; | 3003 return null; |
| 3004 | 3004 |
| 3005 // The desktop User Manager can send the index of a pod that should be | 3005 // The desktop User Manager can send an URI encoded profile path in the |
| 3006 // initially focused in url hash. | 3006 // url hash, that indicates a pod that should be initially focused. |
| 3007 var podIndex = parseInt(window.location.hash.substr(1)); | 3007 var focusedProfilePath = |
| 3008 if (isNaN(podIndex) || podIndex >= this.pods.length) | 3008 decodeURIComponent(window.location.hash.substr(1)); |
| 3009 return null; | 3009 for (var i = 0, pod; pod = this.pods[i]; ++i) { |
| 3010 return this.pods[podIndex]; | 3010 if (focusedProfilePath === pod.user.profilePath) |
| 3011 return pod; |
| 3012 } |
| 3013 return null; |
| 3011 } | 3014 } |
| 3012 | 3015 |
| 3013 var lockedPod = this.lockedPod; | 3016 var lockedPod = this.lockedPod; |
| 3014 if (lockedPod) | 3017 if (lockedPod) |
| 3015 return lockedPod; | 3018 return lockedPod; |
| 3016 for (var i = 0, pod; pod = this.pods[i]; ++i) { | 3019 for (i = 0; pod = this.pods[i]; ++i) { |
| 3017 if (!pod.multiProfilesPolicyApplied) { | 3020 if (!pod.multiProfilesPolicyApplied) |
| 3018 return pod; | 3021 return pod; |
| 3019 } | |
| 3020 } | 3022 } |
| 3021 return this.pods[0]; | 3023 return this.pods[0]; |
| 3022 }, | 3024 }, |
| 3023 | 3025 |
| 3024 /** | 3026 /** |
| 3025 * Resets input UI. | 3027 * Resets input UI. |
| 3026 * @param {boolean} takeFocus True to take focus. | 3028 * @param {boolean} takeFocus True to take focus. |
| 3027 */ | 3029 */ |
| 3028 reset: function(takeFocus) { | 3030 reset: function(takeFocus) { |
| 3029 this.disabled = false; | 3031 this.disabled = false; |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3320 if (pod && pod.multiProfilesPolicyApplied) { | 3322 if (pod && pod.multiProfilesPolicyApplied) { |
| 3321 pod.userTypeBubbleElement.classList.remove('bubble-shown'); | 3323 pod.userTypeBubbleElement.classList.remove('bubble-shown'); |
| 3322 } | 3324 } |
| 3323 } | 3325 } |
| 3324 }; | 3326 }; |
| 3325 | 3327 |
| 3326 return { | 3328 return { |
| 3327 PodRow: PodRow | 3329 PodRow: PodRow |
| 3328 }; | 3330 }; |
| 3329 }); | 3331 }); |
| OLD | NEW |