| 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.h" | 5 #include "chrome/browser/prefs/pref_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 NULL, // recommended_cloud_prefs | 197 NULL, // recommended_cloud_prefs |
| 198 default_store_.get(), | 198 default_store_.get(), |
| 199 NULL, // pref_sync_associator | 199 NULL, // pref_sync_associator |
| 200 pref_notifier), | 200 pref_notifier), |
| 201 incognito_pref_store, | 201 incognito_pref_store, |
| 202 default_store_.get(), | 202 default_store_.get(), |
| 203 NULL, | 203 NULL, |
| 204 false); | 204 false); |
| 205 } | 205 } |
| 206 | 206 |
| 207 PrefService* PrefService::CreatePrefServiceWithPerTabPrefStore() { | |
| 208 pref_service_forked_ = true; | |
| 209 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); | |
| 210 OverlayUserPrefStore* per_tab_pref_store = | |
| 211 new OverlayUserPrefStore(user_pref_store_.get()); | |
| 212 PrefsTabHelper::InitPerTabUserPrefStore(per_tab_pref_store); | |
| 213 DefaultPrefStore* default_store = new DefaultPrefStore(); | |
| 214 return new PrefService( | |
| 215 pref_notifier, | |
| 216 pref_value_store_->CloneAndSpecialize( | |
| 217 NULL, // managed_platform_prefs | |
| 218 NULL, // managed_cloud_prefs | |
| 219 NULL, // extension_prefs | |
| 220 NULL, // command_line_prefs | |
| 221 per_tab_pref_store, | |
| 222 NULL, // recommended_platform_prefs | |
| 223 NULL, // recommended_cloud_prefs | |
| 224 default_store, | |
| 225 NULL, | |
| 226 pref_notifier), | |
| 227 per_tab_pref_store, | |
| 228 default_store, | |
| 229 NULL, | |
| 230 false); | |
| 231 } | |
| 232 | |
| 233 PrefService::PrefService(PrefNotifierImpl* pref_notifier, | 207 PrefService::PrefService(PrefNotifierImpl* pref_notifier, |
| 234 PrefValueStore* pref_value_store, | 208 PrefValueStore* pref_value_store, |
| 235 PersistentPrefStore* user_prefs, | 209 PersistentPrefStore* user_prefs, |
| 236 DefaultPrefStore* default_store, | 210 DefaultPrefStore* default_store, |
| 237 PrefModelAssociator* pref_sync_associator, | 211 PrefModelAssociator* pref_sync_associator, |
| 238 bool async) | 212 bool async) |
| 239 : pref_notifier_(pref_notifier), | 213 : pref_notifier_(pref_notifier), |
| 240 pref_value_store_(pref_value_store), | 214 pref_value_store_(pref_value_store), |
| 241 user_pref_store_(user_prefs), | 215 user_pref_store_(user_prefs), |
| 242 default_store_(default_store), | 216 default_store_(default_store), |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); | 948 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); |
| 975 } | 949 } |
| 976 | 950 |
| 977 bool PrefService::Preference::IsUserModifiable() const { | 951 bool PrefService::Preference::IsUserModifiable() const { |
| 978 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); | 952 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); |
| 979 } | 953 } |
| 980 | 954 |
| 981 bool PrefService::Preference::IsExtensionModifiable() const { | 955 bool PrefService::Preference::IsExtensionModifiable() const { |
| 982 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); | 956 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); |
| 983 } | 957 } |
| OLD | NEW |