Index: base/values.cc |
diff --git a/base/values.cc b/base/values.cc |
index c829a7f2f884f30d6aa76477dff94cbf76ecd708..9b2483e7c18c538e877f8563118b633a4433507f 100644 |
--- a/base/values.cc |
+++ b/base/values.cc |
@@ -351,6 +351,16 @@ bool BinaryValue::Equals(const Value* other) const { |
///////////////////// DictionaryValue //////////////////// |
+// static |
+scoped_ptr<DictionaryValue> DictionaryValue::From(scoped_ptr<Value> value) { |
+ DictionaryValue* out; |
+ if (value && value->GetAsDictionary(&out)) { |
+ ignore_result(value.release()); |
+ return make_scoped_ptr(out); |
+ } |
+ return nullptr; |
+} |
+ |
DictionaryValue::DictionaryValue() |
: Value(TYPE_DICTIONARY) { |
} |
@@ -870,6 +880,16 @@ bool DictionaryValue::Equals(const Value* other) const { |
///////////////////// ListValue //////////////////// |
+// static |
+scoped_ptr<ListValue> ListValue::From(scoped_ptr<Value> value) { |
+ ListValue* out; |
+ if (value && value->GetAsList(&out)) { |
+ ignore_result(value.release()); |
+ return make_scoped_ptr(out); |
+ } |
+ return nullptr; |
+} |
+ |
ListValue::ListValue() : Value(TYPE_LIST) { |
} |