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

Unified Diff: components/policy/core/common/registry_dict_win.cc

Issue 2478503002: Enable non-sequential entries when loading registry lists. (Closed)
Patch Set: Created 4 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
Index: components/policy/core/common/registry_dict_win.cc
diff --git a/components/policy/core/common/registry_dict_win.cc b/components/policy/core/common/registry_dict_win.cc
index 833a0dfcc4de5a201300e5c277724ece30ed0348..834b7241e738b8be57d32233d401b4453c41a815 100644
--- a/components/policy/core/common/registry_dict_win.cc
+++ b/components/policy/core/common/registry_dict_win.cc
@@ -322,25 +322,19 @@ std::unique_ptr<base::Value> RegistryDict::ConvertToJSON(
case base::Value::TYPE_LIST: {
std::unique_ptr<base::ListValue> result(new base::ListValue());
Schema item_schema = schema.valid() ? schema.GetItems() : Schema();
- for (int i = 1; ; ++i) {
- const std::string name(base::IntToString(i));
- const RegistryDict* key = GetKey(name);
- if (key) {
- std::unique_ptr<base::Value> converted =
- key->ConvertToJSON(item_schema);
- if (converted)
- result->Append(converted.release());
- continue;
- }
- const base::Value* value = GetValue(name);
- if (value) {
- std::unique_ptr<base::Value> converted =
- ConvertValue(*value, item_schema);
- if (converted)
- result->Append(converted.release());
- continue;
- }
- break;
+ for (RegistryDict::KeyMap::const_iterator entry(keys_.begin());
+ entry != keys_.end(); ++entry) {
pastarmovj 2016/11/03 16:27:47 I think it still makes sense to only parse numbere
Georges Khalil 2016/11/03 18:16:16 Skipping over non-integer names makes sense. We w
Georges Khalil 2016/11/03 20:24:54 I just realized that a dictionary uses a map inste
+ std::unique_ptr<base::Value> converted =
+ entry->second->ConvertToJSON(item_schema);
+ if (converted)
+ result->Append(converted.release());
+ }
+ for (RegistryDict::ValueMap::const_iterator entry(values_.begin());
+ entry != values_.end(); ++entry) {
+ std::unique_ptr<base::Value> converted =
+ ConvertValue(*entry->second, item_schema);
+ if (converted)
+ result->Append(converted.release());
}
return std::move(result);
}

Powered by Google App Engine
This is Rietveld 408576698