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 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 /** |
(...skipping 19 matching lines...) Expand all Loading... |
30 'showAppError', | 30 'showAppError', |
31 'updateUserImage', | 31 'updateUserImage', |
32 'setCapsLockState', | 32 'setCapsLockState', |
33 'forceLockedUserPodFocus', | 33 'forceLockedUserPodFocus', |
34 'removeUser', | 34 'removeUser', |
35 'showBannerMessage', | 35 'showBannerMessage', |
36 'showUserPodCustomIcon', | 36 'showUserPodCustomIcon', |
37 'hideUserPodCustomIcon', | 37 'hideUserPodCustomIcon', |
38 'setUserPodFingerprintIcon', | 38 'setUserPodFingerprintIcon', |
39 'removeUserPodFingerprintIcon', | 39 'removeUserPodFingerprintIcon', |
40 'disablePinKeyboardForUser', | 40 'setPinEnabledForUser', |
41 'setAuthType', | 41 'setAuthType', |
42 'setTouchViewState', | 42 'setTouchViewState', |
43 'setPublicSessionDisplayName', | 43 'setPublicSessionDisplayName', |
44 'setPublicSessionLocales', | 44 'setPublicSessionLocales', |
45 'setPublicSessionKeyboardLayouts', | 45 'setPublicSessionKeyboardLayouts', |
46 ], | 46 ], |
47 | 47 |
48 preferredWidth_: 0, | 48 preferredWidth_: 0, |
49 preferredHeight_: 0, | 49 preferredHeight_: 0, |
50 | 50 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 error, | 259 error, |
260 BUBBLE_OFFSET, | 260 BUBBLE_OFFSET, |
261 bubblePositioningPadding, true); | 261 bubblePositioningPadding, true); |
262 }; | 262 }; |
263 activatedPod.addEventListener("transitionend", | 263 activatedPod.addEventListener("transitionend", |
264 showBubbleCallback); | 264 showBubbleCallback); |
265 ensureTransitionEndEvent(activatedPod); | 265 ensureTransitionEndEvent(activatedPod); |
266 } | 266 } |
267 }, | 267 }, |
268 | 268 |
269 /** | 269 /** |
270 * Loads the PIN keyboard if any of the users can login with a PIN. Disables | |
271 * the PIN keyboard for users who are not allowed to use PIN unlock. | |
272 * @param {array} users Array of user instances. | |
273 */ | |
274 initializePinKeyboardStateForUsers_: function(users) { | |
275 // It is possible that the PIN keyboard HTML has already been loaded. If | |
276 // that is the case, we want to show the user pods with the PIN keyboard | |
277 // immediately without running the PIN show/hide effect. | |
278 document.body.classList.add('disable-pin-animation'); | |
279 setTimeout(function() { | |
280 document.body.classList.remove('disable-pin-animation'); | |
281 }); | |
282 | |
283 for (var i = 0; i < users.length; ++i) { | |
284 var user = users[i]; | |
285 if (user.showPin) { | |
286 showPinKeyboardAsync(); | |
287 } else { | |
288 // Disable pin for users who cannot authenticate with PIN. For | |
289 // example, users who have not set up PIN or users who have not | |
290 // entered their account recently. Otherwise, the PIN keyboard will | |
291 // will appear for any user if there is at least one user who has PIN | |
292 // enabled. | |
293 this.disablePinKeyboardForUser(user.username); | |
294 } | |
295 } | |
296 }, | |
297 | |
298 /** | |
299 * Loads given users in pod row. | 270 * Loads given users in pod row. |
300 * @param {array} users Array of user. | 271 * @param {array} users Array of user. |
301 * @param {boolean} showGuest Whether to show guest session button. | 272 * @param {boolean} showGuest Whether to show guest session button. |
302 */ | 273 */ |
303 loadUsers: function(users, showGuest) { | 274 loadUsers: function(users, showGuest) { |
304 $('pod-row').loadPods(users); | 275 $('pod-row').loadPods(users); |
305 $('login-header-bar').showGuestButton = showGuest; | 276 $('login-header-bar').showGuestButton = showGuest; |
306 // On Desktop, #login-header-bar has a shadow if there are 8+ profiles. | 277 // On Desktop, #login-header-bar has a shadow if there are 8+ profiles. |
307 if (Oobe.getInstance().displayType == DISPLAY_TYPE.DESKTOP_USER_MANAGER) | 278 if (Oobe.getInstance().displayType == DISPLAY_TYPE.DESKTOP_USER_MANAGER) |
308 $('login-header-bar').classList.toggle('shadow', users.length > 8); | 279 $('login-header-bar').classList.toggle('shadow', users.length > 8); |
309 | |
310 this.initializePinKeyboardStateForUsers_(users); | |
311 }, | 280 }, |
312 | 281 |
313 /** | 282 /** |
314 * Runs app with a given id from the list of loaded apps. | 283 * Runs app with a given id from the list of loaded apps. |
315 * @param {!string} app_id of an app to run. | 284 * @param {!string} app_id of an app to run. |
316 * @param {boolean=} opt_diagnostic_mode Whether to run the app in | 285 * @param {boolean=} opt_diagnostic_mode Whether to run the app in |
317 * diagnostic mode. Default is false. | 286 * diagnostic mode. Default is false. |
318 */ | 287 */ |
319 runAppForTesting: function(app_id, opt_diagnostic_mode) { | 288 runAppForTesting: function(app_id, opt_diagnostic_mode) { |
320 $('pod-row').findAndRunAppForTesting(app_id, opt_diagnostic_mode); | 289 $('pod-row').findAndRunAppForTesting(app_id, opt_diagnostic_mode); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 | 419 |
451 /** | 420 /** |
452 * Sets the state of touch view mode. | 421 * Sets the state of touch view mode. |
453 * @param {boolean} isTouchViewEnabled true if the mode is on. | 422 * @param {boolean} isTouchViewEnabled true if the mode is on. |
454 */ | 423 */ |
455 setTouchViewState: function(isTouchViewEnabled) { | 424 setTouchViewState: function(isTouchViewEnabled) { |
456 $('pod-row').setTouchViewState(isTouchViewEnabled); | 425 $('pod-row').setTouchViewState(isTouchViewEnabled); |
457 }, | 426 }, |
458 | 427 |
459 /** | 428 /** |
460 * Removes the PIN keyboard so the user can no longer enter a PIN. | 429 * Enables or disables the pin keyboard for the given user. This may change |
461 * @param {!user} user The user who can no longer enter a PIN. | 430 * pin keyboard visibility. |
| 431 * @param {!string} user |
| 432 * @param {boolean} enabled |
462 */ | 433 */ |
463 disablePinKeyboardForUser: function(user) { | 434 setPinEnabledForUser: function(user, enabled) { |
464 $('pod-row').removePinKeyboard(user); | 435 $('pod-row').setPinEnabled(user, enabled); |
465 }, | 436 }, |
466 | 437 |
467 /** | 438 /** |
468 * Updates the display name shown on a public session pod. | 439 * Updates the display name shown on a public session pod. |
469 * @param {string} userID The user ID of the public session | 440 * @param {string} userID The user ID of the public session |
470 * @param {string} displayName The new display name | 441 * @param {string} displayName The new display name |
471 */ | 442 */ |
472 setPublicSessionDisplayName: function(userID, displayName) { | 443 setPublicSessionDisplayName: function(userID, displayName) { |
473 $('pod-row').setPublicSessionDisplayName(userID, displayName); | 444 $('pod-row').setPublicSessionDisplayName(userID, displayName); |
474 }, | 445 }, |
(...skipping 21 matching lines...) Expand all Loading... |
496 * @param {string} userID The user ID of the public session | 467 * @param {string} userID The user ID of the public session |
497 * @param {string} locale The locale to which this list of keyboard layouts | 468 * @param {string} locale The locale to which this list of keyboard layouts |
498 * applies | 469 * applies |
499 * @param {!Object} list List of available keyboard layouts | 470 * @param {!Object} list List of available keyboard layouts |
500 */ | 471 */ |
501 setPublicSessionKeyboardLayouts: function(userID, locale, list) { | 472 setPublicSessionKeyboardLayouts: function(userID, locale, list) { |
502 $('pod-row').setPublicSessionKeyboardLayouts(userID, locale, list); | 473 $('pod-row').setPublicSessionKeyboardLayouts(userID, locale, list); |
503 } | 474 } |
504 }; | 475 }; |
505 }); | 476 }); |
OLD | NEW |