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..4081889f8e2aca87d1f42f968a41b346727d6047 100644 |
--- a/chrome/browser/resources/options/chromeos/accounts_options.js |
+++ b/chrome/browser/resources/options/chromeos/accounts_options.js |
@@ -3,7 +3,6 @@ |
// found in the LICENSE file. |
cr.define('options', function() { |
- |
var OptionsPage = options.OptionsPage; |
///////////////////////////////////////////////////////////////////////////// |
@@ -16,6 +15,8 @@ cr.define('options', function() { |
function AccountsOptions(model) { |
OptionsPage.call(this, 'accounts', templateData.accountsPageTabTitle, |
'accountsPage'); |
+ // Whether to show the whitelist. |
+ this.allowWhitelist_ = false; |
whywhat
2011/12/05 12:14:49
nit: rename to showWhitelist
Ivan Korotkov
2011/12/05 14:12:48
Done.
|
} |
cr.addSingletonGetter(AccountsOptions); |
@@ -40,7 +41,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(); |
+ if (this.allowWhitelist_) { |
options.accounts.UserList.decorate(userList); |
} else { |
if (!AccountsOptions.whitelistIsManaged()) { |
@@ -66,7 +68,7 @@ cr.define('options', function() { |
*/ |
updateControls_: function() { |
$('userList').disabled = |
- $('userNameEdit').disabled = !AccountsOptions.currentUserIsOwner() || |
+ $('userNameEdit').disabled = !this.allowWhitelist_ || |
AccountsOptions.whitelistIsManaged() || |
!$('useWhitelistCheck').checked; |
}, |
@@ -79,7 +81,7 @@ cr.define('options', function() { |
handleVisibleChange_: function(e) { |
if (this.visible) { |
this.updateControls_(); |
- if (AccountsOptions.currentUserIsOwner()) |
+ if (this.allowWhitelist_) |
$('userList').redraw(); |
} |
}, |
@@ -111,7 +113,7 @@ cr.define('options', function() { |
* @param {Event} e Add event fired from userNameEdit. |
*/ |
handleAddUser_: function(e) { |
- AccountsOptions.addUsers([e.user]); |
+ 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 |