Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: ui/login/account_picker/user_pod_row.js

Issue 1191273002: ChromeOS: Show the new POD RE-AUTH ICON when users needs to re-auth (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update after review. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 702
703 /** @override */ 703 /** @override */
704 decorate: function() { 704 decorate: function() {
705 this.tabIndex = UserPodTabOrder.POD_INPUT; 705 this.tabIndex = UserPodTabOrder.POD_INPUT;
706 this.actionBoxAreaElement.tabIndex = UserPodTabOrder.ACTION_BOX; 706 this.actionBoxAreaElement.tabIndex = UserPodTabOrder.ACTION_BOX;
707 707
708 this.addEventListener('keydown', this.handlePodKeyDown_.bind(this)); 708 this.addEventListener('keydown', this.handlePodKeyDown_.bind(this));
709 this.addEventListener('click', this.handleClickOnPod_.bind(this)); 709 this.addEventListener('click', this.handleClickOnPod_.bind(this));
710 this.addEventListener('mousedown', this.handlePodMouseDown_.bind(this)); 710 this.addEventListener('mousedown', this.handlePodMouseDown_.bind(this));
711 711
712 this.signinButtonElement.addEventListener('click', 712 this.reauthWarningElement.addEventListener('click',
713 this.activate.bind(this)); 713 this.activate.bind(this));
714 714
715 this.actionBoxAreaElement.addEventListener('mousedown', 715 this.actionBoxAreaElement.addEventListener('mousedown',
716 stopEventPropagation); 716 stopEventPropagation);
717 this.actionBoxAreaElement.addEventListener('click', 717 this.actionBoxAreaElement.addEventListener('click',
718 this.handleActionAreaButtonClick_.bind(this)); 718 this.handleActionAreaButtonClick_.bind(this));
719 this.actionBoxAreaElement.addEventListener('keydown', 719 this.actionBoxAreaElement.addEventListener('keydown',
720 this.handleActionAreaButtonKeyDown_.bind(this)); 720 this.handleActionAreaButtonKeyDown_.bind(this));
721 721
722 this.actionBoxMenuRemoveElement.addEventListener('click', 722 this.actionBoxMenuRemoveElement.addEventListener('click',
723 this.handleRemoveCommandClick_.bind(this)); 723 this.handleRemoveCommandClick_.bind(this));
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 826
827 /** 827 /**
828 * Gets name element. 828 * Gets name element.
829 * @type {!HTMLDivElement} 829 * @type {!HTMLDivElement}
830 */ 830 */
831 get nameElement() { 831 get nameElement() {
832 return this.querySelector('.name'); 832 return this.querySelector('.name');
833 }, 833 },
834 834
835 /** 835 /**
836 * Gets reauth name hint element.
837 * @type {!HTMLDivElement}
838 */
839 get reauthNameHintElement() {
840 return this.querySelector('.reauth-name-hint');
841 },
842
843 /**
836 * Gets the container holding the password field. 844 * Gets the container holding the password field.
837 * @type {!HTMLInputElement} 845 * @type {!HTMLInputElement}
838 */ 846 */
839 get passwordEntryContainerElement() { 847 get passwordEntryContainerElement() {
840 return this.querySelector('.password-entry-container'); 848 return this.querySelector('.password-entry-container');
841 }, 849 },
842 850
843 /** 851 /**
844 * Gets password field. 852 * Gets password field.
845 * @type {!HTMLInputElement} 853 * @type {!HTMLInputElement}
846 */ 854 */
847 get passwordElement() { 855 get passwordElement() {
848 return this.querySelector('.password'); 856 return this.querySelector('.password');
849 }, 857 },
850 858
851 /** 859 /**
852 * Gets the password label, which is used to show a message where the 860 * Gets the password label, which is used to show a message where the
853 * password field is normally. 861 * password field is normally.
854 * @type {!HTMLInputElement} 862 * @type {!HTMLInputElement}
855 */ 863 */
856 get passwordLabelElement() { 864 get passwordLabelElement() {
857 return this.querySelector('.password-label'); 865 return this.querySelector('.password-label');
858 }, 866 },
859 867
860 /** 868 /**
861 * Gets user sign in button. 869 * Gets user online sign in hint element.
862 * @type {!HTMLButtonElement} 870 * @type {!HTMLDivElement}
863 */ 871 */
864 get signinButtonElement() { 872 get reauthWarningElement() {
865 return this.querySelector('.signin-button'); 873 return this.querySelector('.reauth-hint-container');
866 }, 874 },
867 875
868 /** 876 /**
869 * Gets the container holding the launch app button. 877 * Gets the container holding the launch app button.
870 * @type {!HTMLButtonElement} 878 * @type {!HTMLButtonElement}
871 */ 879 */
872 get launchAppButtonContainerElement() { 880 get launchAppButtonContainerElement() {
873 return this.querySelector('.launch-app-button-container'); 881 return this.querySelector('.launch-app-button-container');
874 }, 882 },
875 883
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 }, 996 },
989 997
990 /** 998 /**
991 * Updates the user pod element. 999 * Updates the user pod element.
992 */ 1000 */
993 update: function() { 1001 update: function() {
994 this.imageElement.src = 'chrome://userimage/' + this.user.username + 1002 this.imageElement.src = 'chrome://userimage/' + this.user.username +
995 '?id=' + UserPod.userImageSalt_[this.user.username]; 1003 '?id=' + UserPod.userImageSalt_[this.user.username];
996 1004
997 this.nameElement.textContent = this.user_.displayName; 1005 this.nameElement.textContent = this.user_.displayName;
1006 this.reauthNameHintElement.textContent = this.user_.displayName;
998 this.classList.toggle('signed-in', this.user_.signedIn); 1007 this.classList.toggle('signed-in', this.user_.signedIn);
999 1008
1000 if (this.isAuthTypeUserClick) 1009 if (this.isAuthTypeUserClick)
1001 this.passwordLabelElement.textContent = this.authValue; 1010 this.passwordLabelElement.textContent = this.authValue;
1002 1011
1003 this.updateActionBoxArea(); 1012 this.updateActionBoxArea();
1004 1013
1005 this.passwordElement.setAttribute('aria-label', loadTimeData.getStringF( 1014 this.passwordElement.setAttribute('aria-label', loadTimeData.getStringF(
1006 'passwordFieldAccessibleName', this.user_.emailAddress)); 1015 'passwordFieldAccessibleName', this.user_.emailAddress));
1007 1016
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 }, 1095 },
1087 1096
1088 /** 1097 /**
1089 * Gets main input element. 1098 * Gets main input element.
1090 * @type {(HTMLButtonElement|HTMLInputElement)} 1099 * @type {(HTMLButtonElement|HTMLInputElement)}
1091 */ 1100 */
1092 get mainInput() { 1101 get mainInput() {
1093 if (this.isAuthTypePassword) { 1102 if (this.isAuthTypePassword) {
1094 return this.passwordElement; 1103 return this.passwordElement;
1095 } else if (this.isAuthTypeOnlineSignIn) { 1104 } else if (this.isAuthTypeOnlineSignIn) {
1096 return this.signinButtonElement; 1105 return this;
1097 } else if (this.isAuthTypeUserClick) { 1106 } else if (this.isAuthTypeUserClick) {
1098 return this.passwordLabelElement; 1107 return this.passwordLabelElement;
1099 } 1108 }
1100 }, 1109 },
1101 1110
1102 /** 1111 /**
1103 * Whether action box button is in active state. 1112 * Whether action box button is in active state.
1104 * @type {boolean} 1113 * @type {boolean}
1105 */ 1114 */
1106 get isActionBoxMenuActive() { 1115 get isActionBoxMenuActive() {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 this.parentNode.focusPod(this); 1281 this.parentNode.focusPod(this);
1273 1282
1274 var error = document.createElement('div'); 1283 var error = document.createElement('div');
1275 var messageDiv = document.createElement('div'); 1284 var messageDiv = document.createElement('div');
1276 messageDiv.className = 'error-message-bubble'; 1285 messageDiv.className = 'error-message-bubble';
1277 messageDiv.textContent = 1286 messageDiv.textContent =
1278 loadTimeData.getString('supervisedUserExpiredTokenWarning'); 1287 loadTimeData.getString('supervisedUserExpiredTokenWarning');
1279 error.appendChild(messageDiv); 1288 error.appendChild(messageDiv);
1280 1289
1281 $('bubble').showContentForElement( 1290 $('bubble').showContentForElement(
1282 this.signinButtonElement, 1291 this.reauthWarningElement,
1283 cr.ui.Bubble.Attachment.TOP, 1292 cr.ui.Bubble.Attachment.TOP,
1284 error, 1293 error,
1285 this.signinButtonElement.offsetWidth / 2, 1294 this.reauthWarningElement.offsetWidth / 2,
1286 4); 1295 4);
1287 // Move warning bubble up if it overlaps the shelf. 1296 // Move warning bubble up if it overlaps the shelf.
1288 var maxHeight = 1297 var maxHeight =
1289 cr.ui.LoginUITools.getMaxHeightBeforeShelfOverlapping($('bubble')); 1298 cr.ui.LoginUITools.getMaxHeightBeforeShelfOverlapping($('bubble'));
1290 if (maxHeight < $('bubble').offsetHeight) { 1299 if (maxHeight < $('bubble').offsetHeight) {
1291 $('bubble').showContentForElement( 1300 $('bubble').showContentForElement(
1292 this.signinButtonElement, 1301 this.reauthWarningElement,
1293 cr.ui.Bubble.Attachment.BOTTOM, 1302 cr.ui.Bubble.Attachment.BOTTOM,
1294 error, 1303 error,
1295 this.signinButtonElement.offsetWidth / 2, 1304 this.reauthWarningElement.offsetWidth / 2,
1296 4); 1305 4);
1297 } 1306 }
1298 }, 1307 },
1299 1308
1300 /** 1309 /**
1301 * Shows signin UI for this user. 1310 * Shows signin UI for this user.
1302 */ 1311 */
1303 showSigninUI: function() { 1312 showSigninUI: function() {
1304 if (this.user.legacySupervisedUser && !this.user.isDesktopUser) { 1313 if (this.user.legacySupervisedUser && !this.user.isDesktopUser) {
1305 this.showSupervisedUserSigninWarning(); 1314 this.showSupervisedUserSigninWarning();
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
1925 if (this.user.needsSignin) 1934 if (this.user.needsSignin)
1926 return this.passwordElement; 1935 return this.passwordElement;
1927 else 1936 else
1928 return this.nameElement; 1937 return this.nameElement;
1929 }, 1938 },
1930 1939
1931 /** @override */ 1940 /** @override */
1932 update: function() { 1941 update: function() {
1933 this.imageElement.src = this.user.userImage; 1942 this.imageElement.src = this.user.userImage;
1934 this.nameElement.textContent = this.user.displayName; 1943 this.nameElement.textContent = this.user.displayName;
1944 this.reauthNameHintElement.textContent = this.user.displayName;
1935 1945
1936 var isLockedUser = this.user.needsSignin; 1946 var isLockedUser = this.user.needsSignin;
1937 var isLegacySupervisedUser = this.user.legacySupervisedUser; 1947 var isLegacySupervisedUser = this.user.legacySupervisedUser;
1938 var isChildUser = this.user.childUser; 1948 var isChildUser = this.user.childUser;
1939 this.classList.toggle('locked', isLockedUser); 1949 this.classList.toggle('locked', isLockedUser);
1940 this.classList.toggle('legacy-supervised', isLegacySupervisedUser); 1950 this.classList.toggle('legacy-supervised', isLegacySupervisedUser);
1941 this.classList.toggle('child', isChildUser); 1951 this.classList.toggle('child', isChildUser);
1942 1952
1943 if (this.isAuthTypeUserClick) 1953 if (this.isAuthTypeUserClick)
1944 this.passwordLabelElement.textContent = this.authValue; 1954 this.passwordLabelElement.textContent = this.authValue;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2017 }, 2027 },
2018 2028
2019 /** @override */ 2029 /** @override */
2020 update: function() { 2030 update: function() {
2021 this.imageElement.src = this.user.iconUrl; 2031 this.imageElement.src = this.user.iconUrl;
2022 this.imageElement.alt = this.user.label; 2032 this.imageElement.alt = this.user.label;
2023 this.imageElement.title = this.user.label; 2033 this.imageElement.title = this.user.label;
2024 this.passwordEntryContainerElement.hidden = true; 2034 this.passwordEntryContainerElement.hidden = true;
2025 this.launchAppButtonContainerElement.hidden = false; 2035 this.launchAppButtonContainerElement.hidden = false;
2026 this.nameElement.textContent = this.user.label; 2036 this.nameElement.textContent = this.user.label;
2037 this.reauthNameHintElement.textContent = this.user.label;
2027 2038
2028 UserPod.prototype.updateActionBoxArea.call(this); 2039 UserPod.prototype.updateActionBoxArea.call(this);
2029 UserPod.prototype.customizeUserPodPerUserType.call(this); 2040 UserPod.prototype.customizeUserPodPerUserType.call(this);
2030 }, 2041 },
2031 2042
2032 /** @override */ 2043 /** @override */
2033 get mainInput() { 2044 get mainInput() {
2034 return this.launchAppButtonElement; 2045 return this.launchAppButtonElement;
2035 }, 2046 },
2036 2047
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after
3148 if (pod && pod.multiProfilesPolicyApplied) { 3159 if (pod && pod.multiProfilesPolicyApplied) {
3149 pod.userTypeBubbleElement.classList.remove('bubble-shown'); 3160 pod.userTypeBubbleElement.classList.remove('bubble-shown');
3150 } 3161 }
3151 } 3162 }
3152 }; 3163 };
3153 3164
3154 return { 3165 return {
3155 PodRow: PodRow 3166 PodRow: PodRow
3156 }; 3167 };
3157 }); 3168 });
OLDNEW
« no previous file with comments | « ui/login/account_picker/user_pod_row.css ('k') | ui/login/account_picker/user_pod_template.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698