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> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/memory/weak_ptr.h" |
15 #include "base/threading/non_thread_safe.h" | 16 #include "base/threading/non_thread_safe.h" |
16 #include "chrome/browser/prefs/pref_service.h" | 17 #include "chrome/browser/prefs/pref_service.h" |
17 #include "chrome/browser/sync/api/syncable_service.h" | 18 #include "chrome/browser/sync/api/syncable_service.h" |
18 #include "chrome/browser/sync/api/sync_data.h" | 19 #include "chrome/browser/sync/api/sync_data.h" |
19 | 20 |
20 namespace sync_pb { | 21 namespace sync_pb { |
21 class PreferenceSpecifics; | 22 class PreferenceSpecifics; |
22 } | 23 } |
23 | 24 |
24 namespace base { | 25 namespace base { |
25 class Value; | 26 class Value; |
26 } | 27 } |
27 | 28 |
28 // Contains all preference sync related logic. | 29 // Contains all preference sync related logic. |
29 // TODO(sync): Merge this into PrefService once we separate the profile | 30 // TODO(sync): Merge this into PrefService once we separate the profile |
30 // PrefService from the local state PrefService. | 31 // PrefService from the local state PrefService. |
31 class PrefModelAssociator | 32 class PrefModelAssociator |
32 : public SyncableService, | 33 : public SyncableService, |
| 34 public base::SupportsWeakPtr<PrefModelAssociator>, |
33 public base::NonThreadSafe { | 35 public base::NonThreadSafe { |
34 public: | 36 public: |
35 explicit PrefModelAssociator(PrefService* pref_service); | 37 explicit PrefModelAssociator(PrefService* pref_service); |
36 virtual ~PrefModelAssociator(); | 38 virtual ~PrefModelAssociator(); |
37 | 39 |
38 // SyncableService implementation. | 40 // SyncableService implementation. |
39 virtual SyncDataList GetAllSyncData(syncable::ModelType type) const OVERRIDE; | 41 virtual SyncDataList GetAllSyncData(syncable::ModelType type) const OVERRIDE; |
40 virtual SyncError ProcessSyncChanges( | 42 virtual SyncError ProcessSyncChanges( |
41 const tracked_objects::Location& from_here, | 43 const tracked_objects::Location& from_here, |
42 const SyncChangeList& change_list) OVERRIDE; | 44 const SyncChangeList& change_list) OVERRIDE; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // The PrefService we are syncing to. | 139 // The PrefService we are syncing to. |
138 PrefService* pref_service_; | 140 PrefService* pref_service_; |
139 | 141 |
140 // Sync's SyncChange handler. We push all our changes through this. | 142 // Sync's SyncChange handler. We push all our changes through this. |
141 SyncChangeProcessor* sync_processor_; | 143 SyncChangeProcessor* sync_processor_; |
142 | 144 |
143 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); | 145 DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); |
144 }; | 146 }; |
145 | 147 |
146 #endif // CHROME_BROWSER_PREFS_PREF_MODEL_ASSOCIATOR_H_ | 148 #endif // CHROME_BROWSER_PREFS_PREF_MODEL_ASSOCIATOR_H_ |
OLD | NEW |