OLD | NEW |
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 <string> | 10 #include <string> |
10 | 11 |
11 #include "base/bind.h" | 12 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
13 #include "base/json/json_reader.h" | 14 #include "base/json/json_reader.h" |
14 #include "base/memory/scoped_ptr.h" | |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" | 18 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" |
19 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 19 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
20 #include "chrome/browser/chromeos/settings/cros_settings.h" | 20 #include "chrome/browser/chromeos/settings/cros_settings.h" |
21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/profiles/profile_metrics.h" | 22 #include "chrome/browser/profiles/profile_metrics.h" |
23 #include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h" | 23 #include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h" |
24 #include "chrome/grit/generated_resources.h" | 24 #include "chrome/grit/generated_resources.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 nullptr); | 135 nullptr); |
136 } | 136 } |
137 | 137 |
138 void AccountsOptionsHandler::HandleUpdateWhitelist( | 138 void AccountsOptionsHandler::HandleUpdateWhitelist( |
139 const base::ListValue* args) { | 139 const base::ListValue* args) { |
140 DCHECK(args && args->empty()); | 140 DCHECK(args && args->empty()); |
141 | 141 |
142 // Creates one list to set. This is needed because user white list update is | 142 // Creates one list to set. This is needed because user white list update is |
143 // asynchronous and sequential. Before previous write comes back, cached list | 143 // asynchronous and sequential. Before previous write comes back, cached list |
144 // is stale and should not be used for appending. See http://crbug.com/127215 | 144 // is stale and should not be used for appending. See http://crbug.com/127215 |
145 scoped_ptr<base::ListValue> new_list; | 145 std::unique_ptr<base::ListValue> new_list; |
146 | 146 |
147 CrosSettings* cros_settings = CrosSettings::Get(); | 147 CrosSettings* cros_settings = CrosSettings::Get(); |
148 const base::ListValue* existing = NULL; | 148 const base::ListValue* existing = NULL; |
149 if (cros_settings->GetList(kAccountsPrefUsers, &existing) && existing) | 149 if (cros_settings->GetList(kAccountsPrefUsers, &existing) && existing) |
150 new_list.reset(existing->DeepCopy()); | 150 new_list.reset(existing->DeepCopy()); |
151 else | 151 else |
152 new_list.reset(new base::ListValue); | 152 new_list.reset(new base::ListValue); |
153 | 153 |
154 // Remove all supervised users. On the next step only supervised users present | 154 // Remove all supervised users. On the next step only supervised users present |
155 // on the device will be added back. Thus not present SU are removed. | 155 // on the device will be added back. Thus not present SU are removed. |
(...skipping 16 matching lines...) Expand all Loading... |
172 new_list->AppendIfNotPresent(new base::StringValue((*it)->email())); | 172 new_list->AppendIfNotPresent(new base::StringValue((*it)->email())); |
173 | 173 |
174 if (OwnerSettingsServiceChromeOS* service = | 174 if (OwnerSettingsServiceChromeOS* service = |
175 OwnerSettingsServiceChromeOS::FromWebUI(web_ui())) { | 175 OwnerSettingsServiceChromeOS::FromWebUI(web_ui())) { |
176 service->Set(kAccountsPrefUsers, *new_list.get()); | 176 service->Set(kAccountsPrefUsers, *new_list.get()); |
177 } | 177 } |
178 } | 178 } |
179 | 179 |
180 } // namespace options | 180 } // namespace options |
181 } // namespace chromeos | 181 } // namespace chromeos |
OLD | NEW |