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 #include "chrome/browser/prefs/pref_service_syncable.h" | 5 #include "chrome/browser/prefs/pref_service_syncable.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/prefs/default_pref_store.h" | 9 #include "base/prefs/default_pref_store.h" |
10 #include "base/prefs/overlay_user_pref_store.h" | 10 #include "base/prefs/overlay_user_pref_store.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 } | 140 } |
141 | 141 |
142 void PrefServiceSyncable::UpdateCommandLinePrefStore( | 142 void PrefServiceSyncable::UpdateCommandLinePrefStore( |
143 PrefStore* cmd_line_store) { | 143 PrefStore* cmd_line_store) { |
144 // If |pref_service_forked_| is true, then this PrefService and the forked | 144 // If |pref_service_forked_| is true, then this PrefService and the forked |
145 // copies will be out of sync. | 145 // copies will be out of sync. |
146 DCHECK(!pref_service_forked_); | 146 DCHECK(!pref_service_forked_); |
147 PrefService::UpdateCommandLinePrefStore(cmd_line_store); | 147 PrefService::UpdateCommandLinePrefStore(cmd_line_store); |
148 } | 148 } |
149 | 149 |
| 150 void PrefServiceSyncable::AddSyncedPrefObserver( |
| 151 const std::string& name, |
| 152 SyncedPrefObserver* observer) { |
| 153 pref_sync_associator_.AddSyncedPrefObserver(name, observer); |
| 154 priority_pref_sync_associator_.AddSyncedPrefObserver(name, observer); |
| 155 } |
| 156 |
| 157 void PrefServiceSyncable::RemoveSyncedPrefObserver( |
| 158 const std::string& name, |
| 159 SyncedPrefObserver* observer) { |
| 160 pref_sync_associator_.RemoveSyncedPrefObserver(name, observer); |
| 161 priority_pref_sync_associator_.RemoveSyncedPrefObserver(name, observer); |
| 162 } |
| 163 |
150 void PrefServiceSyncable::AddRegisteredSyncablePreference( | 164 void PrefServiceSyncable::AddRegisteredSyncablePreference( |
151 const char* path, | 165 const char* path, |
152 const user_prefs::PrefRegistrySyncable::PrefSyncStatus sync_status) { | 166 const user_prefs::PrefRegistrySyncable::PrefSyncStatus sync_status) { |
153 DCHECK(FindPreference(path)); | 167 DCHECK(FindPreference(path)); |
154 if (sync_status == user_prefs::PrefRegistrySyncable::SYNCABLE_PREF) { | 168 if (sync_status == user_prefs::PrefRegistrySyncable::SYNCABLE_PREF) { |
155 pref_sync_associator_.RegisterPref(path); | 169 pref_sync_associator_.RegisterPref(path); |
156 } else if (sync_status == | 170 } else if (sync_status == |
157 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF) { | 171 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF) { |
158 priority_pref_sync_associator_.RegisterPref(path); | 172 priority_pref_sync_associator_.RegisterPref(path); |
159 } else { | 173 } else { |
160 NOTREACHED() << "invalid sync_status: " << sync_status; | 174 NOTREACHED() << "invalid sync_status: " << sync_status; |
161 } | 175 } |
162 } | 176 } |
163 | 177 |
164 void PrefServiceSyncable::OnIsSyncingChanged() { | 178 void PrefServiceSyncable::OnIsSyncingChanged() { |
165 FOR_EACH_OBSERVER(PrefServiceSyncableObserver, observer_list_, | 179 FOR_EACH_OBSERVER(PrefServiceSyncableObserver, observer_list_, |
166 OnIsSyncingChanged()); | 180 OnIsSyncingChanged()); |
167 } | 181 } |
168 | 182 |
169 void PrefServiceSyncable::ProcessPrefChange(const std::string& name) { | 183 void PrefServiceSyncable::ProcessPrefChange(const std::string& name) { |
170 pref_sync_associator_.ProcessPrefChange(name); | 184 pref_sync_associator_.ProcessPrefChange(name); |
171 priority_pref_sync_associator_.ProcessPrefChange(name); | 185 priority_pref_sync_associator_.ProcessPrefChange(name); |
172 } | 186 } |
OLD | NEW |