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 Account picker screen implementation. | 6 * @fileoverview Account picker screen implementation. |
7 */ | 7 */ |
8 | 8 |
9 login.createScreen('AccountPickerScreen', 'account-picker', function() { | 9 login.createScreen('AccountPickerScreen', 'account-picker', function() { |
10 /** | 10 /** |
11 * Maximum number of offline login failures before online login. | 11 * Maximum number of offline login failures before online login. |
12 * @type {number} | 12 * @type {number} |
13 * @const | 13 * @const |
14 */ | 14 */ |
15 var MAX_LOGIN_ATTEMPTS_IN_POD = 3; | 15 var MAX_LOGIN_ATTEMPTS_IN_POD = 3; |
16 /** | 16 /** |
17 * Whether to preselect the first pod automatically on login screen. | 17 * Whether to preselect the first pod automatically on login screen. |
18 * @type {boolean} | 18 * @type {boolean} |
19 * @const | 19 * @const |
20 */ | 20 */ |
21 var PRESELECT_FIRST_POD = true; | 21 var PRESELECT_FIRST_POD = true; |
22 | 22 |
23 return { | 23 return { |
24 EXTERNAL_API: [ | 24 EXTERNAL_API: [ |
25 'loadUsers', | 25 'loadUsers', |
26 'runAppForTesting', | 26 'runAppForTesting', |
27 'setApps', | 27 'setApps', |
28 'showAppError', | 28 'showAppError', |
29 'updateUserImage', | 29 'updateUserImage', |
30 'forceOnlineSignin', | |
31 'setCapsLockState', | 30 'setCapsLockState', |
32 'forceLockedUserPodFocus', | 31 'forceLockedUserPodFocus', |
33 'removeUser', | 32 'removeUser', |
34 'showBannerMessage', | 33 'showBannerMessage', |
35 'showUserPodButton', | 34 'showUserPodButton', |
| 35 'hideUserPodButton', |
| 36 'setAuthType', |
36 ], | 37 ], |
37 | 38 |
38 preferredWidth_: 0, | 39 preferredWidth_: 0, |
39 preferredHeight_: 0, | 40 preferredHeight_: 0, |
40 | 41 |
41 // Whether this screen is shown for the first time. | 42 // Whether this screen is shown for the first time. |
42 firstShown_: true, | 43 firstShown_: true, |
43 | 44 |
44 /** @override */ | 45 /** @override */ |
45 decorate: function() { | 46 decorate: function() { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 220 |
220 /** | 221 /** |
221 * Updates current image of a user. | 222 * Updates current image of a user. |
222 * @param {string} username User for which to update the image. | 223 * @param {string} username User for which to update the image. |
223 */ | 224 */ |
224 updateUserImage: function(username) { | 225 updateUserImage: function(username) { |
225 $('pod-row').updateUserImage(username); | 226 $('pod-row').updateUserImage(username); |
226 }, | 227 }, |
227 | 228 |
228 /** | 229 /** |
229 * Indicates that the given user must authenticate against GAIA during the | |
230 * next sign-in. | |
231 * @param {string} username User for whom to enforce GAIA sign-in. | |
232 */ | |
233 forceOnlineSignin: function(username) { | |
234 $('pod-row').forceOnlineSigninForUser(username); | |
235 }, | |
236 | |
237 /** | |
238 * Updates Caps Lock state (for Caps Lock hint in password input field). | 230 * Updates Caps Lock state (for Caps Lock hint in password input field). |
239 * @param {boolean} enabled Whether Caps Lock is on. | 231 * @param {boolean} enabled Whether Caps Lock is on. |
240 */ | 232 */ |
241 setCapsLockState: function(enabled) { | 233 setCapsLockState: function(enabled) { |
242 $('pod-row').classList.toggle('capslock-on', enabled); | 234 $('pod-row').classList.toggle('capslock-on', enabled); |
243 }, | 235 }, |
244 | 236 |
245 /** | 237 /** |
246 * Enforces focus on user pod of locked user. | 238 * Enforces focus on user pod of locked user. |
247 */ | 239 */ |
(...skipping 24 matching lines...) Expand all Loading... |
272 }, | 264 }, |
273 | 265 |
274 /** | 266 /** |
275 * Shows a button with an icon on the user pod of |username|. This function | 267 * Shows a button with an icon on the user pod of |username|. This function |
276 * is used by the chrome.screenlockPrivate API. | 268 * is used by the chrome.screenlockPrivate API. |
277 * @param {string} username Username of pod to add button | 269 * @param {string} username Username of pod to add button |
278 * @param {string} iconURL URL of the button icon | 270 * @param {string} iconURL URL of the button icon |
279 */ | 271 */ |
280 showUserPodButton: function(username, iconURL) { | 272 showUserPodButton: function(username, iconURL) { |
281 $('pod-row').showUserPodButton(username, iconURL); | 273 $('pod-row').showUserPodButton(username, iconURL); |
| 274 }, |
| 275 |
| 276 /** |
| 277 * Hides button on the user pod of |username| added by showUserPodButton(). |
| 278 * This function is used by the chrome.screenlockPrivate API. |
| 279 * @param {string} username Username of pod to remove button |
| 280 */ |
| 281 hideUserPodButton: function(username) { |
| 282 $('pod-row').hideUserPodButton(username); |
| 283 }, |
| 284 |
| 285 /** |
| 286 * Sets the authentication type used to authenticate the user. |
| 287 * @param {string} username Username of selected user |
| 288 * @param {number} authType Authentication type, must be a valid value in |
| 289 * the AUTH_TYPE enum in user_pod_row.js. |
| 290 * @param {string} value The initial value to use for authentication. |
| 291 */ |
| 292 setAuthType: function(username, authType, value) { |
| 293 $('pod-row').setAuthType(username, authType, value); |
282 } | 294 } |
283 }; | 295 }; |
284 }); | 296 }); |
285 | 297 |
OLD | NEW |