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

Unified Diff: base/values.cc

Issue 174277: override chrome:// URLs via extensions. (Closed)
Patch Set: fix linux errors Created 11 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') | chrome/browser/browser_about_handler.h » ('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 3b5bd38e9f4e77033300dfa27d6893172de31541..716fdf3230d3ba8397a3cf08cd9c78864bbcd7f5 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -610,13 +610,15 @@ bool ListValue::Remove(size_t index, Value** out_value) {
return true;
}
-void ListValue::Remove(const Value& value) {
+int ListValue::Remove(const Value& value) {
for (ValueVector::iterator i(list_.begin()); i != list_.end(); ++i) {
if ((*i)->Equals(&value)) {
+ size_t index = i - list_.begin();
list_.erase(i);
- break;
+ return index;
}
}
+ return -1;
}
void ListValue::Append(Value* in_value) {
@@ -624,6 +626,15 @@ void ListValue::Append(Value* in_value) {
list_.push_back(in_value);
}
+bool ListValue::Insert(size_t index, Value* in_value) {
+ DCHECK(in_value);
+ if (index < 0 || index > list_.size())
+ return false;
+
+ list_.insert(list_.begin() + index, in_value);
+ return true;
+}
+
Value* ListValue::DeepCopy() const {
ListValue* result = new ListValue;
« no previous file with comments | « base/values.h ('k') | chrome/browser/browser_about_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698