summaryrefslogtreecommitdiffstats
path: root/base/values.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-09 00:33:04 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-09 00:33:04 +0000
commite7f5c6f8aede399fe896e8218d89087408011d18 (patch)
tree58ed75a2b1ae424a089a9a9fd8bb5724fed35ded /base/values.cc
parent1188a6c0b9025c6ccb9eff833599b951fc778a9a (diff)
downloadchromium_src-e7f5c6f8aede399fe896e8218d89087408011d18.zip
chromium_src-e7f5c6f8aede399fe896e8218d89087408011d18.tar.gz
chromium_src-e7f5c6f8aede399fe896e8218d89087408011d18.tar.bz2
Implement the popup blocking whitelist pref. This makes the whitelist actually function.BUG=11440
Review URL: http://codereview.chromium.org/115149 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15702 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/values.cc')
-rw-r--r--base/values.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/base/values.cc b/base/values.cc
index f8e3729..3b5bd38 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -497,11 +497,8 @@ ListValue::~ListValue() {
}
void ListValue::Clear() {
- ValueVector::iterator list_iterator = list_.begin();
- while (list_iterator != list_.end()) {
- delete *list_iterator;
- ++list_iterator;
- }
+ for (ValueVector::iterator i(list_.begin()); i != list_.end(); ++i)
+ delete *i;
list_.clear();
}
@@ -609,13 +606,19 @@ bool ListValue::Remove(size_t index, Value** out_value) {
else
delete list_[index];
- ValueVector::iterator entry = list_.begin();
- entry += index;
-
- list_.erase(entry);
+ list_.erase(list_.begin() + index);
return true;
}
+void ListValue::Remove(const Value& value) {
+ for (ValueVector::iterator i(list_.begin()); i != list_.end(); ++i) {
+ if ((*i)->Equals(&value)) {
+ list_.erase(i);
+ break;
+ }
+ }
+}
+
void ListValue::Append(Value* in_value) {
DCHECK(in_value);
list_.push_back(in_value);
@@ -624,11 +627,8 @@ void ListValue::Append(Value* in_value) {
Value* ListValue::DeepCopy() const {
ListValue* result = new ListValue;
- ValueVector::const_iterator current_entry = list_.begin();
- while (current_entry != list_.end()) {
- result->Append((*current_entry)->DeepCopy());
- ++current_entry;
- }
+ for (ValueVector::const_iterator i(list_.begin()); i != list_.end(); ++i)
+ result->Append((*i)->DeepCopy());
return result;
}