| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 | 6 * @fileoverview |
| 7 * 'settings-user-list' shows a list of users whitelisted on this Chrome OS | 7 * 'settings-user-list' shows a list of users whitelisted on this Chrome OS |
| 8 * device. | 8 * device. |
| 9 * | 9 * |
| 10 * Example: | 10 * Example: |
| 11 * | 11 * |
| 12 * <settings-user-list prefs="{{prefs}}"> | 12 * <settings-user-list prefs="{{prefs}}"> |
| 13 * </settings-user-list> | 13 * </settings-user-list> |
| 14 */ | 14 */ |
| 15 Polymer({ | 15 Polymer({ |
| 16 is: 'settings-user-list', | 16 is: 'settings-user-list', |
| 17 | 17 |
| 18 behaviors: [I18nBehavior, settings.RouteObserverBehavior], | 18 behaviors: [ |
| 19 CrScrollableBehavior, |
| 20 I18nBehavior, |
| 21 settings.RouteObserverBehavior, |
| 22 ], |
| 19 | 23 |
| 20 properties: { | 24 properties: { |
| 21 /** | 25 /** |
| 22 * Current list of whitelisted users. | 26 * Current list of whitelisted users. |
| 23 * @private {!Array<!chrome.usersPrivate.User>} | 27 * @private {!Array<!chrome.usersPrivate.User>} |
| 24 */ | 28 */ |
| 25 users_: { | 29 users_: { |
| 26 type: Array, | 30 type: Array, |
| 27 value: function() { | 31 value: function() { |
| 28 return []; | 32 return []; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 * @param {!Array<!chrome.usersPrivate.User>} users List of whitelisted users. | 81 * @param {!Array<!chrome.usersPrivate.User>} users List of whitelisted users. |
| 78 */ | 82 */ |
| 79 setUsers_: function(users) { | 83 setUsers_: function(users) { |
| 80 this.users_ = users; | 84 this.users_ = users; |
| 81 this.users_.sort(function(a, b) { | 85 this.users_.sort(function(a, b) { |
| 82 if (a.isOwner != b.isOwner) | 86 if (a.isOwner != b.isOwner) |
| 83 return b.isOwner ? 1 : -1; | 87 return b.isOwner ? 1 : -1; |
| 84 else | 88 else |
| 85 return -1; | 89 return -1; |
| 86 }); | 90 }); |
| 91 this.requestUpdateScroll(); |
| 87 }, | 92 }, |
| 88 | 93 |
| 89 /** | 94 /** |
| 90 * @private | 95 * @private |
| 91 * @param {!{model: !{item: !chrome.usersPrivate.User}}} e | 96 * @param {!{model: !{item: !chrome.usersPrivate.User}}} e |
| 92 */ | 97 */ |
| 93 removeUser_: function(e) { | 98 removeUser_: function(e) { |
| 94 chrome.usersPrivate.removeWhitelistedUser( | 99 chrome.usersPrivate.removeWhitelistedUser( |
| 95 e.model.item.email, /* callback */ function() {}); | 100 e.model.item.email, /* callback */ function() {}); |
| 96 }, | 101 }, |
| 97 | 102 |
| 98 /** @private */ | 103 /** @private */ |
| 99 shouldHideCloseButton_: function(disabled, isUserOwner) { | 104 shouldHideCloseButton_: function(disabled, isUserOwner) { |
| 100 return disabled || isUserOwner; | 105 return disabled || isUserOwner; |
| 101 }, | 106 }, |
| 102 | 107 |
| 103 /** | 108 /** |
| 104 * @param {chrome.usersPrivate.User} user | 109 * @param {chrome.usersPrivate.User} user |
| 105 * @private | 110 * @private |
| 106 */ | 111 */ |
| 107 getProfilePictureUrl_: function(user) { | 112 getProfilePictureUrl_: function(user) { |
| 108 return 'chrome://userimage/' + user.email + '?id=' + Date.now(); | 113 return 'chrome://userimage/' + user.email + '?id=' + Date.now(); |
| 109 } | 114 }, |
| 115 |
| 116 /** |
| 117 * @param {chrome.usersPrivate.User} user |
| 118 * @private |
| 119 */ |
| 120 shouldShowEmail_: function(user) { |
| 121 return !user.isSupervised && user.name != user.email; |
| 122 }, |
| 110 }); | 123 }); |
| OLD | NEW |