| 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 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1923 // parent object, and add duplicate event listeners. | 1923 // parent object, and add duplicate event listeners. |
| 1924 var node = $('user-pod-template').cloneNode(true); | 1924 var node = $('user-pod-template').cloneNode(true); |
| 1925 node.removeAttribute('id'); | 1925 node.removeAttribute('id'); |
| 1926 return node; | 1926 return node; |
| 1927 }); | 1927 }); |
| 1928 | 1928 |
| 1929 DesktopUserPod.prototype = { | 1929 DesktopUserPod.prototype = { |
| 1930 __proto__: UserPod.prototype, | 1930 __proto__: UserPod.prototype, |
| 1931 | 1931 |
| 1932 /** @override */ | 1932 /** @override */ |
| 1933 get mainInput() { | 1933 initialize: function() { |
| 1934 if (this.user.needsSignin) | 1934 if (this.user.needsSignin) { |
| 1935 return this.passwordElement; | 1935 if (this.user.hasLocalCreds) { |
| 1936 else | 1936 this.user.initialAuthType = AUTH_TYPE.OFFLINE_PASSWORD; |
| 1937 return this.nameElement; | 1937 } else { |
| 1938 this.user.initialAuthType = AUTH_TYPE.ONLINE_SIGN_IN; |
| 1939 } |
| 1940 } |
| 1941 UserPod.prototype.initialize.call(this); |
| 1938 }, | 1942 }, |
| 1939 | 1943 |
| 1940 /** @override */ | 1944 /** @override */ |
| 1941 update: function() { | 1945 update: function() { |
| 1942 this.imageElement.src = this.user.userImage; | 1946 this.imageElement.src = this.user.userImage; |
| 1943 this.nameElement.textContent = this.user.displayName; | 1947 this.nameElement.textContent = this.user.displayName; |
| 1944 this.reauthNameHintElement.textContent = this.user.displayName; | 1948 this.reauthNameHintElement.textContent = this.user.displayName; |
| 1945 | 1949 |
| 1946 var isLockedUser = this.user.needsSignin; | 1950 var isLockedUser = this.user.needsSignin; |
| 1947 var isLegacySupervisedUser = this.user.legacySupervisedUser; | 1951 var isLegacySupervisedUser = this.user.legacySupervisedUser; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1958 this.actionBoxRemoveLegacySupervisedUserWarningTextElement.hidden = | 1962 this.actionBoxRemoveLegacySupervisedUserWarningTextElement.hidden = |
| 1959 !isLegacySupervisedUser; | 1963 !isLegacySupervisedUser; |
| 1960 | 1964 |
| 1961 this.passwordElement.setAttribute('aria-label', loadTimeData.getStringF( | 1965 this.passwordElement.setAttribute('aria-label', loadTimeData.getStringF( |
| 1962 'passwordFieldAccessibleName', this.user_.emailAddress)); | 1966 'passwordFieldAccessibleName', this.user_.emailAddress)); |
| 1963 | 1967 |
| 1964 UserPod.prototype.updateActionBoxArea.call(this); | 1968 UserPod.prototype.updateActionBoxArea.call(this); |
| 1965 }, | 1969 }, |
| 1966 | 1970 |
| 1967 /** @override */ | 1971 /** @override */ |
| 1968 focusInput: function() { | |
| 1969 // Move tabIndex from the whole pod to the main input. | |
| 1970 this.tabIndex = -1; | |
| 1971 this.mainInput.tabIndex = UserPodTabOrder.POD_INPUT; | |
| 1972 this.mainInput.focus(); | |
| 1973 }, | |
| 1974 | |
| 1975 /** @override */ | |
| 1976 activate: function(e) { | 1972 activate: function(e) { |
| 1977 if (!this.user.needsSignin) { | 1973 if (!this.user.needsSignin) { |
| 1978 Oobe.launchUser(this.user.profilePath); | 1974 Oobe.launchUser(this.user.profilePath); |
| 1979 } else if (!this.passwordElement.value) { | 1975 } else if (this.user.hasLocalCreds && !this.passwordElement.value) { |
| 1980 return false; | 1976 return false; |
| 1981 } else { | 1977 } else { |
| 1982 chrome.send('authenticatedLaunchUser', | 1978 chrome.send('authenticatedLaunchUser', |
| 1983 [this.user.profilePath, | 1979 [this.user.profilePath, |
| 1984 this.user.emailAddress, | 1980 this.user.emailAddress, |
| 1985 this.passwordElement.value]); | 1981 this.passwordElement.value]); |
| 1986 } | 1982 } |
| 1987 this.passwordElement.value = ''; | 1983 this.passwordElement.value = ''; |
| 1988 return true; | 1984 return true; |
| 1989 }, | 1985 }, |
| 1990 | 1986 |
| 1991 /** @override */ | 1987 /** @override */ |
| 1992 handleClickOnPod_: function(e) { | 1988 handleClickOnPod_: function(e) { |
| 1993 if (this.parentNode.disabled) | 1989 if (this.parentNode.disabled) |
| 1994 return; | 1990 return; |
| 1995 | 1991 |
| 1996 Oobe.clearErrors(); | 1992 Oobe.clearErrors(); |
| 1997 this.parentNode.lastFocusedPod_ = this; | 1993 this.parentNode.lastFocusedPod_ = this; |
| 1998 | 1994 |
| 1999 // If this is an unlocked pod, then open a browser window. Otherwise | 1995 // If this is a locked pod and there are local credentials, show the |
| 2000 // just activate the pod and show the password field. | 1996 // password field. Otherwise call activate() which will open up a browser |
| 2001 if (!this.user.needsSignin && !this.isActionBoxMenuActive) | 1997 // window or show the reauth dialog, as needed. |
| 1998 if (!(this.user.needsSignin && this.user.hasLocalCreds) && |
| 1999 !this.isActionBoxMenuActive) { |
| 2002 this.activate(e); | 2000 this.activate(e); |
| 2001 } |
| 2003 | 2002 |
| 2004 if (this.isAuthTypeUserClick) | 2003 if (this.isAuthTypeUserClick) |
| 2005 chrome.send('attemptUnlock', [this.user.emailAddress]); | 2004 chrome.send('attemptUnlock', [this.user.emailAddress]); |
| 2006 }, | 2005 }, |
| 2007 }; | 2006 }; |
| 2008 | 2007 |
| 2009 /** | 2008 /** |
| 2010 * Creates a user pod that represents kiosk app. | 2009 * Creates a user pod that represents kiosk app. |
| 2011 * @constructor | 2010 * @constructor |
| 2012 * @extends {UserPod} | 2011 * @extends {UserPod} |
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3174 if (pod && pod.multiProfilesPolicyApplied) { | 3173 if (pod && pod.multiProfilesPolicyApplied) { |
| 3175 pod.userTypeBubbleElement.classList.remove('bubble-shown'); | 3174 pod.userTypeBubbleElement.classList.remove('bubble-shown'); |
| 3176 } | 3175 } |
| 3177 } | 3176 } |
| 3178 }; | 3177 }; |
| 3179 | 3178 |
| 3180 return { | 3179 return { |
| 3181 PodRow: PodRow | 3180 PodRow: PodRow |
| 3182 }; | 3181 }; |
| 3183 }); | 3182 }); |
| OLD | NEW |