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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 | 403 |
404 /** | 404 /** |
405 * Gets action box menu, remove user command item div. | 405 * Gets action box menu, remove user command item div. |
406 * @type {!HTMLInputElement} | 406 * @type {!HTMLInputElement} |
407 */ | 407 */ |
408 get actionBoxMenuRemoveElement() { | 408 get actionBoxMenuRemoveElement() { |
409 return this.querySelector('.action-box-menu-remove'); | 409 return this.querySelector('.action-box-menu-remove'); |
410 }, | 410 }, |
411 | 411 |
412 /** | 412 /** |
| 413 * Gets action box menu, remove user warning text div. |
| 414 * @type {!HTMLInputElement} |
| 415 */ |
| 416 get actionBoxRemoveUserWarningTextElement() { |
| 417 return this.querySelector('.action-box-remove-user-warning-text'); |
| 418 }, |
| 419 |
| 420 /** |
| 421 * Gets action box menu, remove supervised user warning text div. |
| 422 * @type {!HTMLInputElement} |
| 423 */ |
| 424 get actionBoxRemoveSupervisedUserWarningTextElement() { |
| 425 return this.querySelector( |
| 426 '.action-box-remove-supervised-user-warning-text'); |
| 427 }, |
| 428 |
| 429 /** |
413 * Gets action box menu, remove user command item div. | 430 * Gets action box menu, remove user command item div. |
414 * @type {!HTMLInputElement} | 431 * @type {!HTMLInputElement} |
415 */ | 432 */ |
416 get actionBoxRemoveUserWarningElement() { | 433 get actionBoxRemoveUserWarningElement() { |
417 return this.querySelector('.action-box-remove-user-warning'); | 434 return this.querySelector('.action-box-remove-user-warning'); |
418 }, | 435 }, |
419 | 436 |
420 /** | 437 /** |
421 * Gets action box menu, remove user command item div. | 438 * Gets action box menu, remove user command item div. |
422 * @type {!HTMLInputElement} | 439 * @type {!HTMLInputElement} |
423 */ | 440 */ |
424 get actionBoxRemoveUserWarningButtonElement() { | 441 get actionBoxRemoveUserWarningButtonElement() { |
425 return this.querySelector( | 442 return this.querySelector('.remove-warning-button'); |
426 '.remove-warning-button'); | |
427 }, | 443 }, |
428 | 444 |
429 /** | 445 /** |
430 * Gets the locked user indicator box. | 446 * Gets the locked user indicator box. |
431 * @type {!HTMLInputElement} | 447 * @type {!HTMLInputElement} |
432 */ | 448 */ |
433 get lockedIndicatorElement() { | 449 get lockedIndicatorElement() { |
434 return this.querySelector('.locked-indicator'); | 450 return this.querySelector('.locked-indicator'); |
435 }, | 451 }, |
436 | 452 |
437 /** | 453 /** |
| 454 * Gets the supervised user indicator box. |
| 455 * @type {!HTMLInputElement} |
| 456 */ |
| 457 get supervisedUserIndicatorElement() { |
| 458 return this.querySelector('.supervised-indicator'); |
| 459 }, |
| 460 |
| 461 /** |
438 * Gets the custom icon. This icon is normally hidden, but can be shown | 462 * Gets the custom icon. This icon is normally hidden, but can be shown |
439 * using the chrome.screenlockPrivate API. | 463 * using the chrome.screenlockPrivate API. |
440 * @type {!HTMLDivElement} | 464 * @type {!HTMLDivElement} |
441 */ | 465 */ |
442 get customIconElement() { | 466 get customIconElement() { |
443 return this.querySelector('.custom-icon'); | 467 return this.querySelector('.custom-icon'); |
444 }, | 468 }, |
445 | 469 |
446 /** | 470 /** |
447 * Updates the user pod element. | 471 * Updates the user pod element. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 this.user_.locallyManagedUser; | 512 this.user_.locallyManagedUser; |
489 | 513 |
490 this.actionBoxMenuCommandElement.textContent = | 514 this.actionBoxMenuCommandElement.textContent = |
491 loadTimeData.getString('removeUser'); | 515 loadTimeData.getString('removeUser'); |
492 }, | 516 }, |
493 | 517 |
494 customizeUserPodPerUserType: function() { | 518 customizeUserPodPerUserType: function() { |
495 var isMultiProfilesUI = | 519 var isMultiProfilesUI = |
496 (Oobe.getInstance().displayType == DISPLAY_TYPE.USER_ADDING); | 520 (Oobe.getInstance().displayType == DISPLAY_TYPE.USER_ADDING); |
497 | 521 |
498 if (this.user_.locallyManagedUser) { | 522 if (this.user_.locallyManagedUser && !this.user_.isDesktopUser) { |
499 this.setUserPodIconType('supervised'); | 523 this.setUserPodIconType('supervised'); |
500 } else if (isMultiProfilesUI && !this.user_.isMultiProfilesAllowed) { | 524 } else if (isMultiProfilesUI && !this.user_.isMultiProfilesAllowed) { |
501 // Mark user pod as not focusable which in addition to the grayed out | 525 // Mark user pod as not focusable which in addition to the grayed out |
502 // filter makes it look in disabled state. | 526 // filter makes it look in disabled state. |
503 this.classList.add('not-focusable'); | 527 this.classList.add('not-focusable'); |
504 this.setUserPodIconType('policy'); | 528 this.setUserPodIconType('policy'); |
505 | 529 |
506 this.querySelector('.mp-policy-title').hidden = false; | 530 this.querySelector('.mp-policy-title').hidden = false; |
507 if (this.user.multiProfilesPolicy == 'primary-only') | 531 if (this.user.multiProfilesPolicy == 'primary-only') |
508 this.querySelector('.mp-policy-primary-only-msg').hidden = false; | 532 this.querySelector('.mp-policy-primary-only-msg').hidden = false; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 cr.ui.Bubble.Attachment.TOP, | 731 cr.ui.Bubble.Attachment.TOP, |
708 error, | 732 error, |
709 this.signinButtonElement.offsetWidth / 2, | 733 this.signinButtonElement.offsetWidth / 2, |
710 4); | 734 4); |
711 }, | 735 }, |
712 | 736 |
713 /** | 737 /** |
714 * Shows signin UI for this user. | 738 * Shows signin UI for this user. |
715 */ | 739 */ |
716 showSigninUI: function() { | 740 showSigninUI: function() { |
717 if (this.user.locallyManagedUser) { | 741 if (this.user.locallyManagedUser && !this.user.isDesktopUser) { |
718 this.showSupervisedUserSigninWarning(); | 742 this.showSupervisedUserSigninWarning(); |
719 } else { | 743 } else { |
720 this.parentNode.showSigninUI(this.user.emailAddress); | 744 this.parentNode.showSigninUI(this.user.emailAddress); |
721 } | 745 } |
722 }, | 746 }, |
723 | 747 |
724 /** | 748 /** |
725 * Resets the input field and updates the tab order of pod controls. | 749 * Resets the input field and updates the tab order of pod controls. |
726 * @param {boolean} takeFocus If true, input field takes focus. | 750 * @param {boolean} takeFocus If true, input field takes focus. |
727 */ | 751 */ |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 handleRemoveCommandClick_: function(e) { | 810 handleRemoveCommandClick_: function(e) { |
787 if (this.user.locallyManagedUser || this.user.isDesktopUser) { | 811 if (this.user.locallyManagedUser || this.user.isDesktopUser) { |
788 this.showRemoveWarning_(); | 812 this.showRemoveWarning_(); |
789 return; | 813 return; |
790 } | 814 } |
791 if (this.isActionBoxMenuActive) | 815 if (this.isActionBoxMenuActive) |
792 chrome.send('removeUser', [this.user.username]); | 816 chrome.send('removeUser', [this.user.username]); |
793 }, | 817 }, |
794 | 818 |
795 /** | 819 /** |
796 * Shows remove warning for managed users. | 820 * Shows remove user warning. Used for supervised users on CrOS, and for all |
| 821 * users on desktop. |
797 */ | 822 */ |
798 showRemoveWarning_: function() { | 823 showRemoveWarning_: function() { |
799 this.actionBoxMenuRemoveElement.hidden = true; | 824 this.actionBoxMenuRemoveElement.hidden = true; |
800 this.actionBoxRemoveUserWarningElement.hidden = false; | 825 this.actionBoxRemoveUserWarningElement.hidden = false; |
801 }, | 826 }, |
802 | 827 |
803 /** | 828 /** |
804 * Handles a click event on remove user confirmation button. | 829 * Handles a click event on remove user confirmation button. |
805 * @param {Event} e Click event. | 830 * @param {Event} e Click event. |
806 */ | 831 */ |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 decorate: function() { | 1150 decorate: function() { |
1126 UserPod.prototype.decorate.call(this); | 1151 UserPod.prototype.decorate.call(this); |
1127 }, | 1152 }, |
1128 | 1153 |
1129 /** @override */ | 1154 /** @override */ |
1130 update: function() { | 1155 update: function() { |
1131 this.imageElement.src = this.user.userImage; | 1156 this.imageElement.src = this.user.userImage; |
1132 this.nameElement.textContent = this.user.displayName; | 1157 this.nameElement.textContent = this.user.displayName; |
1133 | 1158 |
1134 var isLockedUser = this.user.needsSignin; | 1159 var isLockedUser = this.user.needsSignin; |
| 1160 var isSupervisedUser = this.user.locallyManagedUser; |
1135 this.signinButtonElement.hidden = true; | 1161 this.signinButtonElement.hidden = true; |
1136 this.lockedIndicatorElement.hidden = !isLockedUser; | 1162 this.lockedIndicatorElement.hidden = !isLockedUser; |
| 1163 this.supervisedUserIndicatorElement.hidden = !isSupervisedUser; |
1137 this.passwordElement.hidden = !isLockedUser; | 1164 this.passwordElement.hidden = !isLockedUser; |
1138 this.nameElement.hidden = isLockedUser; | 1165 this.nameElement.hidden = isLockedUser; |
1139 | 1166 |
1140 if (this.isAuthTypeUserClick) | 1167 if (this.isAuthTypeUserClick) |
1141 this.passwordLabelElement.textContent = this.authValue; | 1168 this.passwordLabelElement.textContent = this.authValue; |
1142 | 1169 |
| 1170 this.actionBoxRemoveUserWarningTextElement.hidden = isSupervisedUser; |
| 1171 this.actionBoxRemoveSupervisedUserWarningTextElement.hidden = |
| 1172 !isSupervisedUser; |
| 1173 |
1143 UserPod.prototype.updateActionBoxArea.call(this); | 1174 UserPod.prototype.updateActionBoxArea.call(this); |
1144 }, | 1175 }, |
1145 | 1176 |
1146 /** @override */ | 1177 /** @override */ |
1147 focusInput: function() { | 1178 focusInput: function() { |
1148 // For focused pods, display the name unless the pod is locked. | 1179 // For focused pods, display the name unless the pod is locked. |
1149 var isLockedUser = this.user.needsSignin; | 1180 var isLockedUser = this.user.needsSignin; |
| 1181 var isSupervisedUser = this.user.locallyManagedUser; |
1150 this.signinButtonElement.hidden = true; | 1182 this.signinButtonElement.hidden = true; |
1151 this.lockedIndicatorElement.hidden = !isLockedUser; | 1183 this.lockedIndicatorElement.hidden = !isLockedUser; |
| 1184 this.supervisedUserIndicatorElement.hidden = !isSupervisedUser; |
1152 this.passwordElement.hidden = !isLockedUser; | 1185 this.passwordElement.hidden = !isLockedUser; |
1153 this.nameElement.hidden = isLockedUser; | 1186 this.nameElement.hidden = isLockedUser; |
1154 | 1187 |
1155 // Move tabIndex from the whole pod to the main input. | 1188 // Move tabIndex from the whole pod to the main input. |
1156 this.tabIndex = -1; | 1189 this.tabIndex = -1; |
1157 this.mainInput.tabIndex = UserPodTabOrder.POD_INPUT; | 1190 this.mainInput.tabIndex = UserPodTabOrder.POD_INPUT; |
1158 this.mainInput.focus(); | 1191 this.mainInput.focus(); |
1159 }, | 1192 }, |
1160 | 1193 |
1161 /** @override */ | 1194 /** @override */ |
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2274 if (this.podsWithPendingImages_.length == 0) { | 2307 if (this.podsWithPendingImages_.length == 0) { |
2275 this.classList.remove('images-loading'); | 2308 this.classList.remove('images-loading'); |
2276 } | 2309 } |
2277 } | 2310 } |
2278 }; | 2311 }; |
2279 | 2312 |
2280 return { | 2313 return { |
2281 PodRow: PodRow | 2314 PodRow: PodRow |
2282 }; | 2315 }; |
2283 }); | 2316 }); |
OLD | NEW |