| 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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 this.actionBoxAreaElement.setAttribute( | 479 this.actionBoxAreaElement.setAttribute( |
| 480 'aria-label', loadTimeData.getStringF( | 480 'aria-label', loadTimeData.getStringF( |
| 481 'podMenuButtonAccessibleName', this.user_.emailAddress)); | 481 'podMenuButtonAccessibleName', this.user_.emailAddress)); |
| 482 this.actionBoxMenuRemoveElement.setAttribute( | 482 this.actionBoxMenuRemoveElement.setAttribute( |
| 483 'aria-label', loadTimeData.getString( | 483 'aria-label', loadTimeData.getString( |
| 484 'podMenuRemoveItemAccessibleName')); | 484 'podMenuRemoveItemAccessibleName')); |
| 485 this.actionBoxMenuTitleNameElement.textContent = this.user_.isOwner ? | 485 this.actionBoxMenuTitleNameElement.textContent = this.user_.isOwner ? |
| 486 loadTimeData.getStringF('ownerUserPattern', this.user_.displayName) : | 486 loadTimeData.getStringF('ownerUserPattern', this.user_.displayName) : |
| 487 this.user_.displayName; | 487 this.user_.displayName; |
| 488 this.actionBoxMenuTitleEmailElement.textContent = this.user_.emailAddress; | 488 this.actionBoxMenuTitleEmailElement.textContent = this.user_.emailAddress; |
| 489 this.actionBoxMenuTitleEmailElement.hidden = | 489 this.actionBoxMenuTitleEmailElement.hidden = this.user_.supervisedUser; |
| 490 this.user_.locallyManagedUser; | |
| 491 | 490 |
| 492 this.actionBoxMenuCommandElement.textContent = | 491 this.actionBoxMenuCommandElement.textContent = |
| 493 loadTimeData.getString('removeUser'); | 492 loadTimeData.getString('removeUser'); |
| 494 }, | 493 }, |
| 495 | 494 |
| 496 customizeUserPodPerUserType: function() { | 495 customizeUserPodPerUserType: function() { |
| 497 if (this.user_.locallyManagedUser && !this.user_.isDesktopUser) { | 496 if (this.user_.supervisedUser && !this.user_.isDesktopUser) { |
| 498 this.setUserPodIconType('supervised'); | 497 this.setUserPodIconType('supervised'); |
| 499 } else if (this.multiProfilesPolicyApplied) { | 498 } else if (this.multiProfilesPolicyApplied) { |
| 500 // Mark user pod as not focusable which in addition to the grayed out | 499 // Mark user pod as not focusable which in addition to the grayed out |
| 501 // filter makes it look in disabled state. | 500 // filter makes it look in disabled state. |
| 502 this.classList.add('multiprofiles-policy-applied'); | 501 this.classList.add('multiprofiles-policy-applied'); |
| 503 this.setUserPodIconType('policy'); | 502 this.setUserPodIconType('policy'); |
| 504 | 503 |
| 505 if (this.user.multiProfilesPolicy == 'primary-only') | 504 if (this.user.multiProfilesPolicy == 'primary-only') |
| 506 this.querySelector('.mp-policy-primary-only-msg').hidden = false; | 505 this.querySelector('.mp-policy-primary-only-msg').hidden = false; |
| 507 else if (this.user.multiProfilesPolicy == 'owner-primary-only') | 506 else if (this.user.multiProfilesPolicy == 'owner-primary-only') |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 [this.user.username, this.passwordElement.value]); | 699 [this.user.username, this.passwordElement.value]); |
| 701 } else { | 700 } else { |
| 702 console.error('Activating user pod with invalid authentication type: ' + | 701 console.error('Activating user pod with invalid authentication type: ' + |
| 703 this.authType); | 702 this.authType); |
| 704 } | 703 } |
| 705 | 704 |
| 706 return true; | 705 return true; |
| 707 }, | 706 }, |
| 708 | 707 |
| 709 showSupervisedUserSigninWarning: function() { | 708 showSupervisedUserSigninWarning: function() { |
| 710 // Locally managed user token has been invalidated. | 709 // Supervised user token has been invalidated. |
| 711 // Make sure that pod is focused i.e. "Sign in" button is seen. | 710 // Make sure that pod is focused i.e. "Sign in" button is seen. |
| 712 this.parentNode.focusPod(this); | 711 this.parentNode.focusPod(this); |
| 713 | 712 |
| 714 var error = document.createElement('div'); | 713 var error = document.createElement('div'); |
| 715 var messageDiv = document.createElement('div'); | 714 var messageDiv = document.createElement('div'); |
| 716 messageDiv.className = 'error-message-bubble'; | 715 messageDiv.className = 'error-message-bubble'; |
| 717 messageDiv.textContent = | 716 messageDiv.textContent = |
| 718 loadTimeData.getString('supervisedUserExpiredTokenWarning'); | 717 loadTimeData.getString('supervisedUserExpiredTokenWarning'); |
| 719 error.appendChild(messageDiv); | 718 error.appendChild(messageDiv); |
| 720 | 719 |
| 721 $('bubble').showContentForElement( | 720 $('bubble').showContentForElement( |
| 722 this.signinButtonElement, | 721 this.signinButtonElement, |
| 723 cr.ui.Bubble.Attachment.TOP, | 722 cr.ui.Bubble.Attachment.TOP, |
| 724 error, | 723 error, |
| 725 this.signinButtonElement.offsetWidth / 2, | 724 this.signinButtonElement.offsetWidth / 2, |
| 726 4); | 725 4); |
| 727 }, | 726 }, |
| 728 | 727 |
| 729 /** | 728 /** |
| 730 * Shows signin UI for this user. | 729 * Shows signin UI for this user. |
| 731 */ | 730 */ |
| 732 showSigninUI: function() { | 731 showSigninUI: function() { |
| 733 if (this.user.locallyManagedUser && !this.user.isDesktopUser) { | 732 if (this.user.supervisedUser && !this.user.isDesktopUser) { |
| 734 this.showSupervisedUserSigninWarning(); | 733 this.showSupervisedUserSigninWarning(); |
| 735 } else { | 734 } else { |
| 736 // Special case for multi-profiles sign in. We show users even if they | 735 // Special case for multi-profiles sign in. We show users even if they |
| 737 // are not allowed per policy. Restrict those users from starting GAIA. | 736 // are not allowed per policy. Restrict those users from starting GAIA. |
| 738 if (this.multiProfilesPolicyApplied) | 737 if (this.multiProfilesPolicyApplied) |
| 739 return; | 738 return; |
| 740 | 739 |
| 741 this.parentNode.showSigninUI(this.user.emailAddress); | 740 this.parentNode.showSigninUI(this.user.emailAddress); |
| 742 } | 741 } |
| 743 }, | 742 }, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 this.isActionBoxMenuActive = false; | 809 this.isActionBoxMenuActive = false; |
| 811 break; | 810 break; |
| 812 } | 811 } |
| 813 }, | 812 }, |
| 814 | 813 |
| 815 /** | 814 /** |
| 816 * Handles a click event on remove user command. | 815 * Handles a click event on remove user command. |
| 817 * @param {Event} e Click event. | 816 * @param {Event} e Click event. |
| 818 */ | 817 */ |
| 819 handleRemoveCommandClick_: function(e) { | 818 handleRemoveCommandClick_: function(e) { |
| 820 if (this.user.locallyManagedUser || this.user.isDesktopUser) { | 819 if (this.user.supervisedUser || this.user.isDesktopUser) { |
| 821 this.showRemoveWarning_(); | 820 this.showRemoveWarning_(); |
| 822 return; | 821 return; |
| 823 } | 822 } |
| 824 if (this.isActionBoxMenuActive) | 823 if (this.isActionBoxMenuActive) |
| 825 chrome.send('removeUser', [this.user.username]); | 824 chrome.send('removeUser', [this.user.username]); |
| 826 }, | 825 }, |
| 827 | 826 |
| 828 /** | 827 /** |
| 829 * Shows remove user warning. Used for supervised users on CrOS, and for all | 828 * Shows remove user warning. Used for supervised users on CrOS, and for all |
| 830 * users on desktop. | 829 * users on desktop. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 | 867 |
| 869 /** | 868 /** |
| 870 * Handles a keydown event on remove command. | 869 * Handles a keydown event on remove command. |
| 871 * @param {Event} e KeyDown event. | 870 * @param {Event} e KeyDown event. |
| 872 */ | 871 */ |
| 873 handleRemoveCommandKeyDown_: function(e) { | 872 handleRemoveCommandKeyDown_: function(e) { |
| 874 if (this.disabled) | 873 if (this.disabled) |
| 875 return; | 874 return; |
| 876 switch (e.keyIdentifier) { | 875 switch (e.keyIdentifier) { |
| 877 case 'Enter': | 876 case 'Enter': |
| 878 if (this.user.locallyManagedUser || this.user.isDesktopUser) { | 877 if (this.user.supervisedUser || this.user.isDesktopUser) { |
| 879 // Prevent default so that we don't trigger a 'click' event on the | 878 // Prevent default so that we don't trigger a 'click' event on the |
| 880 // remove button that will be focused. | 879 // remove button that will be focused. |
| 881 e.preventDefault(); | 880 e.preventDefault(); |
| 882 this.showRemoveWarning_(); | 881 this.showRemoveWarning_(); |
| 883 } else { | 882 } else { |
| 884 this.removeUser(this.user); | 883 this.removeUser(this.user); |
| 885 } | 884 } |
| 886 e.stopPropagation(); | 885 e.stopPropagation(); |
| 887 break; | 886 break; |
| 888 case 'Up': | 887 case 'Up': |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1250 else | 1249 else |
| 1251 return this.nameElement; | 1250 return this.nameElement; |
| 1252 }, | 1251 }, |
| 1253 | 1252 |
| 1254 /** @override */ | 1253 /** @override */ |
| 1255 update: function() { | 1254 update: function() { |
| 1256 this.imageElement.src = this.user.userImage; | 1255 this.imageElement.src = this.user.userImage; |
| 1257 this.nameElement.textContent = this.user.displayName; | 1256 this.nameElement.textContent = this.user.displayName; |
| 1258 | 1257 |
| 1259 var isLockedUser = this.user.needsSignin; | 1258 var isLockedUser = this.user.needsSignin; |
| 1260 var isSupervisedUser = this.user.locallyManagedUser; | 1259 var isSupervisedUser = this.user.supervisedUser; |
| 1261 this.classList.toggle('locked', isLockedUser); | 1260 this.classList.toggle('locked', isLockedUser); |
| 1262 this.classList.toggle('supervised-user', isSupervisedUser); | 1261 this.classList.toggle('supervised-user', isSupervisedUser); |
| 1263 | 1262 |
| 1264 if (this.isAuthTypeUserClick) | 1263 if (this.isAuthTypeUserClick) |
| 1265 this.passwordLabelElement.textContent = this.authValue; | 1264 this.passwordLabelElement.textContent = this.authValue; |
| 1266 | 1265 |
| 1267 this.actionBoxRemoveUserWarningTextElement.hidden = isSupervisedUser; | 1266 this.actionBoxRemoveUserWarningTextElement.hidden = isSupervisedUser; |
| 1268 this.actionBoxRemoveSupervisedUserWarningTextElement.hidden = | 1267 this.actionBoxRemoveSupervisedUserWarningTextElement.hidden = |
| 1269 !isSupervisedUser; | 1268 !isSupervisedUser; |
| 1270 | 1269 |
| (...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2390 if (this.podsWithPendingImages_.length == 0) { | 2389 if (this.podsWithPendingImages_.length == 0) { |
| 2391 this.classList.remove('images-loading'); | 2390 this.classList.remove('images-loading'); |
| 2392 } | 2391 } |
| 2393 } | 2392 } |
| 2394 }; | 2393 }; |
| 2395 | 2394 |
| 2396 return { | 2395 return { |
| 2397 PodRow: PodRow | 2396 PodRow: PodRow |
| 2398 }; | 2397 }; |
| 2399 }); | 2398 }); |
| OLD | NEW |