Chromium Code Reviews| 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); |
|
not at google - send to devlin
2012/02/24 03:53:05
TBH a more idomatic way of writing this method wou
calamity
2012/02/24 15:10:40
Hmm, I tried this to start, got this error:
/tool
|
| } |
| -// 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 |