| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 base::Callback<void(PersistentPrefStore::PrefReadError)> | 71 base::Callback<void(PersistentPrefStore::PrefReadError)> |
| 72 read_error_callback, | 72 read_error_callback, |
| 73 bool async) | 73 bool async) |
| 74 : PrefService(pref_notifier, | 74 : PrefService(pref_notifier, |
| 75 pref_value_store, | 75 pref_value_store, |
| 76 user_prefs, | 76 user_prefs, |
| 77 default_store, | 77 default_store, |
| 78 read_error_callback, | 78 read_error_callback, |
| 79 async) { | 79 async) { |
| 80 pref_sync_associator_.SetPrefService(this); | 80 pref_sync_associator_.SetPrefService(this); |
| 81 pref_value_store->set_sync_associator(&pref_sync_associator_); | 81 |
| 82 pref_value_store->set_callback( |
| 83 base::Bind(&PrefModelAssociator::ProcessPrefChange, |
| 84 base::Unretained(&pref_sync_associator_))); |
| 82 } | 85 } |
| 83 | 86 |
| 84 PrefServiceSyncable::~PrefServiceSyncable() {} | 87 PrefServiceSyncable::~PrefServiceSyncable() {} |
| 85 | 88 |
| 86 PrefServiceSyncable* PrefServiceSyncable::CreateIncognitoPrefService( | 89 PrefServiceSyncable* PrefServiceSyncable::CreateIncognitoPrefService( |
| 87 PrefStore* incognito_extension_prefs) { | 90 PrefStore* incognito_extension_prefs) { |
| 88 pref_service_forked_ = true; | 91 pref_service_forked_ = true; |
| 89 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); | 92 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); |
| 90 OverlayUserPrefStore* incognito_pref_store = | 93 OverlayUserPrefStore* incognito_pref_store = |
| 91 new OverlayUserPrefStore(user_pref_store_.get()); | 94 new OverlayUserPrefStore(user_pref_store_.get()); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 FOR_EACH_OBSERVER(PrefServiceObserver, observer_list_, OnIsSyncingChanged()); | 267 FOR_EACH_OBSERVER(PrefServiceObserver, observer_list_, OnIsSyncingChanged()); |
| 265 } | 268 } |
| 266 | 269 |
| 267 void PrefServiceSyncable::RegisterSyncablePreference( | 270 void PrefServiceSyncable::RegisterSyncablePreference( |
| 268 const char* path, Value* default_value, PrefSyncStatus sync_status) { | 271 const char* path, Value* default_value, PrefSyncStatus sync_status) { |
| 269 PrefService::RegisterPreference(path, default_value); | 272 PrefService::RegisterPreference(path, default_value); |
| 270 // Register with sync if necessary. | 273 // Register with sync if necessary. |
| 271 if (sync_status == SYNCABLE_PREF) | 274 if (sync_status == SYNCABLE_PREF) |
| 272 pref_sync_associator_.RegisterPref(path); | 275 pref_sync_associator_.RegisterPref(path); |
| 273 } | 276 } |
| OLD | NEW |