Chromium Code Reviews| Index: chrome/browser/resources/options/chromeos/accounts_options.js |
| diff --git a/chrome/browser/resources/options/chromeos/accounts_options.js b/chrome/browser/resources/options/chromeos/accounts_options.js |
| index 7132ddf7b7202a2fb923504e0147aa8899bcbd0f..50225a80742fd713ce39b1a3d5c1fccc598771b8 100644 |
| --- a/chrome/browser/resources/options/chromeos/accounts_options.js |
| +++ b/chrome/browser/resources/options/chromeos/accounts_options.js |
| @@ -40,7 +40,8 @@ cr.define('options', function() { |
| // If the current user is not the owner, show some warning, |
| // and do not show the user list. |
| - if (AccountsOptions.currentUserIsOwner()) { |
| + this.allowWhitelist_ = AccountsOptions.currentUserIsOwner(); |
|
James Hawkins
2011/12/02 18:12:01
"Forward declare" and document this variable.
Ivan Korotkov
2011/12/02 18:30:30
Done.
|
| + if (this.allowWhitelist_) { |
| options.accounts.UserList.decorate(userList); |
| } else { |
| if (!AccountsOptions.whitelistIsManaged()) { |
| @@ -66,7 +67,7 @@ cr.define('options', function() { |
| */ |
| updateControls_: function() { |
| $('userList').disabled = |
| - $('userNameEdit').disabled = !AccountsOptions.currentUserIsOwner() || |
| + $('userNameEdit').disabled = !this.allowWhitelist_ || |
| AccountsOptions.whitelistIsManaged() || |
| !$('useWhitelistCheck').checked; |
| }, |
| @@ -79,7 +80,7 @@ cr.define('options', function() { |
| handleVisibleChange_: function(e) { |
| if (this.visible) { |
| this.updateControls_(); |
| - if (AccountsOptions.currentUserIsOwner()) |
| + if (this.allowWhitelist_) |
| $('userList').redraw(); |
| } |
| }, |
| @@ -111,7 +112,8 @@ cr.define('options', function() { |
| * @param {Event} e Add event fired from userNameEdit. |
| */ |
| handleAddUser_: function(e) { |
| - AccountsOptions.addUsers([e.user]); |
| + console.log('Chrome -> whitelist "' + e.user.name + '" ' + e.user.email); |
|
James Hawkins
2011/12/02 18:12:01
Remove console spam.
Ivan Korotkov
2011/12/02 18:30:30
Oops, done.
|
| + chrome.send('whitelistUser', [e.user.email, e.user.name]); |
| } |
| }; |
| @@ -138,6 +140,7 @@ cr.define('options', function() { |
| /** |
| * Adds given users to userList. |
| + * @param {Array.<Object>} users Array of user info objects. |
| */ |
| AccountsOptions.addUsers = function(users) { |
| var userList = $('userList'); |
| @@ -148,11 +151,11 @@ cr.define('options', function() { |
| /** |
| * Update account picture. |
| - * @param {string} email Email of the user to update. |
| + * @param {string} username User for which to update the image. |
| */ |
| - AccountsOptions.updateAccountPicture = function(email) { |
| - if (this.currentUserIsOwner()) |
| - $('userList').updateAccountPicture(email); |
| + AccountsOptions.updateAccountPicture = function(username) { |
| + if (this.allowWhitelist_) |
| + $('userList').updateAccountPicture(username); |
| }; |
| // Export |