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

Side by Side Diff: chrome/browser/chromeos/extensions/users_private/users_private_api.cc

Issue 2259943003: Settings People CrOS: Display supervised users' names correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test variables Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/extensions/users_private/users_private_api.h" 5 #include "chrome/browser/chromeos/extensions/users_private/users_private_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 for (size_t i = 0; i < email_list->GetSize(); ++i) { 75 for (size_t i = 0; i < email_list->GetSize(); ++i) {
76 std::string whitelisted_user; 76 std::string whitelisted_user;
77 email_list->GetString(i, &whitelisted_user); 77 email_list->GetString(i, &whitelisted_user);
78 if (gaia::ExtractDomainName(whitelisted_user) == 78 if (gaia::ExtractDomainName(whitelisted_user) ==
79 chromeos::login::kSupervisedUserDomain) { 79 chromeos::login::kSupervisedUserDomain) {
80 email_list->Remove(i, NULL); 80 email_list->Remove(i, NULL);
81 --i; 81 --i;
82 } 82 }
83 } 83 }
84 84
85 const user_manager::UserList& users = 85 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
86 user_manager::UserManager::Get()->GetUsers(); 86 const user_manager::UserList& users = user_manager->GetUsers();
87 for (user_manager::UserList::const_iterator it = users.begin(); 87 for (user_manager::UserList::const_iterator it = users.begin();
88 it < users.end(); ++it) 88 it < users.end(); ++it)
89 email_list->AppendIfNotPresent(new base::StringValue((*it)->email())); 89 email_list->AppendIfNotPresent(new base::StringValue((*it)->email()));
90 90
91 if (chromeos::OwnerSettingsServiceChromeOS* service = 91 if (chromeos::OwnerSettingsServiceChromeOS* service =
92 chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext( 92 chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext(
93 profile)) { 93 profile)) {
94 service->Set(chromeos::kAccountsPrefUsers, *email_list.get()); 94 service->Set(chromeos::kAccountsPrefUsers, *email_list.get());
95 } 95 }
96 96
97 // Now populate the list of User objects for returning to the JS. 97 // Now populate the list of User objects for returning to the JS.
98 for (size_t i = 0; i < email_list->GetSize(); ++i) { 98 for (size_t i = 0; i < email_list->GetSize(); ++i) {
99 api::users_private::User user; 99 api::users_private::User user;
100 email_list->GetString(i, &user.email); 100 email_list->GetString(i, &user.email);
101 101 user.name =
102 user_manager->GetUserDisplayEmail(AccountId::FromUserEmail(user.email));
102 user.is_owner = chromeos::ProfileHelper::IsOwnerProfile(profile) && 103 user.is_owner = chromeos::ProfileHelper::IsOwnerProfile(profile) &&
103 user.email == profile->GetProfileUserName(); 104 user.email == profile->GetProfileUserName();
104 user_list->Append(user.ToValue().release()); 105 user_list->Append(user.ToValue().release());
105 } 106 }
106 107
107 return RespondNow(OneArgument(std::move(user_list))); 108 return RespondNow(OneArgument(std::move(user_list)));
108 } 109 }
109 110
110 //////////////////////////////////////////////////////////////////////////////// 111 ////////////////////////////////////////////////////////////////////////////////
111 // UsersPrivateAddWhitelistedUserFunction 112 // UsersPrivateAddWhitelistedUserFunction
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 ExtensionFunction::ResponseAction 220 ExtensionFunction::ResponseAction
220 UsersPrivateIsWhitelistManagedFunction::Run() { 221 UsersPrivateIsWhitelistManagedFunction::Run() {
221 bool is_managed = g_browser_process->platform_part() 222 bool is_managed = g_browser_process->platform_part()
222 ->browser_policy_connector_chromeos() 223 ->browser_policy_connector_chromeos()
223 ->IsEnterpriseManaged(); 224 ->IsEnterpriseManaged();
224 return RespondNow( 225 return RespondNow(
225 OneArgument(base::MakeUnique<base::FundamentalValue>(is_managed))); 226 OneArgument(base::MakeUnique<base::FundamentalValue>(is_managed)));
226 } 227 }
227 228
228 } // namespace extensions 229 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698