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

Side by Side Diff: base/values.cc

Issue 4924001: JavaScript to Value bridge. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix documentation. Created 10 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/values.h ('k') | chrome/browser/renderer_host/render_view_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/values.h" 5 #include "base/values.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 10
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 112 }
113 113
114 bool Value::GetAsString(std::string* out_value) const { 114 bool Value::GetAsString(std::string* out_value) const {
115 return false; 115 return false;
116 } 116 }
117 117
118 bool Value::GetAsString(string16* out_value) const { 118 bool Value::GetAsString(string16* out_value) const {
119 return false; 119 return false;
120 } 120 }
121 121
122 bool Value::GetAsList(ListValue** out_value) {
123 return false;
124 }
125
122 Value* Value::DeepCopy() const { 126 Value* Value::DeepCopy() const {
123 // This method should only be getting called for null Values--all subclasses 127 // This method should only be getting called for null Values--all subclasses
124 // need to provide their own implementation;. 128 // need to provide their own implementation;.
125 DCHECK(IsType(TYPE_NULL)); 129 DCHECK(IsType(TYPE_NULL));
126 return CreateNullValue(); 130 return CreateNullValue();
127 } 131 }
128 132
129 bool Value::Equals(const Value* other) const { 133 bool Value::Equals(const Value* other) const {
130 // This method should only be getting called for null Values--all subclasses 134 // This method should only be getting called for null Values--all subclasses
131 // need to provide their own implementation;. 135 // need to provide their own implementation;.
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 958
955 bool ListValue::Insert(size_t index, Value* in_value) { 959 bool ListValue::Insert(size_t index, Value* in_value) {
956 DCHECK(in_value); 960 DCHECK(in_value);
957 if (index > list_.size()) 961 if (index > list_.size())
958 return false; 962 return false;
959 963
960 list_.insert(list_.begin() + index, in_value); 964 list_.insert(list_.begin() + index, in_value);
961 return true; 965 return true;
962 } 966 }
963 967
968 bool ListValue::GetAsList(ListValue** out_value) {
969 if (out_value)
970 *out_value = this;
971 return true;
972 }
973
964 Value* ListValue::DeepCopy() const { 974 Value* ListValue::DeepCopy() const {
965 ListValue* result = new ListValue; 975 ListValue* result = new ListValue;
966 976
967 for (ValueVector::const_iterator i(list_.begin()); i != list_.end(); ++i) 977 for (ValueVector::const_iterator i(list_.begin()); i != list_.end(); ++i)
968 result->Append((*i)->DeepCopy()); 978 result->Append((*i)->DeepCopy());
969 979
970 return result; 980 return result;
971 } 981 }
972 982
973 bool ListValue::Equals(const Value* other) const { 983 bool ListValue::Equals(const Value* other) const {
(...skipping 10 matching lines...) Expand all
984 return false; 994 return false;
985 } 995 }
986 if (lhs_it != end() || rhs_it != other_list->end()) 996 if (lhs_it != end() || rhs_it != other_list->end())
987 return false; 997 return false;
988 998
989 return true; 999 return true;
990 } 1000 }
991 1001
992 ValueSerializer::~ValueSerializer() { 1002 ValueSerializer::~ValueSerializer() {
993 } 1003 }
OLDNEW
« no previous file with comments | « base/values.h ('k') | chrome/browser/renderer_host/render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698