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 <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 protected: | 122 protected: |
123 friend class PrefServiceSyncableTest; | 123 friend class PrefServiceSyncableTest; |
124 | 124 |
125 typedef std::map<std::string, syncer::SyncData> SyncDataMap; | 125 typedef std::map<std::string, syncer::SyncData> SyncDataMap; |
126 | 126 |
127 // Create an association for a given preference. If |sync_pref| is valid, | 127 // Create an association for a given preference. If |sync_pref| is valid, |
128 // signifying that sync has data for this preference, we reconcile their data | 128 // signifying that sync has data for this preference, we reconcile their data |
129 // with ours and append a new UPDATE SyncChange to |sync_changes|. If | 129 // with ours and append a new UPDATE SyncChange to |sync_changes|. If |
130 // sync_pref is not set, we append an ADD SyncChange to |sync_changes| with | 130 // sync_pref is not set, we append an ADD SyncChange to |sync_changes| with |
131 // the current preference data. | 131 // the current preference data. |
132 // |migrated_preference_list| points to a vector that may be updated with a | |
133 // string containing the old name of the preference described by |pref_name|. | |
134 // Note: We do not modify the sync data for preferences that are either | 132 // Note: We do not modify the sync data for preferences that are either |
135 // controlled by policy (are not user modifiable) or have their default value | 133 // controlled by policy (are not user modifiable) or have their default value |
136 // (are not user controlled). | 134 // (are not user controlled). |
137 void InitPrefAndAssociate(const syncer::SyncData& sync_pref, | 135 void InitPrefAndAssociate(const syncer::SyncData& sync_pref, |
138 const std::string& pref_name, | 136 const std::string& pref_name, |
139 syncer::SyncChangeList* sync_changes, | 137 syncer::SyncChangeList* sync_changes); |
140 SyncDataMap* migrated_preference_list); | |
141 | 138 |
142 static base::Value* MergeListValues( | 139 static base::Value* MergeListValues( |
143 const base::Value& from_value, const base::Value& to_value); | 140 const base::Value& from_value, const base::Value& to_value); |
144 static base::Value* MergeDictionaryValues(const base::Value& from_value, | 141 static base::Value* MergeDictionaryValues(const base::Value& from_value, |
145 const base::Value& to_value); | 142 const base::Value& to_value); |
146 | 143 |
147 // Do we have an active association between the preferences and sync models? | 144 // Do we have an active association between the preferences and sync models? |
148 // Set when start syncing, reset in StopSyncing. While this is not set, we | 145 // Set when start syncing, reset in StopSyncing. While this is not set, we |
149 // ignore any local preference changes (when we start syncing we will look | 146 // ignore any local preference changes (when we start syncing we will look |
150 // up the most recent values anyways). | 147 // up the most recent values anyways). |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 191 |
195 SyncedPrefObserverMap synced_pref_observers_; | 192 SyncedPrefObserverMap synced_pref_observers_; |
196 const PrefModelAssociatorClient* client_; // Weak. | 193 const PrefModelAssociatorClient* client_; // Weak. |
197 | 194 |
198 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); | 195 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); |
199 }; | 196 }; |
200 | 197 |
201 } // namespace syncable_prefs | 198 } // namespace syncable_prefs |
202 | 199 |
203 #endif // COMPONENTS_SYNCABLE_PREFS_PREF_MODEL_ASSOCIATOR_H_ | 200 #endif // COMPONENTS_SYNCABLE_PREFS_PREF_MODEL_ASSOCIATOR_H_ |
OLD | NEW |