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

Unified Diff: base/values.cc

Issue 7753020: Revert recent changes to base::Value (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 | « base/values.h ('k') | base/values_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/values.cc
diff --git a/base/values.cc b/base/values.cc
index ad534696b389b537dc4333876c78f9a84247583a..17aba167a1f7cf42dfd9d3bac05fbee00b85d5ab 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -18,7 +18,7 @@ Value* CopyWithoutEmptyChildren(Value* node) {
DCHECK(node);
switch (node->GetType()) {
case Value::TYPE_LIST: {
- ListValue* list = node->AsList();
+ ListValue* list = static_cast<ListValue*>(node);
ListValue* copy = new ListValue;
for (ListValue::const_iterator it = list->begin(); it != list->end();
++it) {
@@ -97,14 +97,6 @@ StringValue* Value::CreateStringValue(const string16& in_value) {
return new StringValue(in_value);
}
-BinaryValue* Value::AsBinary() {
- return NULL;
-}
-
-ListValue* Value::AsList() {
- return NULL;
-}
-
bool Value::GetAsBoolean(bool* out_value) const {
return false;
}
@@ -305,10 +297,6 @@ BinaryValue* BinaryValue::CreateWithCopiedBuffer(const char* buffer,
return new BinaryValue(buffer_copy, size);
}
-BinaryValue* BinaryValue::AsBinary() {
- return this;
-}
-
BinaryValue* BinaryValue::DeepCopy() const {
return CreateWithCopiedBuffer(buffer_, size_);
}
@@ -497,11 +485,11 @@ bool DictionaryValue::GetBinary(const std::string& path,
BinaryValue** out_value) const {
Value* value;
bool result = Get(path, &value);
- if (!result || !value->AsBinary())
+ if (!result || !value->IsType(TYPE_BINARY))
return false;
if (out_value)
- *out_value = value->AsBinary();
+ *out_value = static_cast<BinaryValue*>(value);
return true;
}
@@ -523,11 +511,11 @@ bool DictionaryValue::GetList(const std::string& path,
ListValue** out_value) const {
Value* value;
bool result = Get(path, &value);
- if (!result || !value->AsList())
+ if (!result || !value->IsType(TYPE_LIST))
return false;
if (out_value)
- *out_value = value->AsList();
+ *out_value = static_cast<ListValue*>(value);
return true;
}
@@ -601,11 +589,11 @@ bool DictionaryValue::GetListWithoutPathExpansion(const std::string& key,
ListValue** out_value) const {
Value* value;
bool result = GetWithoutPathExpansion(key, &value);
- if (!result || !value->AsList())
+ if (!result || !value->IsType(TYPE_LIST))
return false;
if (out_value)
- *out_value = value->AsList();
+ *out_value = static_cast<ListValue*>(value);
return true;
}
@@ -814,11 +802,11 @@ bool ListValue::GetDictionary(size_t index, DictionaryValue** out_value) const {
bool ListValue::GetList(size_t index, ListValue** out_value) const {
Value* value;
bool result = Get(index, &value);
- if (!result || !value->AsList())
+ if (!result || !value->IsType(TYPE_LIST))
return false;
if (out_value)
- *out_value = value->AsList();
+ *out_value = static_cast<ListValue*>(value);
return true;
}
@@ -877,10 +865,6 @@ bool ListValue::Insert(size_t index, Value* in_value) {
return true;
}
-ListValue* ListValue::AsList() {
- return this;
-}
-
bool ListValue::GetAsList(ListValue** out_value) {
if (out_value)
*out_value = this;
« no previous file with comments | « base/values.h ('k') | base/values_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698