| 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: [ | 18 behaviors: [ |
| 19 settings.RouteObserverBehavior, | 19 settings.RouteObserverBehavior, |
| 20 ], | 20 ], |
| 21 | 21 |
| 22 properties: { | 22 properties: { |
| 23 /** | 23 /** |
| 24 * Current list of whitelisted users. | 24 * Current list of whitelisted users. |
| 25 * @private {!Array<!chrome.usersPrivate.User>} | 25 * @private {!Array<!chrome.usersPrivate.User>} |
| 26 */ | 26 */ |
| 27 users_: { | 27 users_: { |
| 28 type: Array, | 28 type: Array, |
| 29 value: function() { return []; }, | 29 value: function() { |
| 30 return []; |
| 31 }, |
| 30 notify: true | 32 notify: true |
| 31 }, | 33 }, |
| 32 | 34 |
| 33 /** | 35 /** |
| 34 * Whether the user list is disabled, i.e. that no modifications can be | 36 * Whether the user list is disabled, i.e. that no modifications can be |
| 35 * made. | 37 * made. |
| 36 * @type {boolean} | 38 * @type {boolean} |
| 37 */ | 39 */ |
| 38 disabled: { | 40 disabled: {type: Boolean, value: false} |
| 39 type: Boolean, | |
| 40 value: false | |
| 41 } | |
| 42 }, | 41 }, |
| 43 | 42 |
| 44 /** @override */ | 43 /** @override */ |
| 45 ready: function() { | 44 ready: function() { |
| 46 chrome.settingsPrivate.onPrefsChanged.addListener(function(prefs) { | 45 chrome.settingsPrivate.onPrefsChanged.addListener(function(prefs) { |
| 47 prefs.forEach(function(pref) { | 46 prefs.forEach(function(pref) { |
| 48 if (pref.key == 'cros.accounts.users') { | 47 if (pref.key == 'cros.accounts.users') { |
| 49 chrome.usersPrivate.getWhitelistedUsers(function(users) { | 48 chrome.usersPrivate.getWhitelistedUsers(function(users) { |
| 50 this.setUsers_(users); | 49 this.setUsers_(users); |
| 51 }.bind(this)); | 50 }.bind(this)); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 /** @private */ | 88 /** @private */ |
| 90 shouldHideCloseButton_: function(disabled, isUserOwner) { | 89 shouldHideCloseButton_: function(disabled, isUserOwner) { |
| 91 return disabled || isUserOwner; | 90 return disabled || isUserOwner; |
| 92 }, | 91 }, |
| 93 | 92 |
| 94 /** @private */ | 93 /** @private */ |
| 95 getProfilePictureUrl_: function(username) { | 94 getProfilePictureUrl_: function(username) { |
| 96 return 'chrome://userimage/' + username + '?id=' + Date.now(); | 95 return 'chrome://userimage/' + username + '?id=' + Date.now(); |
| 97 } | 96 } |
| 98 }); | 97 }); |
| OLD | NEW |