| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 user_pref_store_.get(), | 235 user_pref_store_.get(), |
| 236 new ReadErrorHandler())); | 236 new ReadErrorHandler())); |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 | 239 |
| 240 bool PrefService::ReloadPersistentPrefs() { | 240 bool PrefService::ReloadPersistentPrefs() { |
| 241 return user_pref_store_->ReadPrefs() == | 241 return user_pref_store_->ReadPrefs() == |
| 242 PersistentPrefStore::PREF_READ_ERROR_NONE; | 242 PersistentPrefStore::PREF_READ_ERROR_NONE; |
| 243 } | 243 } |
| 244 | 244 |
| 245 bool PrefService::SavePersistentPrefs() { | |
| 246 DCHECK(CalledOnValidThread()); | |
| 247 return user_pref_store_->WritePrefs(); | |
| 248 } | |
| 249 | |
| 250 void PrefService::ScheduleSavePersistentPrefs() { | |
| 251 DCHECK(CalledOnValidThread()); | |
| 252 user_pref_store_->ScheduleWritePrefs(); | |
| 253 } | |
| 254 | |
| 255 void PrefService::CommitPendingWrite() { | 245 void PrefService::CommitPendingWrite() { |
| 256 DCHECK(CalledOnValidThread()); | 246 DCHECK(CalledOnValidThread()); |
| 257 user_pref_store_->CommitPendingWrite(); | 247 user_pref_store_->CommitPendingWrite(); |
| 258 } | 248 } |
| 259 | 249 |
| 260 namespace { | 250 namespace { |
| 261 | 251 |
| 262 // If there's no g_browser_process or no local state, return true (for testing). | 252 // If there's no g_browser_process or no local state, return true (for testing). |
| 263 bool IsLocalStatePrefService(PrefService* prefs){ | 253 bool IsLocalStatePrefService(PrefService* prefs){ |
| 264 return (!g_browser_process || | 254 return (!g_browser_process || |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); | 886 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); |
| 897 } | 887 } |
| 898 | 888 |
| 899 bool PrefService::Preference::IsUserModifiable() const { | 889 bool PrefService::Preference::IsUserModifiable() const { |
| 900 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); | 890 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); |
| 901 } | 891 } |
| 902 | 892 |
| 903 bool PrefService::Preference::IsExtensionModifiable() const { | 893 bool PrefService::Preference::IsExtensionModifiable() const { |
| 904 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); | 894 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); |
| 905 } | 895 } |
| OLD | NEW |