| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 user_pref_store_.get(), | 266 user_pref_store_.get(), |
| 267 new ReadErrorHandler())); | 267 new ReadErrorHandler())); |
| 268 } | 268 } |
| 269 } | 269 } |
| 270 | 270 |
| 271 bool PrefService::ReloadPersistentPrefs() { | 271 bool PrefService::ReloadPersistentPrefs() { |
| 272 return user_pref_store_->ReadPrefs() == | 272 return user_pref_store_->ReadPrefs() == |
| 273 PersistentPrefStore::PREF_READ_ERROR_NONE; | 273 PersistentPrefStore::PREF_READ_ERROR_NONE; |
| 274 } | 274 } |
| 275 | 275 |
| 276 bool PrefService::SavePersistentPrefs() { | |
| 277 DCHECK(CalledOnValidThread()); | |
| 278 return user_pref_store_->WritePrefs(); | |
| 279 } | |
| 280 | |
| 281 void PrefService::ScheduleSavePersistentPrefs() { | |
| 282 DCHECK(CalledOnValidThread()); | |
| 283 user_pref_store_->ScheduleWritePrefs(); | |
| 284 } | |
| 285 | |
| 286 void PrefService::CommitPendingWrite() { | 276 void PrefService::CommitPendingWrite() { |
| 287 DCHECK(CalledOnValidThread()); | 277 DCHECK(CalledOnValidThread()); |
| 288 user_pref_store_->CommitPendingWrite(); | 278 user_pref_store_->CommitPendingWrite(); |
| 289 } | 279 } |
| 290 | 280 |
| 291 namespace { | 281 namespace { |
| 292 | 282 |
| 293 // If there's no g_browser_process or no local state, return true (for testing). | 283 // If there's no g_browser_process or no local state, return true (for testing). |
| 294 bool IsLocalStatePrefService(PrefService* prefs){ | 284 bool IsLocalStatePrefService(PrefService* prefs){ |
| 295 return (!g_browser_process || | 285 return (!g_browser_process || |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); | 921 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); |
| 932 } | 922 } |
| 933 | 923 |
| 934 bool PrefService::Preference::IsUserModifiable() const { | 924 bool PrefService::Preference::IsUserModifiable() const { |
| 935 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); | 925 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); |
| 936 } | 926 } |
| 937 | 927 |
| 938 bool PrefService::Preference::IsExtensionModifiable() const { | 928 bool PrefService::Preference::IsExtensionModifiable() const { |
| 939 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); | 929 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); |
| 940 } | 930 } |
| OLD | NEW |