| 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/file_path.h" | 8 #include "base/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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 base::Callback<void(PersistentPrefStore::PrefReadError)> | 255 base::Callback<void(PersistentPrefStore::PrefReadError)> |
| 256 read_error_callback, | 256 read_error_callback, |
| 257 bool async) { | 257 bool async) { |
| 258 PrefService::Initialize(pref_notifier, | 258 PrefService::Initialize(pref_notifier, |
| 259 pref_value_store, | 259 pref_value_store, |
| 260 user_prefs, | 260 user_prefs, |
| 261 default_store, | 261 default_store, |
| 262 read_error_callback, | 262 read_error_callback, |
| 263 async); | 263 async); |
| 264 | 264 |
| 265 pref_value_store->set_sync_associator(&pref_sync_associator_); | 265 pref_value_store->set_callback( |
| 266 base::Bind(&PrefModelAssociator::ProcessPrefChange, |
| 267 base::Unretained(&pref_sync_associator_))); |
| 266 } | 268 } |
| 267 | 269 |
| 268 void PrefServiceSyncable::OnIsSyncingChanged() { | 270 void PrefServiceSyncable::OnIsSyncingChanged() { |
| 269 FOR_EACH_OBSERVER(PrefServiceObserver, observer_list_, OnIsSyncingChanged()); | 271 FOR_EACH_OBSERVER(PrefServiceObserver, observer_list_, OnIsSyncingChanged()); |
| 270 } | 272 } |
| 271 | 273 |
| 272 void PrefServiceSyncable::RegisterSyncablePreference( | 274 void PrefServiceSyncable::RegisterSyncablePreference( |
| 273 const char* path, Value* default_value, PrefSyncStatus sync_status) { | 275 const char* path, Value* default_value, PrefSyncStatus sync_status) { |
| 274 PrefService::RegisterPreference(path, default_value); | 276 PrefService::RegisterPreference(path, default_value); |
| 275 // Register with sync if necessary. | 277 // Register with sync if necessary. |
| 276 if (sync_status == SYNCABLE_PREF) | 278 if (sync_status == SYNCABLE_PREF) |
| 277 pref_sync_associator_.RegisterPref(path); | 279 pref_sync_associator_.RegisterPref(path); |
| 278 } | 280 } |
| OLD | NEW |