Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(543)

Unified Diff: chrome/browser/chromeos/extensions/users_private/users_private_api.cc

Issue 2840313002: MD Settings: user list fixes (Closed)
Patch Set: Fix closure Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/settings/people_page/compiled_resources2.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/extensions/users_private/users_private_api.cc
diff --git a/chrome/browser/chromeos/extensions/users_private/users_private_api.cc b/chrome/browser/chromeos/extensions/users_private/users_private_api.cc
index df92a3c216bec1f5a1a600c745f6199746439460..351fae073de763d6c783ce5e503a93a2df67a54b 100644
--- a/chrome/browser/chromeos/extensions/users_private/users_private_api.cc
+++ b/chrome/browser/chromeos/extensions/users_private/users_private_api.cc
@@ -98,17 +98,25 @@ UsersPrivateGetWhitelistedUsersFunction::Run() {
// Now populate the list of User objects for returning to the JS.
for (size_t i = 0; i < email_list->GetSize(); ++i) {
- api::users_private::User user;
- email_list->GetString(i, &user.email);
- AccountId account_id = AccountId::FromUserEmail(user.email);
- user.name = base::UTF16ToUTF8(user_manager->GetUserDisplayName(account_id));
- if (user.name.empty()) {
- // User is not associated with a gaia account.
- user.name = user_manager->GetUserDisplayEmail(account_id);
+ std::string email;
+ email_list->GetString(i, &email);
+ AccountId account_id = AccountId::FromUserEmail(email);
+ const user_manager::User* user = user_manager->FindUser(account_id);
+ api::users_private::User api_user;
+ if (user) {
+ api_user.email = user->GetDisplayEmail();
+ api_user.name = base::UTF16ToUTF8(user->GetDisplayName());
+ api_user.is_owner =
+ user->GetAccountId() == user_manager->GetOwnerAccountId();
+ api_user.is_supervised = user->IsSupervised();
+ } else {
+ // User is unknown (i.e. not on device).
+ api_user.email = email;
+ api_user.name = email;
+ api_user.is_owner = false;
+ api_user.is_supervised = false;
}
- user.is_owner = chromeos::ProfileHelper::IsOwnerProfile(profile) &&
- user.email == profile->GetProfileUserName();
- user_list->Append(user.ToValue());
+ user_list->Append(api_user.ToValue());
}
return RespondNow(OneArgument(std::move(user_list)));
« no previous file with comments | « no previous file | chrome/browser/resources/settings/people_page/compiled_resources2.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698