| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // with ours and append a new UPDATE SyncChange to |sync_changes|. If | 97 // with ours and append a new UPDATE SyncChange to |sync_changes|. If |
| 98 // sync_pref is not set, we append an ADD SyncChange to |sync_changes| with | 98 // sync_pref is not set, we append an ADD SyncChange to |sync_changes| with |
| 99 // the current preference data. | 99 // the current preference data. |
| 100 // Note: We do not modify the sync data for preferences that are either | 100 // Note: We do not modify the sync data for preferences that are either |
| 101 // controlled by policy (are not user modifiable) or have their default value | 101 // controlled by policy (are not user modifiable) or have their default value |
| 102 // (are not user controlled). | 102 // (are not user controlled). |
| 103 void InitPrefAndAssociate(const SyncData& sync_pref, | 103 void InitPrefAndAssociate(const SyncData& sync_pref, |
| 104 const std::string& pref_name, | 104 const std::string& pref_name, |
| 105 SyncChangeList* sync_changes); | 105 SyncChangeList* sync_changes); |
| 106 | 106 |
| 107 // Perform any additional local operations that need to happen after a | |
| 108 // preference has been updated. | |
| 109 void SendUpdateNotificationsIfNecessary(const std::string& pref_name); | |
| 110 | |
| 111 static base::Value* MergeListValues( | 107 static base::Value* MergeListValues( |
| 112 const base::Value& from_value, const base::Value& to_value); | 108 const base::Value& from_value, const base::Value& to_value); |
| 113 static base::Value* MergeDictionaryValues(const base::Value& from_value, | 109 static base::Value* MergeDictionaryValues(const base::Value& from_value, |
| 114 const base::Value& to_value); | 110 const base::Value& to_value); |
| 115 | 111 |
| 116 // Do we have an active association between the preferences and sync models? | 112 // Do we have an active association between the preferences and sync models? |
| 117 // Set when start syncing, reset in StopSyncing. While this is not set, we | 113 // Set when start syncing, reset in StopSyncing. While this is not set, we |
| 118 // ignore any local preference changes (when we start syncing we will look | 114 // ignore any local preference changes (when we start syncing we will look |
| 119 // up the most recent values anyways). | 115 // up the most recent values anyways). |
| 120 bool models_associated_; | 116 bool models_associated_; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 141 // The PrefService we are syncing to. | 137 // The PrefService we are syncing to. |
| 142 PrefService* pref_service_; | 138 PrefService* pref_service_; |
| 143 | 139 |
| 144 // Sync's SyncChange handler. We push all our changes through this. | 140 // Sync's SyncChange handler. We push all our changes through this. |
| 145 SyncChangeProcessor* sync_processor_; | 141 SyncChangeProcessor* sync_processor_; |
| 146 | 142 |
| 147 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); | 143 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); |
| 148 }; | 144 }; |
| 149 | 145 |
| 150 #endif // CHROME_BROWSER_PREFS_PREF_MODEL_ASSOCIATOR_H_ | 146 #endif // CHROME_BROWSER_PREFS_PREF_MODEL_ASSOCIATOR_H_ |
| OLD | NEW |