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 #ifndef COMPONENTS_SYNCABLE_PREFS_PREF_MODEL_ASSOCIATOR_H_ | 5 #ifndef COMPONENTS_SYNCABLE_PREFS_PREF_MODEL_ASSOCIATOR_H_ |
6 #define COMPONENTS_SYNCABLE_PREFS_PREF_MODEL_ASSOCIATOR_H_ | 6 #define COMPONENTS_SYNCABLE_PREFS_PREF_MODEL_ASSOCIATOR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 void RemoveSyncedPrefObserver(const std::string& name, | 113 void RemoveSyncedPrefObserver(const std::string& name, |
114 SyncedPrefObserver* observer); | 114 SyncedPrefObserver* observer); |
115 | 115 |
116 // Returns the PrefModelAssociatorClient for this object. | 116 // Returns the PrefModelAssociatorClient for this object. |
117 const PrefModelAssociatorClient* client() const { return client_; } | 117 const PrefModelAssociatorClient* client() const { return client_; } |
118 | 118 |
119 // Set the PrefModelAssociatorClient to use for that object during tests. | 119 // Set the PrefModelAssociatorClient to use for that object during tests. |
120 void SetPrefModelAssociatorClientForTesting( | 120 void SetPrefModelAssociatorClientForTesting( |
121 const PrefModelAssociatorClient* client); | 121 const PrefModelAssociatorClient* client); |
122 | 122 |
123 static void SetMergeDataFinishedCallback(const base::Closure& callback); | |
raymes
2016/06/16 03:23:51
I don't think we will want these to be static. Ins
| |
124 static void ResetMergeDataFinishedCallback(); | |
125 | |
123 protected: | 126 protected: |
124 friend class PrefServiceSyncableTest; | 127 friend class PrefServiceSyncableTest; |
125 | 128 |
126 typedef std::map<std::string, syncer::SyncData> SyncDataMap; | 129 typedef std::map<std::string, syncer::SyncData> SyncDataMap; |
127 | 130 |
128 // Create an association for a given preference. If |sync_pref| is valid, | 131 // Create an association for a given preference. If |sync_pref| is valid, |
129 // signifying that sync has data for this preference, we reconcile their data | 132 // signifying that sync has data for this preference, we reconcile their data |
130 // with ours and append a new UPDATE SyncChange to |sync_changes|. If | 133 // with ours and append a new UPDATE SyncChange to |sync_changes|. If |
131 // sync_pref is not set, we append an ADD SyncChange to |sync_changes| with | 134 // sync_pref is not set, we append an ADD SyncChange to |sync_changes| with |
132 // the current preference data. | 135 // the current preference data. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 // from sync. | 189 // from sync. |
187 typedef base::ObserverList<SyncedPrefObserver> SyncedPrefObserverList; | 190 typedef base::ObserverList<SyncedPrefObserver> SyncedPrefObserverList; |
188 typedef base::hash_map<std::string, SyncedPrefObserverList*> | 191 typedef base::hash_map<std::string, SyncedPrefObserverList*> |
189 SyncedPrefObserverMap; | 192 SyncedPrefObserverMap; |
190 | 193 |
191 void NotifySyncedPrefObservers(const std::string& path, bool from_sync) const; | 194 void NotifySyncedPrefObservers(const std::string& path, bool from_sync) const; |
192 | 195 |
193 SyncedPrefObserverMap synced_pref_observers_; | 196 SyncedPrefObserverMap synced_pref_observers_; |
194 const PrefModelAssociatorClient* client_; // Weak. | 197 const PrefModelAssociatorClient* client_; // Weak. |
195 | 198 |
199 static base::Closure migrate_call_back_; | |
200 | |
196 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); | 201 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); |
197 }; | 202 }; |
198 | 203 |
199 } // namespace syncable_prefs | 204 } // namespace syncable_prefs |
200 | 205 |
201 #endif // COMPONENTS_SYNCABLE_PREFS_PREF_MODEL_ASSOCIATOR_H_ | 206 #endif // COMPONENTS_SYNCABLE_PREFS_PREF_MODEL_ASSOCIATOR_H_ |
OLD | NEW |