summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorscottbyer@google.com <scottbyer@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-07 00:35:29 +0000
committerscottbyer@google.com <scottbyer@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-07 00:35:29 +0000
commit81f9fe0bab7a81021591e094eb1bf9489ebbfb26 (patch)
tree167a15c8bc153eab98698a1f9c16e82f68128c09 /base
parent3c3a51f652ca6ad9279f3bbb93635a5a09c5ec1d (diff)
downloadchromium_src-81f9fe0bab7a81021591e094eb1bf9489ebbfb26.zip
chromium_src-81f9fe0bab7a81021591e094eb1bf9489ebbfb26.tar.gz
chromium_src-81f9fe0bab7a81021591e094eb1bf9489ebbfb26.tar.bz2
JavaScript to Value bridge.
Add more values that we can get back from JavaScript. Very useful for writing additional DOMUI browser test, and maybe in other cases as well. BUG=none TEST=RenderViewHostTest.ExecuteJavascriptInWebFrameNotifyResult Review URL: http://codereview.chromium.org/4924001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68416 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/values.cc10
-rw-r--r--base/values.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/base/values.cc b/base/values.cc
index c6a377f..b06df12 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -119,6 +119,10 @@ bool Value::GetAsString(string16* out_value) const {
return false;
}
+bool Value::GetAsList(ListValue** out_value) {
+ return false;
+}
+
Value* Value::DeepCopy() const {
// This method should only be getting called for null Values--all subclasses
// need to provide their own implementation;.
@@ -961,6 +965,12 @@ bool ListValue::Insert(size_t index, Value* in_value) {
return true;
}
+bool ListValue::GetAsList(ListValue** out_value) {
+ if (out_value)
+ *out_value = this;
+ return true;
+}
+
Value* ListValue::DeepCopy() const {
ListValue* result = new ListValue;
diff --git a/base/values.h b/base/values.h
index ac226fa..f020405 100644
--- a/base/values.h
+++ b/base/values.h
@@ -92,6 +92,7 @@ class Value {
virtual bool GetAsReal(double* out_value) const;
virtual bool GetAsString(std::string* out_value) const;
virtual bool GetAsString(string16* out_value) const;
+ virtual bool GetAsList(ListValue** out_value);
// This creates a deep copy of the entire Value tree, and returns a pointer
// to the copy. The caller gets ownership of the copy, of course.
@@ -366,6 +367,7 @@ class ListValue : public Value {
~ListValue();
// Subclassed methods
+ virtual bool GetAsList(ListValue** out_value);
Value* DeepCopy() const;
virtual bool Equals(const Value* other) const;