summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/dom_ui/accounts_options_handler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/chromeos/dom_ui/accounts_options_handler.cc')
-rw-r--r--chrome/browser/chromeos/dom_ui/accounts_options_handler.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/chrome/browser/chromeos/dom_ui/accounts_options_handler.cc b/chrome/browser/chromeos/dom_ui/accounts_options_handler.cc
index 0176d7e..93361c6 100644
--- a/chrome/browser/chromeos/dom_ui/accounts_options_handler.cc
+++ b/chrome/browser/chromeos/dom_ui/accounts_options_handler.cc
@@ -31,6 +31,8 @@ void AccountsOptionsHandler::RegisterMessages() {
NewCallback(this, &AccountsOptionsHandler::UnwhitelistUser));
dom_ui_->RegisterMessageCallback("fetchUserPictures",
NewCallback(this, &AccountsOptionsHandler::FetchUserPictures));
+ dom_ui_->RegisterMessageCallback("whitelistExistingUsers",
+ NewCallback(this, &AccountsOptionsHandler::WhitelistExistingUsers));
}
void AccountsOptionsHandler::GetLocalizedValues(
@@ -97,4 +99,24 @@ void AccountsOptionsHandler::FetchUserPictures(const ListValue* args) {
user_pictures);
}
+void AccountsOptionsHandler::WhitelistExistingUsers(const ListValue* args) {
+ ListValue whitelist_users;
+
+ std::vector<UserManager::User> users = UserManager::Get()->GetUsers();
+ for (std::vector<UserManager::User>::const_iterator it = users.begin();
+ it < users.end(); ++it) {
+ const std::string& email = it->email();
+ if (!UserCrosSettingsProvider::IsEmailInCachedWhitelist(email)) {
+ DictionaryValue* user_dict = new DictionaryValue;
+ user_dict->SetString("name", it->GetDisplayName());
+ user_dict->SetString("email", email);
+ user_dict->SetBoolean("owner", false);
+
+ whitelist_users.Append(user_dict);
+ }
+ }
+
+ dom_ui_->CallJavascriptFunction(L"AccountsOptions.addUsers", whitelist_users);
+}
+
} // namespace chromeos