OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 */ | 50 */ |
51 var POD_ROW_IMAGES_LOAD_TIMEOUT_MS = 3000; | 51 var POD_ROW_IMAGES_LOAD_TIMEOUT_MS = 3000; |
52 | 52 |
53 /** | 53 /** |
54 * Oauth token status. These must match UserManager::OAuthTokenStatus. | 54 * Oauth token status. These must match UserManager::OAuthTokenStatus. |
55 * @enum {number} | 55 * @enum {number} |
56 * @const | 56 * @const |
57 */ | 57 */ |
58 var OAuthTokenStatus = { | 58 var OAuthTokenStatus = { |
59 UNKNOWN: 0, | 59 UNKNOWN: 0, |
60 INVALID: 1, | 60 INVALID_OLD: 1, |
61 VALID: 2 | 61 VALID_OLD: 2, |
| 62 INVALID_NEW: 3, |
| 63 VALID_NEW: 4 |
62 }; | 64 }; |
63 | 65 |
64 /** | 66 /** |
65 * Tab order for user pods. Update these when adding new controls. | 67 * Tab order for user pods. Update these when adding new controls. |
66 * @enum {number} | 68 * @enum {number} |
67 * @const | 69 * @const |
68 */ | 70 */ |
69 var UserPodTabOrder = { | 71 var UserPodTabOrder = { |
70 POD_INPUT: 1, // Password input fields (and whole pods themselves). | 72 POD_INPUT: 1, // Password input fields (and whole pods themselves). |
71 HEADER_BAR: 2, // Buttons on the header bar (Shutdown, Add User). | 73 HEADER_BAR: 2, // Buttons on the header bar (Shutdown, Add User). |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 this.user_ = userDict; | 272 this.user_ = userDict; |
271 this.update(); | 273 this.update(); |
272 }, | 274 }, |
273 | 275 |
274 /** | 276 /** |
275 * Whether Gaia signin is required for this user. | 277 * Whether Gaia signin is required for this user. |
276 */ | 278 */ |
277 get needGaiaSignin() { | 279 get needGaiaSignin() { |
278 // Gaia signin is performed if the user has an invalid oauth token and is | 280 // Gaia signin is performed if the user has an invalid oauth token and is |
279 // not currently signed in (i.e. not the lock screen). | 281 // not currently signed in (i.e. not the lock screen). |
280 return this.user.oauthTokenStatus != OAuthTokenStatus.VALID && | 282 return this.user.oauthTokenStatus != OAuthTokenStatus.VALID_OLD && |
| 283 this.user.oauthTokenStatus != OAuthTokenStatus.VALID_NEW && |
281 !this.user.signedIn; | 284 !this.user.signedIn; |
282 }, | 285 }, |
283 | 286 |
284 /** | 287 /** |
285 * Gets main input element. | 288 * Gets main input element. |
286 * @type {(HTMLButtonElement|HTMLInputElement)} | 289 * @type {(HTMLButtonElement|HTMLInputElement)} |
287 */ | 290 */ |
288 get mainInput() { | 291 get mainInput() { |
289 if (!this.signinButtonElement.hidden) | 292 if (!this.signinButtonElement.hidden) |
290 return this.signinButtonElement; | 293 return this.signinButtonElement; |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 pod.updateUserImage(); | 968 pod.updateUserImage(); |
966 }, | 969 }, |
967 | 970 |
968 /** | 971 /** |
969 * Resets OAuth token status (invalidates it). | 972 * Resets OAuth token status (invalidates it). |
970 * @param {string} username User for which to reset the status. | 973 * @param {string} username User for which to reset the status. |
971 */ | 974 */ |
972 resetUserOAuthTokenStatus: function(username) { | 975 resetUserOAuthTokenStatus: function(username) { |
973 var pod = this.getPodWithUsername_(username); | 976 var pod = this.getPodWithUsername_(username); |
974 if (pod) { | 977 if (pod) { |
975 pod.user.oauthTokenStatus = OAuthTokenStatus.INVALID; | 978 pod.user.oauthTokenStatus = OAuthTokenStatus.INVALID_OLD; |
976 pod.update(); | 979 pod.update(); |
977 } else { | 980 } else { |
978 console.log('Failed to update Gaia state for: ' + username); | 981 console.log('Failed to update Gaia state for: ' + username); |
979 } | 982 } |
980 }, | 983 }, |
981 | 984 |
982 /** | 985 /** |
983 * Handler of click event. | 986 * Handler of click event. |
984 * @param {Event} e Click Event object. | 987 * @param {Event} e Click Event object. |
985 * @private | 988 * @private |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 this.classList.remove('images-loading'); | 1148 this.classList.remove('images-loading'); |
1146 chrome.send('userImagesLoaded'); | 1149 chrome.send('userImagesLoaded'); |
1147 } | 1150 } |
1148 } | 1151 } |
1149 }; | 1152 }; |
1150 | 1153 |
1151 return { | 1154 return { |
1152 PodRow: PodRow | 1155 PodRow: PodRow |
1153 }; | 1156 }; |
1154 }); | 1157 }); |
OLD | NEW |