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

Unified Diff: tools/json_schema_compiler/util.cc

Issue 11827026: Overhaul JSON Schema Compiler to support a number of features required to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 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
« no previous file with comments | « tools/json_schema_compiler/util.h ('k') | tools/json_schema_compiler/util_cc_helper.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/util.cc
diff --git a/tools/json_schema_compiler/util.cc b/tools/json_schema_compiler/util.cc
index ca5c25ab8289d52763c8e21046e9b87b717aba2a..25f908cf2af0537b6c328af66c450833fde04732 100644
--- a/tools/json_schema_compiler/util.cc
+++ b/tools/json_schema_compiler/util.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "tools/json_schema_compiler/any.h"
#include "tools/json_schema_compiler/util.h"
#include "base/values.h"
@@ -26,14 +25,13 @@ bool GetItemFromList(const ListValue& from, int index, std::string* out) {
return from.GetString(index, out);
}
-bool GetItemFromList(const ListValue& from, int index,
- linked_ptr<any::Any>* out) {
- const Value* value = NULL;
+bool GetItemFromList(const ListValue& from,
+ int index,
+ linked_ptr<base::Value>* out) {
+ const base::Value* value = NULL;
if (!from.Get(index, &value))
return false;
- scoped_ptr<any::Any> any_object(new any::Any());
- any_object->Init(*value);
- *out = linked_ptr<any::Any>(any_object.release());
+ *out = make_linked_ptr(value->DeepCopy());
return true;
}
@@ -42,30 +40,35 @@ bool GetItemFromList(const ListValue& from, int index,
const DictionaryValue* dict = NULL;
if (!from.GetDictionary(index, &dict))
return false;
- *out = linked_ptr<DictionaryValue>(dict->DeepCopy());
+ *out = make_linked_ptr(dict->DeepCopy());
return true;
}
void AddItemToList(const int from, base::ListValue* out) {
out->Append(base::Value::CreateIntegerValue(from));
}
+
void AddItemToList(const bool from, base::ListValue* out) {
out->Append(base::Value::CreateBooleanValue(from));
}
+
void AddItemToList(const double from, base::ListValue* out) {
out->Append(base::Value::CreateDoubleValue(from));
}
+
void AddItemToList(const std::string& from, base::ListValue* out) {
out->Append(base::Value::CreateStringValue(from));
}
+
+void AddItemToList(const linked_ptr<base::Value>& from,
+ base::ListValue* out) {
+ out->Append(from->DeepCopy());
+}
+
void AddItemToList(const linked_ptr<base::DictionaryValue>& from,
- base::ListValue* out) {
+ base::ListValue* out) {
out->Append(static_cast<Value*>(from->DeepCopy()));
}
-void AddItemToList(const linked_ptr<any::Any>& from,
- base::ListValue* out) {
- out->Append(from->value().DeepCopy());
-}
} // namespace api_util
} // namespace extensions
« no previous file with comments | « tools/json_schema_compiler/util.h ('k') | tools/json_schema_compiler/util_cc_helper.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698