Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: base/prefs/json_pref_store.cc

Issue 81183005: Remove JsonPrefStore pruning of empty values on write. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove else Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/prefs/json_pref_store.h ('k') | base/prefs/json_pref_store_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/prefs/json_pref_store.cc
diff --git a/base/prefs/json_pref_store.cc b/base/prefs/json_pref_store.cc
index e230407043aea5ebc29056618ece54571e274b9c..ad97b8459cb1c5c614f021d2a24408c10e9c3df3 100644
--- a/base/prefs/json_pref_store.cc
+++ b/base/prefs/json_pref_store.cc
@@ -217,14 +217,10 @@ void JsonPrefStore::SetValueSilently(const std::string& key,
}
void JsonPrefStore::RemoveValue(const std::string& key) {
- if (prefs_->Remove(key, NULL))
+ if (prefs_->RemovePath(key, NULL))
ReportValueChanged(key);
}
-void JsonPrefStore::MarkNeedsEmptyValue(const std::string& key) {
- keys_need_empty_value_.insert(key);
-}
-
bool JsonPrefStore::ReadOnly() const {
return read_only_;
}
@@ -324,35 +320,7 @@ JsonPrefStore::~JsonPrefStore() {
}
bool JsonPrefStore::SerializeData(std::string* output) {
- // TODO(tc): Do we want to prune webkit preferences that match the default
- // value?
JSONStringValueSerializer serializer(output);
serializer.set_pretty_print(true);
- scoped_ptr<base::DictionaryValue> copy(
- prefs_->DeepCopyWithoutEmptyChildren());
-
- // Iterates |keys_need_empty_value_| and if the key exists in |prefs_|,
- // ensure its empty ListValue or DictonaryValue is preserved.
- for (std::set<std::string>::const_iterator
- it = keys_need_empty_value_.begin();
- it != keys_need_empty_value_.end();
- ++it) {
- const std::string& key = *it;
-
- base::Value* value = NULL;
- if (!prefs_->Get(key, &value))
- continue;
-
- if (value->IsType(base::Value::TYPE_LIST)) {
- const base::ListValue* list = NULL;
- if (value->GetAsList(&list) && list->empty())
- copy->Set(key, new base::ListValue);
- } else if (value->IsType(base::Value::TYPE_DICTIONARY)) {
- const base::DictionaryValue* dict = NULL;
- if (value->GetAsDictionary(&dict) && dict->empty())
- copy->Set(key, new base::DictionaryValue);
- }
- }
-
- return serializer.Serialize(*(copy.get()));
+ return serializer.Serialize(*prefs_);
}
« no previous file with comments | « base/prefs/json_pref_store.h ('k') | base/prefs/json_pref_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698