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

Side by Side Diff: components/syncable_prefs/pref_model_associator.cc

Issue 2336863003: Change more base::ListValue methods to use std::unique_ptr. (Closed)
Patch Set: . 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 (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 "components/syncable_prefs/pref_model_associator.h" 5 #include "components/syncable_prefs/pref_model_associator.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 return from_value.DeepCopy(); 292 return from_value.DeepCopy();
293 293
294 DCHECK(from_value.GetType() == base::Value::TYPE_LIST); 294 DCHECK(from_value.GetType() == base::Value::TYPE_LIST);
295 DCHECK(to_value.GetType() == base::Value::TYPE_LIST); 295 DCHECK(to_value.GetType() == base::Value::TYPE_LIST);
296 const base::ListValue& from_list_value = 296 const base::ListValue& from_list_value =
297 static_cast<const base::ListValue&>(from_value); 297 static_cast<const base::ListValue&>(from_value);
298 const base::ListValue& to_list_value = 298 const base::ListValue& to_list_value =
299 static_cast<const base::ListValue&>(to_value); 299 static_cast<const base::ListValue&>(to_value);
300 base::ListValue* result = to_list_value.DeepCopy(); 300 base::ListValue* result = to_list_value.DeepCopy();
301 301
302 for (base::ListValue::const_iterator i = from_list_value.begin(); 302 for (const auto& value : from_list_value) {
303 i != from_list_value.end(); ++i) { 303 result->AppendIfNotPresent(value->CreateDeepCopy());
304 base::Value* value = (*i)->DeepCopy();
305 result->AppendIfNotPresent(value);
306 } 304 }
307 return result; 305 return result;
308 } 306 }
309 307
310 base::Value* PrefModelAssociator::MergeDictionaryValues( 308 base::Value* PrefModelAssociator::MergeDictionaryValues(
311 const base::Value& from_value, 309 const base::Value& from_value,
312 const base::Value& to_value) { 310 const base::Value& to_value) {
313 if (from_value.GetType() == base::Value::TYPE_NULL) 311 if (from_value.GetType() == base::Value::TYPE_NULL)
314 return to_value.DeepCopy(); 312 return to_value.DeepCopy();
315 if (to_value.GetType() == base::Value::TYPE_NULL) 313 if (to_value.GetType() == base::Value::TYPE_NULL)
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 SyncedPrefObserverMap::const_iterator observer_iter = 541 SyncedPrefObserverMap::const_iterator observer_iter =
544 synced_pref_observers_.find(path); 542 synced_pref_observers_.find(path);
545 if (observer_iter == synced_pref_observers_.end()) 543 if (observer_iter == synced_pref_observers_.end())
546 return; 544 return;
547 SyncedPrefObserverList* observers = observer_iter->second; 545 SyncedPrefObserverList* observers = observer_iter->second;
548 FOR_EACH_OBSERVER(SyncedPrefObserver, *observers, 546 FOR_EACH_OBSERVER(SyncedPrefObserver, *observers,
549 OnSyncedPrefChanged(path, from_sync)); 547 OnSyncedPrefChanged(path, from_sync));
550 } 548 }
551 549
552 } // namespace syncable_prefs 550 } // namespace syncable_prefs
OLDNEW
« no previous file with comments | « components/error_page/common/localized_error.cc ('k') | components/user_manager/user_manager_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698