| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_SYNC_GLUE_PREFERENCE_MODEL_ASSOCIATOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_PREFERENCE_MODEL_ASSOCIATOR_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_PREFERENCE_MODEL_ASSOCIATOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_PREFERENCE_MODEL_ASSOCIATOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // Writes the value of pref into the specified node. Returns true | 102 // Writes the value of pref into the specified node. Returns true |
| 103 // upon success. | 103 // upon success. |
| 104 static bool WritePreferenceToNode(const std::string& name, | 104 static bool WritePreferenceToNode(const std::string& name, |
| 105 const Value& value, | 105 const Value& value, |
| 106 sync_api::WriteNode* node); | 106 sync_api::WriteNode* node); |
| 107 | 107 |
| 108 // Perform any additional operations that need to happen after a preference | 108 // Perform any additional operations that need to happen after a preference |
| 109 // has been updated. | 109 // has been updated. |
| 110 void AfterUpdateOperations(const std::string& pref_name); | 110 void AfterUpdateOperations(const std::string& pref_name); |
| 111 | 111 |
| 112 protected: | |
| 113 // Returns sync service instance. | |
| 114 ProfileSyncService* sync_service() { return sync_service_; } | |
| 115 | |
| 116 private: | 112 private: |
| 117 typedef std::map<std::string, int64> PreferenceNameToSyncIdMap; | 113 typedef std::map<std::string, int64> PreferenceNameToSyncIdMap; |
| 118 typedef std::map<int64, std::string> SyncIdToPreferenceNameMap; | 114 typedef std::map<int64, std::string> SyncIdToPreferenceNameMap; |
| 119 | 115 |
| 120 static Value* MergeListValues(const Value& from_value, const Value& to_value); | 116 static Value* MergeListValues(const Value& from_value, const Value& to_value); |
| 121 static Value* MergeDictionaryValues(const Value& from_value, | 117 static Value* MergeDictionaryValues(const Value& from_value, |
| 122 const Value& to_value); | 118 const Value& to_value); |
| 123 | 119 |
| 124 ProfileSyncService* sync_service_; | 120 ProfileSyncService* sync_service_; |
| 125 std::set<std::string> synced_preferences_; | 121 std::set<std::string> synced_preferences_; |
| 126 int64 preferences_node_id_; | 122 int64 preferences_node_id_; |
| 127 | 123 |
| 128 PreferenceNameToSyncIdMap id_map_; | 124 PreferenceNameToSyncIdMap id_map_; |
| 129 SyncIdToPreferenceNameMap id_map_inverse_; | 125 SyncIdToPreferenceNameMap id_map_inverse_; |
| 130 | 126 |
| 131 DISALLOW_COPY_AND_ASSIGN(PreferenceModelAssociator); | 127 DISALLOW_COPY_AND_ASSIGN(PreferenceModelAssociator); |
| 132 }; | 128 }; |
| 133 | 129 |
| 134 } // namespace browser_sync | 130 } // namespace browser_sync |
| 135 | 131 |
| 136 #endif // CHROME_BROWSER_SYNC_GLUE_PREFERENCE_MODEL_ASSOCIATOR_H_ | 132 #endif // CHROME_BROWSER_SYNC_GLUE_PREFERENCE_MODEL_ASSOCIATOR_H_ |
| OLD | NEW |