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" |
11 #include "base/prefs/pref_notifier_impl.h" | 11 #include "base/prefs/pref_notifier_impl.h" |
12 #include "base/prefs/pref_registry.h" | 12 #include "base/prefs/pref_registry.h" |
13 #include "base/prefs/pref_value_store.h" | 13 #include "base/prefs/pref_value_store.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/value_conversions.h" | 15 #include "base/value_conversions.h" |
16 #include "chrome/browser/prefs/pref_model_associator.h" | 16 #include "chrome/browser/prefs/pref_model_associator.h" |
17 #include "chrome/browser/prefs/pref_service_syncable_observer.h" | 17 #include "chrome/browser/prefs/pref_service_syncable_observer.h" |
18 #include "chrome/browser/profiles/profile.h" | |
19 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" | 18 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" |
20 #include "components/pref_registry/pref_registry_syncable.h" | 19 #include "components/pref_registry/pref_registry_syncable.h" |
21 | 20 |
22 // static | |
23 PrefServiceSyncable* PrefServiceSyncable::FromProfile(Profile* profile) { | |
24 return static_cast<PrefServiceSyncable*>(profile->GetPrefs()); | |
25 } | |
26 | |
27 // static | |
28 PrefServiceSyncable* PrefServiceSyncable::IncognitoFromProfile( | |
29 Profile* profile) { | |
30 return static_cast<PrefServiceSyncable*>(profile->GetOffTheRecordPrefs()); | |
31 } | |
32 | |
33 PrefServiceSyncable::PrefServiceSyncable( | 21 PrefServiceSyncable::PrefServiceSyncable( |
34 PrefNotifierImpl* pref_notifier, | 22 PrefNotifierImpl* pref_notifier, |
35 PrefValueStore* pref_value_store, | 23 PrefValueStore* pref_value_store, |
36 PersistentPrefStore* user_prefs, | 24 PersistentPrefStore* user_prefs, |
37 user_prefs::PrefRegistrySyncable* pref_registry, | 25 user_prefs::PrefRegistrySyncable* pref_registry, |
38 base::Callback<void(PersistentPrefStore::PrefReadError)> | 26 base::Callback<void(PersistentPrefStore::PrefReadError)> |
39 read_error_callback, | 27 read_error_callback, |
40 bool async) | 28 bool async) |
41 : PrefService(pref_notifier, | 29 : PrefService(pref_notifier, |
42 pref_value_store, | 30 pref_value_store, |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 162 |
175 void PrefServiceSyncable::OnIsSyncingChanged() { | 163 void PrefServiceSyncable::OnIsSyncingChanged() { |
176 FOR_EACH_OBSERVER(PrefServiceSyncableObserver, observer_list_, | 164 FOR_EACH_OBSERVER(PrefServiceSyncableObserver, observer_list_, |
177 OnIsSyncingChanged()); | 165 OnIsSyncingChanged()); |
178 } | 166 } |
179 | 167 |
180 void PrefServiceSyncable::ProcessPrefChange(const std::string& name) { | 168 void PrefServiceSyncable::ProcessPrefChange(const std::string& name) { |
181 pref_sync_associator_.ProcessPrefChange(name); | 169 pref_sync_associator_.ProcessPrefChange(name); |
182 priority_pref_sync_associator_.ProcessPrefChange(name); | 170 priority_pref_sync_associator_.ProcessPrefChange(name); |
183 } | 171 } |
OLD | NEW |