| 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_SYNC_PREFERENCES_PREF_MODEL_ASSOCIATOR_H_ | 5 #ifndef COMPONENTS_SYNC_PREFERENCES_PREF_MODEL_ASSOCIATOR_H_ |
| 6 #define COMPONENTS_SYNC_PREFERENCES_PREF_MODEL_ASSOCIATOR_H_ | 6 #define COMPONENTS_SYNC_PREFERENCES_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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // with ours and append a new UPDATE SyncChange to |sync_changes|. If | 134 // with ours and append a new UPDATE SyncChange to |sync_changes|. If |
| 135 // sync_pref is not set, we append an ADD SyncChange to |sync_changes| with | 135 // sync_pref is not set, we append an ADD SyncChange to |sync_changes| with |
| 136 // the current preference data. | 136 // the current preference data. |
| 137 // Note: We do not modify the sync data for preferences that are either | 137 // Note: We do not modify the sync data for preferences that are either |
| 138 // controlled by policy (are not user modifiable) or have their default value | 138 // controlled by policy (are not user modifiable) or have their default value |
| 139 // (are not user controlled). | 139 // (are not user controlled). |
| 140 void InitPrefAndAssociate(const syncer::SyncData& sync_pref, | 140 void InitPrefAndAssociate(const syncer::SyncData& sync_pref, |
| 141 const std::string& pref_name, | 141 const std::string& pref_name, |
| 142 syncer::SyncChangeList* sync_changes); | 142 syncer::SyncChangeList* sync_changes); |
| 143 | 143 |
| 144 static base::Value* MergeListValues(const base::Value& from_value, | 144 static std::unique_ptr<base::Value> MergeListValues( |
| 145 const base::Value& to_value); | 145 const base::Value& from_value, |
| 146 static base::Value* MergeDictionaryValues(const base::Value& from_value, | 146 const base::Value& to_value); |
| 147 const base::Value& to_value); | 147 static std::unique_ptr<base::Value> MergeDictionaryValues( |
| 148 const base::Value& from_value, |
| 149 const base::Value& to_value); |
| 148 | 150 |
| 149 // Do we have an active association between the preferences and sync models? | 151 // Do we have an active association between the preferences and sync models? |
| 150 // Set when start syncing, reset in StopSyncing. While this is not set, we | 152 // Set when start syncing, reset in StopSyncing. While this is not set, we |
| 151 // ignore any local preference changes (when we start syncing we will look | 153 // ignore any local preference changes (when we start syncing we will look |
| 152 // up the most recent values anyways). | 154 // up the most recent values anyways). |
| 153 bool models_associated_; | 155 bool models_associated_; |
| 154 | 156 |
| 155 // Whether we're currently processing changes from the syncer. While this is | 157 // Whether we're currently processing changes from the syncer. While this is |
| 156 // true, we ignore any local preference changes, since we triggered them. | 158 // true, we ignore any local preference changes, since we triggered them. |
| 157 bool processing_syncer_changes_; | 159 bool processing_syncer_changes_; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 const PrefModelAssociatorClient* client_; // Weak. | 200 const PrefModelAssociatorClient* client_; // Weak. |
| 199 | 201 |
| 200 std::vector<base::Closure> callback_list_; | 202 std::vector<base::Closure> callback_list_; |
| 201 | 203 |
| 202 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); | 204 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); |
| 203 }; | 205 }; |
| 204 | 206 |
| 205 } // namespace sync_preferences | 207 } // namespace sync_preferences |
| 206 | 208 |
| 207 #endif // COMPONENTS_SYNC_PREFERENCES_PREF_MODEL_ASSOCIATOR_H_ | 209 #endif // COMPONENTS_SYNC_PREFERENCES_PREF_MODEL_ASSOCIATOR_H_ |
| OLD | NEW |