| Index: chrome/browser/prefs/pref_service.cc
|
| diff --git a/chrome/browser/prefs/pref_service.cc b/chrome/browser/prefs/pref_service.cc
|
| index cf9f22ed0ca0a25eb861411b84f73eea557b496b..de7f406748f82fbffd323af8b631ca6d1d6b8253 100644
|
| --- a/chrome/browser/prefs/pref_service.cc
|
| +++ b/chrome/browser/prefs/pref_service.cc
|
| @@ -727,6 +727,23 @@ void PrefService::RegisterPreference(const char* path,
|
| DCHECK(orig_type != Value::TYPE_NULL && orig_type != Value::TYPE_BINARY) <<
|
| "invalid preference type: " << orig_type;
|
|
|
| + // For ListValue and DictionaryValue with non empty default, empty value
|
| + // for |path| needs to be persisted in |user_pref_store_|. So that
|
| + // non empty default is not used when user sets an empty ListValue or
|
| + // DictionaryValue.
|
| + bool needs_empty_value = false;
|
| + if (orig_type == base::Value::TYPE_LIST) {
|
| + const base::ListValue* list = NULL;
|
| + if (default_value->GetAsList(&list) && !list->empty())
|
| + needs_empty_value = true;
|
| + } else if (orig_type == base::Value::TYPE_DICTIONARY) {
|
| + const base::DictionaryValue* dict = NULL;
|
| + if (default_value->GetAsDictionary(&dict) && !dict->empty())
|
| + needs_empty_value = true;
|
| + }
|
| + if (needs_empty_value)
|
| + user_pref_store_->MarkNeedsEmptyValue(path);
|
| +
|
| // Hand off ownership.
|
| default_store_->SetDefaultValue(path, scoped_value.release());
|
|
|
|
|