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

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

Issue 2336863003: Change more base::ListValue methods to use std::unique_ptr. (Closed)
Patch Set: CrOS fixes + address danakj comment Created 4 years, 3 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 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 (user_manager::UserList::const_iterator it = users.begin(); 87 for (const auto& user : users)
danakj 2016/09/14 01:55:59 {}
dcheng 2016/09/14 03:06:11 Done.
88 it < users.end(); ++it) 88 email_list->AppendIfNotPresent(
89 email_list->AppendIfNotPresent(new base::StringValue((*it)->email())); 89 base::MakeUnique<base::StringValue>(user->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;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 ExtensionFunction::ResponseAction 220 ExtensionFunction::ResponseAction
221 UsersPrivateIsWhitelistManagedFunction::Run() { 221 UsersPrivateIsWhitelistManagedFunction::Run() {
222 bool is_managed = g_browser_process->platform_part() 222 bool is_managed = g_browser_process->platform_part()
223 ->browser_policy_connector_chromeos() 223 ->browser_policy_connector_chromeos()
224 ->IsEnterpriseManaged(); 224 ->IsEnterpriseManaged();
225 return RespondNow( 225 return RespondNow(
226 OneArgument(base::MakeUnique<base::FundamentalValue>(is_managed))); 226 OneArgument(base::MakeUnique<base::FundamentalValue>(is_managed)));
227 } 227 }
228 228
229 } // namespace extensions 229 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698