Chromium Code Reviews| Index: base/prefs/pref_service.cc |
| diff --git a/base/prefs/pref_service.cc b/base/prefs/pref_service.cc |
| index 67ab898459459bb198cd473711f4183699143bed..745aad3f52ec0f89142f49e952d6759a1da0685d 100644 |
| --- a/base/prefs/pref_service.cc |
| +++ b/base/prefs/pref_service.cc |
| @@ -182,8 +182,8 @@ bool PrefService::HasPrefPath(const char* path) const { |
| DictionaryValue* PrefService::GetPreferenceValues() const { |
| DCHECK(CalledOnValidThread()); |
| DictionaryValue* out = new DictionaryValue; |
| - PrefRegistry::const_iterator i = pref_registry_->begin(); |
| - for (; i != pref_registry_->end(); ++i) { |
| + PrefRegistry::const_iterator i = pref_registry_->defaults()->begin(); |
| + for (; i != pref_registry_->defaults()->end(); ++i) { |
| const Value* value = GetPreferenceValue(i->first); |
| DCHECK(value); |
| out->Set(i->first, value->DeepCopy()); |
| @@ -273,6 +273,14 @@ const base::Value* PrefService::GetUserPrefValue(const char* path) const { |
| return value; |
| } |
| +void PrefService::SetDefaultPrefValue(const char* path, |
| + base::Value* value) { |
| + DCHECK(CalledOnValidThread()); |
| + DCHECK(pref_registry_->defaults()->GetValue(path, NULL)) |
| + << "Setting default for unregistered pref: " << path; |
| + pref_registry_->defaults()->SetDefaultValue(path, value); |
|
Mattias Nissler (ping if slow)
2013/02/27 10:50:52
We should CHECK() that the type doesn't change her
Jói
2013/02/27 16:30:56
Done.
|
| +} |
| + |
| const base::Value* PrefService::GetDefaultPrefValue(const char* path) const { |
| DCHECK(CalledOnValidThread()); |
| // Lookup the preference in the default store. |
| @@ -316,8 +324,8 @@ PrefRegistry* PrefService::DeprecatedGetPrefRegistry() { |
| } |
| void PrefService::AddInitialPreferences() { |
| - for (PrefRegistry::const_iterator it = pref_registry_->begin(); |
| - it != pref_registry_->end(); |
| + for (PrefRegistry::const_iterator it = pref_registry_->defaults()->begin(); |
| + it != pref_registry_->defaults()->end(); |
| ++it) { |
| AddRegisteredPreference(it->first.c_str(), it->second); |
| } |