| 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 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 | 947 |
| 948 /** | 948 /** |
| 949 * Gets action box menu, remove user warning text div. | 949 * Gets action box menu, remove user warning text div. |
| 950 * @type {!HTMLInputElement} | 950 * @type {!HTMLInputElement} |
| 951 */ | 951 */ |
| 952 get actionBoxRemoveUserWarningTextElement() { | 952 get actionBoxRemoveUserWarningTextElement() { |
| 953 return this.querySelector('.action-box-remove-user-warning-text'); | 953 return this.querySelector('.action-box-remove-user-warning-text'); |
| 954 }, | 954 }, |
| 955 | 955 |
| 956 /** | 956 /** |
| 957 * Gets action box menu, remove supervised user warning text div. | 957 * Gets action box menu, remove legacy supervised user warning text div. |
| 958 * @type {!HTMLInputElement} | 958 * @type {!HTMLInputElement} |
| 959 */ | 959 */ |
| 960 get actionBoxRemoveSupervisedUserWarningTextElement() { | 960 get actionBoxRemoveLegacySupervisedUserWarningTextElement() { |
| 961 return this.querySelector( | 961 return this.querySelector( |
| 962 '.action-box-remove-supervised-user-warning-text'); | 962 '.action-box-remove-legacy-supervised-user-warning-text'); |
| 963 }, | 963 }, |
| 964 | 964 |
| 965 /** | 965 /** |
| 966 * Gets action box menu, remove user command item div. | 966 * Gets action box menu, remove user command item div. |
| 967 * @type {!HTMLInputElement} | 967 * @type {!HTMLInputElement} |
| 968 */ | 968 */ |
| 969 get actionBoxRemoveUserWarningElement() { | 969 get actionBoxRemoveUserWarningElement() { |
| 970 return this.querySelector('.action-box-remove-user-warning'); | 970 return this.querySelector('.action-box-remove-user-warning'); |
| 971 }, | 971 }, |
| 972 | 972 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 this.actionBoxMenuTitleEmailElement.textContent = this.user_.emailAddress; | 1028 this.actionBoxMenuTitleEmailElement.textContent = this.user_.emailAddress; |
| 1029 this.actionBoxMenuTitleEmailElement.hidden = this.user_.supervisedUser; | 1029 this.actionBoxMenuTitleEmailElement.hidden = this.user_.supervisedUser; |
| 1030 | 1030 |
| 1031 this.actionBoxMenuCommandElement.textContent = | 1031 this.actionBoxMenuCommandElement.textContent = |
| 1032 loadTimeData.getString('removeUser'); | 1032 loadTimeData.getString('removeUser'); |
| 1033 }, | 1033 }, |
| 1034 | 1034 |
| 1035 customizeUserPodPerUserType: function() { | 1035 customizeUserPodPerUserType: function() { |
| 1036 if (this.user_.childUser && !this.user_.isDesktopUser) { | 1036 if (this.user_.childUser && !this.user_.isDesktopUser) { |
| 1037 this.setUserPodIconType('child'); | 1037 this.setUserPodIconType('child'); |
| 1038 } else if (this.user_.supervisedUser && !this.user_.isDesktopUser) { | 1038 } else if (this.user_.legacySupervisedUser && !this.user_.isDesktopUser) { |
| 1039 this.setUserPodIconType('supervised'); | 1039 this.setUserPodIconType('legacySupervised'); |
| 1040 } else if (this.multiProfilesPolicyApplied) { | 1040 } else if (this.multiProfilesPolicyApplied) { |
| 1041 // Mark user pod as not focusable which in addition to the grayed out | 1041 // Mark user pod as not focusable which in addition to the grayed out |
| 1042 // filter makes it look in disabled state. | 1042 // filter makes it look in disabled state. |
| 1043 this.classList.add('multiprofiles-policy-applied'); | 1043 this.classList.add('multiprofiles-policy-applied'); |
| 1044 this.setUserPodIconType('policy'); | 1044 this.setUserPodIconType('policy'); |
| 1045 | 1045 |
| 1046 if (this.user.multiProfilesPolicy == 'primary-only') | 1046 if (this.user.multiProfilesPolicy == 'primary-only') |
| 1047 this.querySelector('.mp-policy-primary-only-msg').hidden = false; | 1047 this.querySelector('.mp-policy-primary-only-msg').hidden = false; |
| 1048 else if (this.user.multiProfilesPolicy == 'owner-primary-only') | 1048 else if (this.user.multiProfilesPolicy == 'owner-primary-only') |
| 1049 this.querySelector('.mp-owner-primary-only-msg').hidden = false; | 1049 this.querySelector('.mp-owner-primary-only-msg').hidden = false; |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 this.isActionBoxMenuActive = false; | 1380 this.isActionBoxMenuActive = false; |
| 1381 break; | 1381 break; |
| 1382 } | 1382 } |
| 1383 }, | 1383 }, |
| 1384 | 1384 |
| 1385 /** | 1385 /** |
| 1386 * Handles a click event on remove user command. | 1386 * Handles a click event on remove user command. |
| 1387 * @param {Event} e Click event. | 1387 * @param {Event} e Click event. |
| 1388 */ | 1388 */ |
| 1389 handleRemoveCommandClick_: function(e) { | 1389 handleRemoveCommandClick_: function(e) { |
| 1390 if (this.user.supervisedUser || this.user.isDesktopUser) { | 1390 if (this.user.legacySupervisedUser || this.user.isDesktopUser) { |
| 1391 this.showRemoveWarning_(); | 1391 this.showRemoveWarning_(); |
| 1392 return; | 1392 return; |
| 1393 } | 1393 } |
| 1394 if (this.isActionBoxMenuActive) | 1394 if (this.isActionBoxMenuActive) |
| 1395 chrome.send('removeUser', [this.user.username]); | 1395 chrome.send('removeUser', [this.user.username]); |
| 1396 }, | 1396 }, |
| 1397 | 1397 |
| 1398 /** | 1398 /** |
| 1399 * Shows remove user warning. Used for supervised users on CrOS, and for all | 1399 * Shows remove user warning. Used for legacy supervised users on CrOS, and |
| 1400 * users on desktop. | 1400 * for all users on desktop. |
| 1401 */ | 1401 */ |
| 1402 showRemoveWarning_: function() { | 1402 showRemoveWarning_: function() { |
| 1403 this.actionBoxMenuRemoveElement.hidden = true; | 1403 this.actionBoxMenuRemoveElement.hidden = true; |
| 1404 this.actionBoxRemoveUserWarningElement.hidden = false; | 1404 this.actionBoxRemoveUserWarningElement.hidden = false; |
| 1405 this.actionBoxRemoveUserWarningButtonElement.focus(); | 1405 this.actionBoxRemoveUserWarningButtonElement.focus(); |
| 1406 | 1406 |
| 1407 // Move up the menu if it overlaps shelf. | 1407 // Move up the menu if it overlaps shelf. |
| 1408 var maxHeight = cr.ui.LoginUITools.getMaxHeightBeforeShelfOverlapping( | 1408 var maxHeight = cr.ui.LoginUITools.getMaxHeightBeforeShelfOverlapping( |
| 1409 this.actionBoxMenu); | 1409 this.actionBoxMenu); |
| 1410 var actualHeight = parseInt( | 1410 var actualHeight = parseInt( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1448 | 1448 |
| 1449 /** | 1449 /** |
| 1450 * Handles a keydown event on remove command. | 1450 * Handles a keydown event on remove command. |
| 1451 * @param {Event} e KeyDown event. | 1451 * @param {Event} e KeyDown event. |
| 1452 */ | 1452 */ |
| 1453 handleRemoveCommandKeyDown_: function(e) { | 1453 handleRemoveCommandKeyDown_: function(e) { |
| 1454 if (this.disabled) | 1454 if (this.disabled) |
| 1455 return; | 1455 return; |
| 1456 switch (e.keyIdentifier) { | 1456 switch (e.keyIdentifier) { |
| 1457 case 'Enter': | 1457 case 'Enter': |
| 1458 if (this.user.supervisedUser || this.user.isDesktopUser) { | 1458 if (this.user.legacySupervisedUser || this.user.isDesktopUser) { |
| 1459 // Prevent default so that we don't trigger a 'click' event on the | 1459 // Prevent default so that we don't trigger a 'click' event on the |
| 1460 // remove button that will be focused. | 1460 // remove button that will be focused. |
| 1461 e.preventDefault(); | 1461 e.preventDefault(); |
| 1462 this.showRemoveWarning_(); | 1462 this.showRemoveWarning_(); |
| 1463 } else { | 1463 } else { |
| 1464 this.removeUser(this.user); | 1464 this.removeUser(this.user); |
| 1465 } | 1465 } |
| 1466 e.stopPropagation(); | 1466 e.stopPropagation(); |
| 1467 break; | 1467 break; |
| 1468 case 'Up': | 1468 case 'Up': |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1924 else | 1924 else |
| 1925 return this.nameElement; | 1925 return this.nameElement; |
| 1926 }, | 1926 }, |
| 1927 | 1927 |
| 1928 /** @override */ | 1928 /** @override */ |
| 1929 update: function() { | 1929 update: function() { |
| 1930 this.imageElement.src = this.user.userImage; | 1930 this.imageElement.src = this.user.userImage; |
| 1931 this.nameElement.textContent = this.user.displayName; | 1931 this.nameElement.textContent = this.user.displayName; |
| 1932 | 1932 |
| 1933 var isLockedUser = this.user.needsSignin; | 1933 var isLockedUser = this.user.needsSignin; |
| 1934 var isLegacySupervisedUser = this.user.supervisedUser; | 1934 var isLegacySupervisedUser = this.user.legacySupervisedUser; |
| 1935 var isChildUser = this.user.childUser; | 1935 var isChildUser = this.user.childUser; |
| 1936 this.classList.toggle('locked', isLockedUser); | 1936 this.classList.toggle('locked', isLockedUser); |
| 1937 this.classList.toggle('legacy-supervised', isLegacySupervisedUser); | 1937 this.classList.toggle('legacy-supervised', isLegacySupervisedUser); |
| 1938 this.classList.toggle('child', isChildUser); | 1938 this.classList.toggle('child', isChildUser); |
| 1939 | 1939 |
| 1940 if (this.isAuthTypeUserClick) | 1940 if (this.isAuthTypeUserClick) |
| 1941 this.passwordLabelElement.textContent = this.authValue; | 1941 this.passwordLabelElement.textContent = this.authValue; |
| 1942 | 1942 |
| 1943 this.actionBoxRemoveUserWarningTextElement.hidden = | 1943 this.actionBoxRemoveUserWarningTextElement.hidden = |
| 1944 isLegacySupervisedUser; | 1944 isLegacySupervisedUser; |
| 1945 this.actionBoxRemoveSupervisedUserWarningTextElement.hidden = | 1945 this.actionBoxRemoveLegacySupervisedUserWarningTextElement.hidden = |
| 1946 !isLegacySupervisedUser; | 1946 !isLegacySupervisedUser; |
| 1947 | 1947 |
| 1948 this.passwordElement.setAttribute('aria-label', loadTimeData.getStringF( | 1948 this.passwordElement.setAttribute('aria-label', loadTimeData.getStringF( |
| 1949 'passwordFieldAccessibleName', this.user_.emailAddress)); | 1949 'passwordFieldAccessibleName', this.user_.emailAddress)); |
| 1950 | 1950 |
| 1951 UserPod.prototype.updateActionBoxArea.call(this); | 1951 UserPod.prototype.updateActionBoxArea.call(this); |
| 1952 }, | 1952 }, |
| 1953 | 1953 |
| 1954 /** @override */ | 1954 /** @override */ |
| 1955 focusInput: function() { | 1955 focusInput: function() { |
| (...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3134 if (pod && pod.multiProfilesPolicyApplied) { | 3134 if (pod && pod.multiProfilesPolicyApplied) { |
| 3135 pod.userTypeBubbleElement.classList.remove('bubble-shown'); | 3135 pod.userTypeBubbleElement.classList.remove('bubble-shown'); |
| 3136 } | 3136 } |
| 3137 } | 3137 } |
| 3138 }; | 3138 }; |
| 3139 | 3139 |
| 3140 return { | 3140 return { |
| 3141 PodRow: PodRow | 3141 PodRow: PodRow |
| 3142 }; | 3142 }; |
| 3143 }); | 3143 }); |
| OLD | NEW |