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

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/accounts_options_handler.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/webui/options/chromeos/accounts_options_handler.h" 5 #include "chrome/browser/ui/webui/options/chromeos/accounts_options_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
14 #include "base/json/json_reader.h" 14 #include "base/json/json_reader.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" 19 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h"
20 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 20 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
21 #include "chrome/browser/chromeos/settings/cros_settings.h" 21 #include "chrome/browser/chromeos/settings/cros_settings.h"
22 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/profiles/profile_metrics.h" 23 #include "chrome/browser/profiles/profile_metrics.h"
24 #include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h" 24 #include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h"
25 #include "chrome/grit/generated_resources.h" 25 #include "chrome/grit/generated_resources.h"
26 #include "chromeos/login/user_names.h"
27 #include "chromeos/settings/cros_settings_names.h" 26 #include "chromeos/settings/cros_settings_names.h"
28 #include "components/prefs/pref_service.h" 27 #include "components/prefs/pref_service.h"
29 #include "components/user_manager/user_manager.h" 28 #include "components/user_manager/user_manager.h"
29 #include "components/user_manager/user_names.h"
30 #include "content/public/browser/web_ui.h" 30 #include "content/public/browser/web_ui.h"
31 #include "google_apis/gaia/gaia_auth_util.h" 31 #include "google_apis/gaia/gaia_auth_util.h"
32 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
33 33
34 namespace chromeos { 34 namespace chromeos {
35 35
36 namespace { 36 namespace {
37 37
38 // Adds specified user to the whitelist. Returns false if that user is already 38 // Adds specified user to the whitelist. Returns false if that user is already
39 // in the whitelist. 39 // in the whitelist.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 else 152 else
153 new_list.reset(new base::ListValue); 153 new_list.reset(new base::ListValue);
154 154
155 // Remove all supervised users. On the next step only supervised users present 155 // Remove all supervised users. On the next step only supervised users present
156 // on the device will be added back. Thus not present SU are removed. 156 // on the device will be added back. Thus not present SU are removed.
157 // No need to remove usual users as they can simply login back. 157 // No need to remove usual users as they can simply login back.
158 for (size_t i = 0; i < new_list->GetSize(); ++i) { 158 for (size_t i = 0; i < new_list->GetSize(); ++i) {
159 std::string whitelisted_user; 159 std::string whitelisted_user;
160 new_list->GetString(i, &whitelisted_user); 160 new_list->GetString(i, &whitelisted_user);
161 if (gaia::ExtractDomainName(whitelisted_user) == 161 if (gaia::ExtractDomainName(whitelisted_user) ==
162 chromeos::login::kSupervisedUserDomain) { 162 user_manager::kSupervisedUserDomain) {
163 new_list->Remove(i, NULL); 163 new_list->Remove(i, NULL);
164 --i; 164 --i;
165 } 165 }
166 } 166 }
167 167
168 const user_manager::UserList& users = 168 const user_manager::UserList& users =
169 user_manager::UserManager::Get()->GetUsers(); 169 user_manager::UserManager::Get()->GetUsers();
170 for (const auto* user : users) { 170 for (const auto* user : users) {
171 new_list->AppendIfNotPresent( 171 new_list->AppendIfNotPresent(
172 base::MakeUnique<base::StringValue>(user->email())); 172 base::MakeUnique<base::StringValue>(user->email()));
173 } 173 }
174 174
175 if (OwnerSettingsServiceChromeOS* service = 175 if (OwnerSettingsServiceChromeOS* service =
176 OwnerSettingsServiceChromeOS::FromWebUI(web_ui())) { 176 OwnerSettingsServiceChromeOS::FromWebUI(web_ui())) {
177 service->Set(kAccountsPrefUsers, *new_list.get()); 177 service->Set(kAccountsPrefUsers, *new_list.get());
178 } 178 }
179 } 179 }
180 180
181 } // namespace options 181 } // namespace options
182 } // namespace chromeos 182 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698