Chromium Code Reviews| Index: chrome/browser/ui/webui/options/chromeos/accounts_options_handler.cc |
| diff --git a/chrome/browser/ui/webui/options/chromeos/accounts_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/accounts_options_handler.cc |
| index 0e4004792259885dd4529629ac2ccc4d232613b0..dae53b23ff830267518eb998bbf1424947646f96 100644 |
| --- a/chrome/browser/ui/webui/options/chromeos/accounts_options_handler.cc |
| +++ b/chrome/browser/ui/webui/options/chromeos/accounts_options_handler.cc |
| @@ -19,12 +19,14 @@ |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h" |
| #include "chrome/grit/generated_resources.h" |
| +#include "chromeos/login/user_names.h" |
| #include "chromeos/settings/cros_settings_names.h" |
| #include "components/user_manager/user_manager.h" |
| #include "content/public/browser/web_ui.h" |
| #include "google_apis/gaia/gaia_auth_util.h" |
| #include "ui/base/l10n/l10n_util.h" |
| + |
|
Nikita (slow)
2014/10/16 17:36:51
nit: drop this line
merkulova
2014/10/17 07:56:08
Done.
|
| namespace chromeos { |
| namespace { |
| @@ -57,8 +59,8 @@ void AccountsOptionsHandler::RegisterMessages() { |
| web_ui()->RegisterMessageCallback("unwhitelistUser", |
| base::Bind(&AccountsOptionsHandler::HandleUnwhitelistUser, |
| base::Unretained(this))); |
| - web_ui()->RegisterMessageCallback("whitelistExistingUsers", |
| - base::Bind(&AccountsOptionsHandler::HandleWhitelistExistingUsers, |
| + web_ui()->RegisterMessageCallback("updateWhitelist", |
| + base::Bind(&AccountsOptionsHandler::HandleUpdateWhitelist, |
| base::Unretained(this))); |
| } |
| @@ -119,10 +121,8 @@ void AccountsOptionsHandler::HandleUnwhitelistUser( |
| user_manager::UserManager::Get()->RemoveUser(email, NULL); |
| } |
| -void AccountsOptionsHandler::HandleWhitelistExistingUsers( |
| +void AccountsOptionsHandler::HandleUpdateWhitelist( |
| const base::ListValue* args) { |
| - DCHECK(args && args->empty()); |
|
Nikita (slow)
2014/10/16 17:36:51
I think this DCHECK should stay since argument lis
merkulova
2014/10/17 07:56:08
Done.
|
| - |
| // Creates one list to set. This is needed because user white list update is |
| // asynchronous and sequential. Before previous write comes back, cached list |
| // is stale and should not be used for appending. See http://crbug.com/127215 |
| @@ -135,6 +135,18 @@ void AccountsOptionsHandler::HandleWhitelistExistingUsers( |
| else |
| new_list.reset(new base::ListValue); |
| + // Remove supervised users if they're not present on the device; |
|
Nikita (slow)
2014/10/16 17:36:51
Not clear from the code where exactly do you check
merkulova
2014/10/17 07:56:08
Done.
Nikita (slow)
2014/10/17 11:05:11
Still it's not quite clear why supervised users ne
|
| + for (size_t i = 0; i < new_list->GetSize(); ++i) { |
| + std::string whitelisted_user; |
| + new_list->GetString(i, &whitelisted_user); |
| + LOG(ERROR) << gaia::ExtractDomainName(whitelisted_user); |
| + if (gaia::ExtractDomainName(whitelisted_user) == |
| + chromeos::login::kSupervisedUserDomain) { |
| + new_list->Remove(i, NULL); |
| + --i; |
| + } |
| + } |
| + |
| const user_manager::UserList& users = |
| user_manager::UserManager::Get()->GetUsers(); |
| for (user_manager::UserList::const_iterator it = users.begin(); |