Chromium Code Reviews| 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 <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 // Sync's error handler. We use this to create sync errors. | 182 // Sync's error handler. We use this to create sync errors. |
| 183 std::unique_ptr<syncer::SyncErrorFactory> sync_error_factory_; | 183 std::unique_ptr<syncer::SyncErrorFactory> sync_error_factory_; |
| 184 | 184 |
| 185 // The datatype that this associator is responible for, either PREFERENCES or | 185 // The datatype that this associator is responible for, either PREFERENCES or |
| 186 // PRIORITY_PREFERENCES. | 186 // PRIORITY_PREFERENCES. |
| 187 syncer::ModelType type_; | 187 syncer::ModelType type_; |
| 188 | 188 |
| 189 private: | 189 private: |
| 190 // Map prefs to lists of observers. Observers will receive notification when | 190 // Map prefs to lists of observers. Observers will receive notification when |
| 191 // a pref changes, including the detail of whether or not the change came | 191 // a pref changes, including the detail of whether or not the change came |
| 192 // from sync. | 192 // from sync. |
|
battre
2016/09/22 16:44:24
I think that I would keep the typedef so that this
Avi (use Gerrit)
2016/09/22 19:17:17
Fixed.
| |
| 193 typedef base::ObserverList<SyncedPrefObserver> SyncedPrefObserverList; | 193 using SyncedPrefObserverList = base::ObserverList<SyncedPrefObserver>; |
| 194 typedef base::hash_map<std::string, SyncedPrefObserverList*> | |
| 195 SyncedPrefObserverMap; | |
| 196 | 194 |
| 197 void NotifySyncedPrefObservers(const std::string& path, bool from_sync) const; | 195 void NotifySyncedPrefObservers(const std::string& path, bool from_sync) const; |
| 198 | 196 |
| 199 SyncedPrefObserverMap synced_pref_observers_; | 197 base::hash_map<std::string, std::unique_ptr<SyncedPrefObserverList>> |
| 198 synced_pref_observers_; | |
| 200 const PrefModelAssociatorClient* client_; // Weak. | 199 const PrefModelAssociatorClient* client_; // Weak. |
| 201 | 200 |
| 202 std::vector<base::Closure> callback_list_; | 201 std::vector<base::Closure> callback_list_; |
| 203 | 202 |
| 204 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); | 203 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); |
| 205 }; | 204 }; |
| 206 | 205 |
| 207 } // namespace syncable_prefs | 206 } // namespace syncable_prefs |
| 208 | 207 |
| 209 #endif // COMPONENTS_SYNCABLE_PREFS_PREF_MODEL_ASSOCIATOR_H_ | 208 #endif // COMPONENTS_SYNCABLE_PREFS_PREF_MODEL_ASSOCIATOR_H_ |
| OLD | NEW |