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_SYNC_SYNC_PREFS_H_ | 5 #ifndef CHROME_BROWSER_SYNC_SYNC_PREFS_H_ |
6 #define CHROME_BROWSER_SYNC_SYNC_PREFS_H_ | 6 #define CHROME_BROWSER_SYNC_SYNC_PREFS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 virtual void Observe(int type, | 111 virtual void Observe(int type, |
112 const content::NotificationSource& source, | 112 const content::NotificationSource& source, |
113 const content::NotificationDetails& details) OVERRIDE; | 113 const content::NotificationDetails& details) OVERRIDE; |
114 | 114 |
115 // For testing. | 115 // For testing. |
116 | 116 |
117 void SetManagedForTest(bool is_managed); | 117 void SetManagedForTest(bool is_managed); |
118 syncable::ModelTypeSet GetAcknowledgeSyncedTypesForTest() const; | 118 syncable::ModelTypeSet GetAcknowledgeSyncedTypesForTest() const; |
119 | 119 |
120 private: | 120 private: |
| 121 void RegisterPrefGroups(); |
121 void RegisterPreferences(); | 122 void RegisterPreferences(); |
122 | 123 |
123 void RegisterDataTypePreferredPref( | 124 void RegisterDataTypePreferredPref( |
124 syncable::ModelType type, bool is_preferred); | 125 syncable::ModelType type, bool is_preferred); |
125 bool GetDataTypePreferred(syncable::ModelType type) const; | 126 bool GetDataTypePreferred(syncable::ModelType type) const; |
126 void SetDataTypePreferred(syncable::ModelType type, bool is_preferred); | 127 void SetDataTypePreferred(syncable::ModelType type, bool is_preferred); |
127 | 128 |
| 129 // Returns a ModelTypeSet based on |types| expanded to include pref groups |
| 130 // (see |pref_groups_|), but as a subset of |registered_types|. |
| 131 syncable::ModelTypeSet ResolvePrefGroups( |
| 132 syncable::ModelTypeSet registered_types, |
| 133 syncable::ModelTypeSet types) const; |
| 134 |
128 base::NonThreadSafe non_thread_safe_; | 135 base::NonThreadSafe non_thread_safe_; |
129 | 136 |
130 // May be NULL. | 137 // May be NULL. |
131 PrefService* const pref_service_; | 138 PrefService* const pref_service_; |
132 | 139 |
133 ObserverList<SyncPrefObserver> sync_pref_observers_; | 140 ObserverList<SyncPrefObserver> sync_pref_observers_; |
134 | 141 |
135 // The preference that controls whether sync is under control by | 142 // The preference that controls whether sync is under control by |
136 // configuration management. | 143 // configuration management. |
137 BooleanPrefMember pref_sync_managed_; | 144 BooleanPrefMember pref_sync_managed_; |
138 | 145 |
| 146 // Groups of prefs that always have the same value as a "master" pref. |
| 147 // For example, the APPS group has {APP_NOTIFICATIONS, APP_SETTINGS} |
| 148 // (as well as APPS, but that is implied), so |
| 149 // pref_groups_[syncable::APPS] = { syncable::APP_NOTIFICATIONS, |
| 150 // syncable::APP_SETTINGS } |
| 151 // pref_groups_[syncable::EXTENSIONS] = { syncable::EXTENSION_SETTINGS } |
| 152 // etc. |
| 153 typedef std::map<syncable::ModelType, syncable::ModelTypeSet> PrefGroupsMap; |
| 154 PrefGroupsMap pref_groups_; |
| 155 |
139 DISALLOW_COPY_AND_ASSIGN(SyncPrefs); | 156 DISALLOW_COPY_AND_ASSIGN(SyncPrefs); |
140 }; | 157 }; |
141 | 158 |
142 } // namespace browser_sync | 159 } // namespace browser_sync |
143 | 160 |
144 #endif // CHROME_BROWSER_SYNC_SYNC_PREFS_H_ | 161 #endif // CHROME_BROWSER_SYNC_SYNC_PREFS_H_ |
OLD | NEW |