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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. |
193 typedef base::ObserverList<SyncedPrefObserver> SyncedPrefObserverList; | 193 using SyncedPrefObserverList = base::ObserverList<SyncedPrefObserver>; |
194 typedef base::hash_map<std::string, SyncedPrefObserverList*> | 194 using SyncedPrefObserverMap = |
195 SyncedPrefObserverMap; | 195 base::hash_map<std::string, std::unique_ptr<SyncedPrefObserverList>>; |
196 | 196 |
197 void NotifySyncedPrefObservers(const std::string& path, bool from_sync) const; | 197 void NotifySyncedPrefObservers(const std::string& path, bool from_sync) const; |
198 | 198 |
199 SyncedPrefObserverMap synced_pref_observers_; | 199 SyncedPrefObserverMap synced_pref_observers_; |
200 const PrefModelAssociatorClient* client_; // Weak. | 200 const PrefModelAssociatorClient* client_; // Weak. |
201 | 201 |
202 std::vector<base::Closure> callback_list_; | 202 std::vector<base::Closure> callback_list_; |
203 | 203 |
204 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); | 204 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); |
205 }; | 205 }; |
206 | 206 |
207 } // namespace syncable_prefs | 207 } // namespace syncable_prefs |
208 | 208 |
209 #endif // COMPONENTS_SYNCABLE_PREFS_PREF_MODEL_ASSOCIATOR_H_ | 209 #endif // COMPONENTS_SYNCABLE_PREFS_PREF_MODEL_ASSOCIATOR_H_ |
OLD | NEW |