Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / resources / settings / users_page / user_list.js
blobdae00f5ba9cf20e030192ffe05edb7204530fe45
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
3 // found in the LICENSE file.
5 /**
6 * @fileoverview
7 * 'cr-settings-user-list' shows a list of users whitelisted on this Chrome OS
8 * device.
10 * Example:
12 * <cr-settings-user-list prefs="{{prefs}}">
13 * </cr-settings-user-list>
15 * @group Chrome Settings Elements
16 * @element cr-settings-user-list
18 Polymer({
19 is: 'cr-settings-user-list',
21 properties: {
22 /**
23 * Current list of whitelisted users.
24 * @type {!Array<!User>}
26 users: {
27 type: Array,
28 value: function() { return []; },
29 notify: true
32 /**
33 * Whether the user list is disabled, i.e. that no modifications can be
34 * made.
35 * @type {boolean}
37 disabled: {
38 type: Boolean,
39 value: false
43 /** @override */
44 ready: function() {
45 chrome.settingsPrivate.onPrefsChanged.addListener(function(prefs) {
46 prefs.forEach(function(pref) {
47 if (pref.key == 'cros.accounts.users') {
48 chrome.usersPrivate.getWhitelistedUsers(function(users) {
49 this.users = users;
50 }.bind(this));
52 }, this);
53 }.bind(this));
55 chrome.usersPrivate.getWhitelistedUsers(function(users) {
56 this.users = users;
57 }.bind(this));
60 /** @private */
61 removeUser_: function(e) {
62 chrome.usersPrivate.removeWhitelistedUser(
63 e.model.item.email, /* callback */ function() {});
66 /** @private */
67 shouldHideCloseButton_: function(disabled, isUserOwner) {
68 return disabled || isUserOwner;
70 });