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

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

Issue 2452983002: ChromeOS: This CL moves chromeos/login/user_names* to user_mananger. (Closed)
Patch Set: Removed unused #includes Created 4 years, 1 month 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
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/chromeos/extensions/users_private/users_private_delegat e.h" 14 #include "chrome/browser/chromeos/extensions/users_private/users_private_delegat e.h"
15 #include "chrome/browser/chromeos/extensions/users_private/users_private_delegat e_factory.h" 15 #include "chrome/browser/chromeos/extensions/users_private/users_private_delegat e_factory.h"
16 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" 16 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h"
17 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact ory.h" 17 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact ory.h"
18 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 18 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
19 #include "chrome/browser/chromeos/profiles/profile_helper.h" 19 #include "chrome/browser/chromeos/profiles/profile_helper.h"
20 #include "chrome/browser/chromeos/settings/cros_settings.h" 20 #include "chrome/browser/chromeos/settings/cros_settings.h"
21 #include "chrome/browser/extensions/chrome_extension_function.h" 21 #include "chrome/browser/extensions/chrome_extension_function.h"
22 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/common/extensions/api/users_private.h" 23 #include "chrome/common/extensions/api/users_private.h"
24 #include "chromeos/login/user_names.h"
25 #include "chromeos/settings/cros_settings_names.h" 24 #include "chromeos/settings/cros_settings_names.h"
26 #include "components/user_manager/user_manager.h" 25 #include "components/user_manager/user_manager.h"
26 #include "components/user_manager/user_names.h"
27 #include "extensions/browser/extension_function_registry.h" 27 #include "extensions/browser/extension_function_registry.h"
28 #include "google_apis/gaia/gaia_auth_util.h" 28 #include "google_apis/gaia/gaia_auth_util.h"
29 29
30 namespace extensions { 30 namespace extensions {
31 31
32 //////////////////////////////////////////////////////////////////////////////// 32 ////////////////////////////////////////////////////////////////////////////////
33 // UsersPrivateGetWhitelistedUsersFunction 33 // UsersPrivateGetWhitelistedUsersFunction
34 34
35 UsersPrivateGetWhitelistedUsersFunction:: 35 UsersPrivateGetWhitelistedUsersFunction::
36 UsersPrivateGetWhitelistedUsersFunction() 36 UsersPrivateGetWhitelistedUsersFunction()
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 email_list.reset(new base::ListValue()); 69 email_list.reset(new base::ListValue());
70 } 70 }
71 71
72 // Remove all supervised users. On the next step only supervised users present 72 // Remove all supervised users. On the next step only supervised users present
73 // on the device will be added back. Thus not present SU are removed. 73 // on the device will be added back. Thus not present SU are removed.
74 // No need to remove usual users as they can simply login back. 74 // No need to remove usual users as they can simply login back.
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 user_manager::kSupervisedUserDomain) {
80 email_list->Remove(i, NULL); 80 email_list->Remove(i, NULL);
81 --i; 81 --i;
82 } 82 }
83 } 83 }
84 84
85 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); 85 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
86 const user_manager::UserList& users = user_manager->GetUsers(); 86 const user_manager::UserList& users = user_manager->GetUsers();
87 for (const auto* user : users) { 87 for (const auto* user : users) {
88 email_list->AppendIfNotPresent( 88 email_list->AppendIfNotPresent(
89 base::MakeUnique<base::StringValue>(user->email())); 89 base::MakeUnique<base::StringValue>(user->email()));
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 ExtensionFunction::ResponseAction 221 ExtensionFunction::ResponseAction
222 UsersPrivateIsWhitelistManagedFunction::Run() { 222 UsersPrivateIsWhitelistManagedFunction::Run() {
223 bool is_managed = g_browser_process->platform_part() 223 bool is_managed = g_browser_process->platform_part()
224 ->browser_policy_connector_chromeos() 224 ->browser_policy_connector_chromeos()
225 ->IsEnterpriseManaged(); 225 ->IsEnterpriseManaged();
226 return RespondNow( 226 return RespondNow(
227 OneArgument(base::MakeUnique<base::FundamentalValue>(is_managed))); 227 OneArgument(base::MakeUnique<base::FundamentalValue>(is_managed)));
228 } 228 }
229 229
230 } // namespace extensions 230 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/chrome_browser_main_chromeos.cc ('k') | chrome/browser/chromeos/login/chrome_restart_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698