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 "components/syncable_prefs/pref_model_associator.h" | 5 #include "components/syncable_prefs/pref_model_associator.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
8 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
9 #include "base/json/json_string_value_serializer.h" | 11 #include "base/json/json_string_value_serializer.h" |
10 #include "base/location.h" | 12 #include "base/location.h" |
11 #include "base/logging.h" | 13 #include "base/logging.h" |
12 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
13 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
14 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
15 #include "base/values.h" | 17 #include "base/values.h" |
16 #include "components/syncable_prefs/pref_model_associator_client.h" | 18 #include "components/syncable_prefs/pref_model_associator_client.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 const syncer::SyncDataList& initial_sync_data, | 160 const syncer::SyncDataList& initial_sync_data, |
159 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 161 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
160 scoped_ptr<syncer::SyncErrorFactory> sync_error_factory) { | 162 scoped_ptr<syncer::SyncErrorFactory> sync_error_factory) { |
161 DCHECK_EQ(type_, type); | 163 DCHECK_EQ(type_, type); |
162 DCHECK(CalledOnValidThread()); | 164 DCHECK(CalledOnValidThread()); |
163 DCHECK(pref_service_); | 165 DCHECK(pref_service_); |
164 DCHECK(!sync_processor_.get()); | 166 DCHECK(!sync_processor_.get()); |
165 DCHECK(sync_processor.get()); | 167 DCHECK(sync_processor.get()); |
166 DCHECK(sync_error_factory.get()); | 168 DCHECK(sync_error_factory.get()); |
167 syncer::SyncMergeResult merge_result(type); | 169 syncer::SyncMergeResult merge_result(type); |
168 sync_processor_ = sync_processor.Pass(); | 170 sync_processor_ = std::move(sync_processor); |
169 sync_error_factory_ = sync_error_factory.Pass(); | 171 sync_error_factory_ = std::move(sync_error_factory); |
170 | 172 |
171 syncer::SyncChangeList new_changes; | 173 syncer::SyncChangeList new_changes; |
172 std::set<std::string> remaining_preferences = registered_preferences_; | 174 std::set<std::string> remaining_preferences = registered_preferences_; |
173 | 175 |
174 // Go through and check for all preferences we care about that sync already | 176 // Go through and check for all preferences we care about that sync already |
175 // knows about. | 177 // knows about. |
176 for (syncer::SyncDataList::const_iterator sync_iter = | 178 for (syncer::SyncDataList::const_iterator sync_iter = |
177 initial_sync_data.begin(); | 179 initial_sync_data.begin(); |
178 sync_iter != initial_sync_data.end(); | 180 sync_iter != initial_sync_data.end(); |
179 ++sync_iter) { | 181 ++sync_iter) { |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 SyncedPrefObserverMap::const_iterator observer_iter = | 529 SyncedPrefObserverMap::const_iterator observer_iter = |
528 synced_pref_observers_.find(path); | 530 synced_pref_observers_.find(path); |
529 if (observer_iter == synced_pref_observers_.end()) | 531 if (observer_iter == synced_pref_observers_.end()) |
530 return; | 532 return; |
531 SyncedPrefObserverList* observers = observer_iter->second; | 533 SyncedPrefObserverList* observers = observer_iter->second; |
532 FOR_EACH_OBSERVER(SyncedPrefObserver, *observers, | 534 FOR_EACH_OBSERVER(SyncedPrefObserver, *observers, |
533 OnSyncedPrefChanged(path, from_sync)); | 535 OnSyncedPrefChanged(path, from_sync)); |
534 } | 536 } |
535 | 537 |
536 } // namespace syncable_prefs | 538 } // namespace syncable_prefs |
OLD | NEW |