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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_whitelist_service.cc

Issue 1878143002: Convert //chrome/browser/supervised_user from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/supervised_user/supervised_user_whitelist_service.h" 5 #include "chrome/browser/supervised_user/supervised_user_whitelist_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 whitelist->set_id(id); 137 whitelist->set_id(id);
138 whitelist->set_name(name); 138 whitelist->set_name(name);
139 139
140 return syncer::SyncData::CreateLocalData(id, name, specifics); 140 return syncer::SyncData::CreateLocalData(id, name, specifics);
141 } 141 }
142 142
143 syncer::SyncMergeResult 143 syncer::SyncMergeResult
144 SupervisedUserWhitelistService::MergeDataAndStartSyncing( 144 SupervisedUserWhitelistService::MergeDataAndStartSyncing(
145 syncer::ModelType type, 145 syncer::ModelType type,
146 const syncer::SyncDataList& initial_sync_data, 146 const syncer::SyncDataList& initial_sync_data,
147 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, 147 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor,
148 scoped_ptr<syncer::SyncErrorFactory> error_handler) { 148 std::unique_ptr<syncer::SyncErrorFactory> error_handler) {
149 DCHECK_EQ(syncer::SUPERVISED_USER_WHITELISTS, type); 149 DCHECK_EQ(syncer::SUPERVISED_USER_WHITELISTS, type);
150 150
151 syncer::SyncChangeList change_list; 151 syncer::SyncChangeList change_list;
152 syncer::SyncMergeResult result(syncer::SUPERVISED_USER_WHITELISTS); 152 syncer::SyncMergeResult result(syncer::SUPERVISED_USER_WHITELISTS);
153 153
154 DictionaryPrefUpdate update(prefs_, prefs::kSupervisedUserWhitelists); 154 DictionaryPrefUpdate update(prefs_, prefs::kSupervisedUserWhitelists);
155 base::DictionaryValue* pref_dict = update.Get(); 155 base::DictionaryValue* pref_dict = update.Get();
156 result.set_num_items_before_association(pref_dict->size()); 156 result.set_num_items_before_association(pref_dict->size());
157 std::set<std::string> seen_ids; 157 std::set<std::string> seen_ids;
158 int num_items_added = 0; 158 int num_items_added = 0;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 273
274 return error; 274 return error;
275 } 275 }
276 276
277 void SupervisedUserWhitelistService::AddNewWhitelist( 277 void SupervisedUserWhitelistService::AddNewWhitelist(
278 base::DictionaryValue* pref_dict, 278 base::DictionaryValue* pref_dict,
279 const sync_pb::ManagedUserWhitelistSpecifics& whitelist) { 279 const sync_pb::ManagedUserWhitelistSpecifics& whitelist) {
280 base::RecordAction(base::UserMetricsAction("ManagedUsers_Whitelist_Added")); 280 base::RecordAction(base::UserMetricsAction("ManagedUsers_Whitelist_Added"));
281 281
282 RegisterWhitelist(whitelist.id(), whitelist.name(), FROM_SYNC); 282 RegisterWhitelist(whitelist.id(), whitelist.name(), FROM_SYNC);
283 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); 283 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
284 SetWhitelistProperties(dict.get(), whitelist); 284 SetWhitelistProperties(dict.get(), whitelist);
285 pref_dict->SetWithoutPathExpansion(whitelist.id(), dict.release()); 285 pref_dict->SetWithoutPathExpansion(whitelist.id(), dict.release());
286 } 286 }
287 287
288 void SupervisedUserWhitelistService::SetWhitelistProperties( 288 void SupervisedUserWhitelistService::SetWhitelistProperties(
289 base::DictionaryValue* dict, 289 base::DictionaryValue* dict,
290 const sync_pb::ManagedUserWhitelistSpecifics& whitelist) { 290 const sync_pb::ManagedUserWhitelistSpecifics& whitelist) {
291 dict->SetString(kName, whitelist.name()); 291 dict->SetString(kName, whitelist.name());
292 } 292 }
293 293
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 UMA_HISTOGRAM_TIMES("ManagedUsers.Whitelist.TotalLoadDuration", 357 UMA_HISTOGRAM_TIMES("ManagedUsers.Whitelist.TotalLoadDuration",
358 base::TimeTicks::Now() - start_time); 358 base::TimeTicks::Now() - start_time);
359 359
360 // If the whitelist has been unregistered in the mean time, ignore it. 360 // If the whitelist has been unregistered in the mean time, ignore it.
361 if (registered_whitelists_.count(id) == 0u) 361 if (registered_whitelists_.count(id) == 0u)
362 return; 362 return;
363 363
364 loaded_whitelists_[id] = whitelist; 364 loaded_whitelists_[id] = whitelist;
365 NotifyWhitelistsChanged(); 365 NotifyWhitelistsChanged();
366 } 366 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698