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 CHROME_BROWSER_PREFS_PREF_MODEL_ASSOCIATOR_H_ | 5 #ifndef CHROME_BROWSER_PREFS_PREF_MODEL_ASSOCIATOR_H_ |
6 #define CHROME_BROWSER_PREFS_PREF_MODEL_ASSOCIATOR_H_ | 6 #define CHROME_BROWSER_PREFS_PREF_MODEL_ASSOCIATOR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 // Adds a SyncedPrefObserver to watch for changes to a specific pref. | 104 // Adds a SyncedPrefObserver to watch for changes to a specific pref. |
105 void AddSyncedPrefObserver(const std::string& name, | 105 void AddSyncedPrefObserver(const std::string& name, |
106 SyncedPrefObserver* observer); | 106 SyncedPrefObserver* observer); |
107 | 107 |
108 // Removes a SyncedPrefObserver from a pref's list of observers. | 108 // Removes a SyncedPrefObserver from a pref's list of observers. |
109 void RemoveSyncedPrefObserver(const std::string& name, | 109 void RemoveSyncedPrefObserver(const std::string& name, |
110 SyncedPrefObserver* observer); | 110 SyncedPrefObserver* observer); |
111 | 111 |
112 protected: | 112 protected: |
113 friend class ProfileSyncServicePreferenceTest; | 113 friend class PrefsSyncableServiceTest; |
114 | 114 |
115 typedef std::map<std::string, syncer::SyncData> SyncDataMap; | 115 typedef std::map<std::string, syncer::SyncData> SyncDataMap; |
116 | 116 |
117 // Create an association for a given preference. If |sync_pref| is valid, | 117 // Create an association for a given preference. If |sync_pref| is valid, |
118 // signifying that sync has data for this preference, we reconcile their data | 118 // signifying that sync has data for this preference, we reconcile their data |
119 // with ours and append a new UPDATE SyncChange to |sync_changes|. If | 119 // with ours and append a new UPDATE SyncChange to |sync_changes|. If |
120 // sync_pref is not set, we append an ADD SyncChange to |sync_changes| with | 120 // sync_pref is not set, we append an ADD SyncChange to |sync_changes| with |
121 // the current preference data. | 121 // the current preference data. |
122 // |migrated_preference_list| points to a vector that may be updated with a | 122 // |migrated_preference_list| points to a vector that may be updated with a |
123 // string containing the old name of the preference described by |pref_name|. | 123 // string containing the old name of the preference described by |pref_name|. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 SyncedPrefObserverMap; | 186 SyncedPrefObserverMap; |
187 | 187 |
188 void NotifySyncedPrefObservers(const std::string& path, bool from_sync) const; | 188 void NotifySyncedPrefObservers(const std::string& path, bool from_sync) const; |
189 | 189 |
190 SyncedPrefObserverMap synced_pref_observers_; | 190 SyncedPrefObserverMap synced_pref_observers_; |
191 | 191 |
192 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); | 192 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); |
193 }; | 193 }; |
194 | 194 |
195 #endif // CHROME_BROWSER_PREFS_PREF_MODEL_ASSOCIATOR_H_ | 195 #endif // CHROME_BROWSER_PREFS_PREF_MODEL_ASSOCIATOR_H_ |
OLD | NEW |