| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 protected: | 111 protected: |
| 112 friend class ProfileSyncServicePreferenceTest; | 112 friend class ProfileSyncServicePreferenceTest; |
| 113 | 113 |
| 114 typedef std::map<std::string, syncer::SyncData> SyncDataMap; | 114 typedef std::map<std::string, syncer::SyncData> SyncDataMap; |
| 115 | 115 |
| 116 // Create an association for a given preference. If |sync_pref| is valid, | 116 // Create an association for a given preference. If |sync_pref| is valid, |
| 117 // signifying that sync has data for this preference, we reconcile their data | 117 // signifying that sync has data for this preference, we reconcile their data |
| 118 // with ours and append a new UPDATE SyncChange to |sync_changes|. If | 118 // with ours and append a new UPDATE SyncChange to |sync_changes|. If |
| 119 // sync_pref is not set, we append an ADD SyncChange to |sync_changes| with | 119 // sync_pref is not set, we append an ADD SyncChange to |sync_changes| with |
| 120 // the current preference data. | 120 // the current preference data. |
| 121 // |migrated_preference_list| points to a vector that may be updated with a |
| 122 // string containing the old name of the preference described by |pref_name|. |
| 121 // Note: We do not modify the sync data for preferences that are either | 123 // Note: We do not modify the sync data for preferences that are either |
| 122 // controlled by policy (are not user modifiable) or have their default value | 124 // controlled by policy (are not user modifiable) or have their default value |
| 123 // (are not user controlled). | 125 // (are not user controlled). |
| 124 void InitPrefAndAssociate(const syncer::SyncData& sync_pref, | 126 void InitPrefAndAssociate(const syncer::SyncData& sync_pref, |
| 125 const std::string& pref_name, | 127 const std::string& pref_name, |
| 126 syncer::SyncChangeList* sync_changes); | 128 syncer::SyncChangeList* sync_changes, |
| 129 SyncDataMap* migrated_preference_list); |
| 127 | 130 |
| 128 static base::Value* MergeListValues( | 131 static base::Value* MergeListValues( |
| 129 const base::Value& from_value, const base::Value& to_value); | 132 const base::Value& from_value, const base::Value& to_value); |
| 130 static base::Value* MergeDictionaryValues(const base::Value& from_value, | 133 static base::Value* MergeDictionaryValues(const base::Value& from_value, |
| 131 const base::Value& to_value); | 134 const base::Value& to_value); |
| 132 | 135 |
| 133 // Do we have an active association between the preferences and sync models? | 136 // Do we have an active association between the preferences and sync models? |
| 134 // Set when start syncing, reset in StopSyncing. While this is not set, we | 137 // Set when start syncing, reset in StopSyncing. While this is not set, we |
| 135 // ignore any local preference changes (when we start syncing we will look | 138 // ignore any local preference changes (when we start syncing we will look |
| 136 // up the most recent values anyways). | 139 // up the most recent values anyways). |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 SyncedPrefObserverMap; | 180 SyncedPrefObserverMap; |
| 178 | 181 |
| 179 void NotifySyncedPrefObservers(const std::string& path, bool from_sync) const; | 182 void NotifySyncedPrefObservers(const std::string& path, bool from_sync) const; |
| 180 | 183 |
| 181 SyncedPrefObserverMap synced_pref_observers_; | 184 SyncedPrefObserverMap synced_pref_observers_; |
| 182 | 185 |
| 183 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); | 186 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); |
| 184 }; | 187 }; |
| 185 | 188 |
| 186 #endif // CHROME_BROWSER_PREFS_PREF_MODEL_ASSOCIATOR_H_ | 189 #endif // CHROME_BROWSER_PREFS_PREF_MODEL_ASSOCIATOR_H_ |
| OLD | NEW |