| 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 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1768 var num_stats_loaded = 0; | 1768 var num_stats_loaded = 0; |
| 1769 for (var key in stats_elements) { | 1769 for (var key in stats_elements) { |
| 1770 if (this.user.statistics[key].success) { | 1770 if (this.user.statistics[key].success) { |
| 1771 var count = this.user.statistics[key].count; | 1771 var count = this.user.statistics[key].count; |
| 1772 stats_elements[key].textContent = count; | 1772 stats_elements[key].textContent = count; |
| 1773 total_count += count; | 1773 total_count += count; |
| 1774 num_stats_loaded++; | 1774 num_stats_loaded++; |
| 1775 } | 1775 } |
| 1776 } | 1776 } |
| 1777 | 1777 |
| 1778 // this.classList is used for selecting the appropriate dialog. | |
| 1779 if (total_count) | |
| 1780 this.classList.remove('has-no-stats'); | |
| 1781 | |
| 1782 var is_synced_user = this.user.emailAddress !== ""; | 1778 var is_synced_user = this.user.emailAddress !== ""; |
| 1783 // Write total number if all statistics are loaded. | 1779 // Write total number if all statistics are loaded. |
| 1784 if (num_stats_loaded === Object.keys(stats_elements).length) { | 1780 if (num_stats_loaded === Object.keys(stats_elements).length) { |
| 1785 if (!total_count) { | 1781 if (!total_count) { |
| 1786 this.classList.add('has-no-stats'); | |
| 1787 var message = loadTimeData.getString( | 1782 var message = loadTimeData.getString( |
| 1788 is_synced_user ? 'removeUserWarningTextSyncNoStats' : | 1783 is_synced_user ? 'removeUserWarningTextSyncNoStats' : |
| 1789 'removeUserWarningTextNonSyncNoStats'); | 1784 'removeUserWarningTextNonSyncNoStats'); |
| 1790 this.updateRemoveWarningDialogSetMessage_(this.user.profilePath, | 1785 this.updateRemoveWarningDialogSetMessage_(this.user.profilePath, |
| 1791 message); | 1786 message); |
| 1792 } else { | 1787 } else { |
| 1793 window.updateRemoveWarningDialogSetMessage = | 1788 window.updateRemoveWarningDialogSetMessage = |
| 1794 this.updateRemoveWarningDialogSetMessage_.bind(this); | 1789 this.updateRemoveWarningDialogSetMessage_.bind(this); |
| 1795 chrome.send('getRemoveWarningDialogMessage',[{ | 1790 chrome.send('getRemoveWarningDialogMessage',[{ |
| 1796 profilePath: this.user.profilePath, | 1791 profilePath: this.user.profilePath, |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2546 | 2541 |
| 2547 var isLockedUser = this.user.needsSignin; | 2542 var isLockedUser = this.user.needsSignin; |
| 2548 var isLegacySupervisedUser = this.user.legacySupervisedUser; | 2543 var isLegacySupervisedUser = this.user.legacySupervisedUser; |
| 2549 var isChildUser = this.user.childUser; | 2544 var isChildUser = this.user.childUser; |
| 2550 var isSyncedUser = this.user.emailAddress !== ""; | 2545 var isSyncedUser = this.user.emailAddress !== ""; |
| 2551 var isProfileLoaded = this.user.isProfileLoaded; | 2546 var isProfileLoaded = this.user.isProfileLoaded; |
| 2552 this.classList.toggle('locked', isLockedUser); | 2547 this.classList.toggle('locked', isLockedUser); |
| 2553 this.classList.toggle('legacy-supervised', isLegacySupervisedUser); | 2548 this.classList.toggle('legacy-supervised', isLegacySupervisedUser); |
| 2554 this.classList.toggle('child', isChildUser); | 2549 this.classList.toggle('child', isChildUser); |
| 2555 this.classList.toggle('synced', isSyncedUser); | 2550 this.classList.toggle('synced', isSyncedUser); |
| 2556 this.classList.toggle('has-no-stats', | |
| 2557 !isProfileLoaded && !this.user.statistics.length); | |
| 2558 | 2551 |
| 2559 if (this.isAuthTypeUserClick) | 2552 if (this.isAuthTypeUserClick) |
| 2560 this.passwordLabelElement.textContent = this.authValue; | 2553 this.passwordLabelElement.textContent = this.authValue; |
| 2561 | 2554 |
| 2562 this.passwordElement.setAttribute('aria-label', loadTimeData.getStringF( | 2555 this.passwordElement.setAttribute('aria-label', loadTimeData.getStringF( |
| 2563 'passwordFieldAccessibleName', this.user_.emailAddress)); | 2556 'passwordFieldAccessibleName', this.user_.emailAddress)); |
| 2564 | 2557 |
| 2565 UserPod.prototype.updateActionBoxArea.call(this); | 2558 UserPod.prototype.updateActionBoxArea.call(this); |
| 2566 }, | 2559 }, |
| 2567 | 2560 |
| (...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3987 if (pod && pod.multiProfilesPolicyApplied) { | 3980 if (pod && pod.multiProfilesPolicyApplied) { |
| 3988 pod.userTypeBubbleElement.classList.remove('bubble-shown'); | 3981 pod.userTypeBubbleElement.classList.remove('bubble-shown'); |
| 3989 } | 3982 } |
| 3990 } | 3983 } |
| 3991 }; | 3984 }; |
| 3992 | 3985 |
| 3993 return { | 3986 return { |
| 3994 PodRow: PodRow | 3987 PodRow: PodRow |
| 3995 }; | 3988 }; |
| 3996 }); | 3989 }); |
| OLD | NEW |