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

Unified Diff: tools/json_schema_compiler/util.h

Issue 9456007: Add wider support to json_schema_compiler (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: reupload Created 8 years, 10 months 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: tools/json_schema_compiler/util.h
diff --git a/tools/json_schema_compiler/util.h b/tools/json_schema_compiler/util.h
index 707c626714a3d90ce1efe38f1c2a7e46d3a0ce2a..f71c93cb9f8a138f9ad274771bd7ab8f0cbd6648 100644
--- a/tools/json_schema_compiler/util.h
+++ b/tools/json_schema_compiler/util.h
@@ -150,30 +150,22 @@ void PopulateListFromOptionalArray(
}
-// Sets |out|.|name| to a newly created ListValue containing |from|. Requires
-// GetItemFromList to be implemented for |T|.
template <class T>
-void PopulateDictionaryFromArray(
- const std::vector<T>& from,
- const std::string& name,
- base::DictionaryValue* out) {
+scoped_ptr<Value> CreateValueFromArray(
+ const std::vector<T>& from) {
base::ListValue* list = new base::ListValue();
- out->SetWithoutPathExpansion(name, list);
PopulateListFromArray(from, list);
+ return scoped_ptr<Value>(list);
}
-// If |from| is non-NULL, sets |out|.|name| to a newly created ListValue
-// containing |from|. Requires GetItemFromList to be implemented for |T|.
template <class T>
-void PopulateDictionaryFromOptionalArray(
- const scoped_ptr<std::vector<T> >& from,
- const std::string& name,
- base::DictionaryValue* out) {
+scoped_ptr<Value> CreateValueFromOptionalArray(
+ const scoped_ptr<std::vector<T> >& from) {
if (from.get())
- PopulateDictionaryFromArray(*from, name, out);
+ return CreateValueFromArray(*from);
+ return scoped_ptr<Value>();
}
-
} // namespace api_util
} // namespace extensions
« no previous file with comments | « tools/json_schema_compiler/test/simple_api_unittest.cc ('k') | tools/json_schema_compiler/util_cc_helper.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698