OLD | NEW |
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } | 97 } |
98 | 98 |
99 // Now populate the list of User objects for returning to the JS. | 99 // Now populate the list of User objects for returning to the JS. |
100 for (size_t i = 0; i < email_list->GetSize(); ++i) { | 100 for (size_t i = 0; i < email_list->GetSize(); ++i) { |
101 std::string email; | 101 std::string email; |
102 email_list->GetString(i, &email); | 102 email_list->GetString(i, &email); |
103 AccountId account_id = AccountId::FromUserEmail(email); | 103 AccountId account_id = AccountId::FromUserEmail(email); |
104 const user_manager::User* user = user_manager->FindUser(account_id); | 104 const user_manager::User* user = user_manager->FindUser(account_id); |
105 api::users_private::User api_user; | 105 api::users_private::User api_user; |
106 if (user) { | 106 if (user) { |
107 api_user.email = user->GetDisplayEmail(); | 107 api_user.email = email; |
| 108 api_user.display_email = user->GetDisplayEmail(); |
108 api_user.name = base::UTF16ToUTF8(user->GetDisplayName()); | 109 api_user.name = base::UTF16ToUTF8(user->GetDisplayName()); |
109 api_user.is_owner = | 110 api_user.is_owner = |
110 user->GetAccountId() == user_manager->GetOwnerAccountId(); | 111 user->GetAccountId() == user_manager->GetOwnerAccountId(); |
111 api_user.is_supervised = user->IsSupervised(); | 112 api_user.is_supervised = user->IsSupervised(); |
112 } else { | 113 } else { |
113 // User is unknown (i.e. not on device). | 114 // User is unknown (i.e. not on device). |
114 api_user.email = email; | 115 api_user.email = email; |
| 116 api_user.display_email = email; |
115 api_user.name = email; | 117 api_user.name = email; |
116 api_user.is_owner = false; | 118 api_user.is_owner = false; |
117 api_user.is_supervised = false; | 119 api_user.is_supervised = false; |
118 } | 120 } |
119 user_list->Append(api_user.ToValue()); | 121 user_list->Append(api_user.ToValue()); |
120 } | 122 } |
121 | 123 |
122 return RespondNow(OneArgument(std::move(user_list))); | 124 return RespondNow(OneArgument(std::move(user_list))); |
123 } | 125 } |
124 | 126 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 229 |
228 ExtensionFunction::ResponseAction | 230 ExtensionFunction::ResponseAction |
229 UsersPrivateIsWhitelistManagedFunction::Run() { | 231 UsersPrivateIsWhitelistManagedFunction::Run() { |
230 bool is_managed = g_browser_process->platform_part() | 232 bool is_managed = g_browser_process->platform_part() |
231 ->browser_policy_connector_chromeos() | 233 ->browser_policy_connector_chromeos() |
232 ->IsEnterpriseManaged(); | 234 ->IsEnterpriseManaged(); |
233 return RespondNow(OneArgument(base::MakeUnique<base::Value>(is_managed))); | 235 return RespondNow(OneArgument(base::MakeUnique<base::Value>(is_managed))); |
234 } | 236 } |
235 | 237 |
236 } // namespace extensions | 238 } // namespace extensions |
OLD | NEW |