summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorzork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-12 05:16:20 +0000
committerzork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-12 05:16:20 +0000
commita6413746c7dc93abcac5573dad08aa6a07826e6e (patch)
treea0d18464bb79000098b1b5b40a9b5ee3e52feeae /base
parent8e85884ba4efff3c2189581d9819dfdfcfb35aa6 (diff)
downloadchromium_src-a6413746c7dc93abcac5573dad08aa6a07826e6e.zip
chromium_src-a6413746c7dc93abcac5573dad08aa6a07826e6e.tar.gz
chromium_src-a6413746c7dc93abcac5573dad08aa6a07826e6e.tar.bz2
Add notifications to allow desktop notification permissions to be synced.
Fix a bug where sites can be added to allow and deny lists multiple times. BUG=none TEST=Open two browsers with separate profiles. Request permission for notifications on a site on one. Check that the permissions are the same on the other browser. Review URL: http://codereview.chromium.org/1578023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44234 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/values.cc10
-rw-r--r--base/values.h4
2 files changed, 14 insertions, 0 deletions
diff --git a/base/values.cc b/base/values.cc
index f214ead..feff299 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -832,6 +832,16 @@ void ListValue::Append(Value* in_value) {
list_.push_back(in_value);
}
+bool ListValue::AppendIfNotPresent(Value* in_value) {
+ DCHECK(in_value);
+ for (ValueVector::iterator i(list_.begin()); i != list_.end(); ++i) {
+ if ((*i)->Equals(in_value))
+ return false;
+ }
+ list_.push_back(in_value);
+ return true;
+}
+
bool ListValue::Insert(size_t index, Value* in_value) {
DCHECK(in_value);
if (index > list_.size())
diff --git a/base/values.h b/base/values.h
index 6c66345..248fc1d 100644
--- a/base/values.h
+++ b/base/values.h
@@ -401,6 +401,10 @@ class ListValue : public Value {
// Appends a Value to the end of the list.
void Append(Value* in_value);
+ // Appends a Value if it's not already present.
+ // Returns true if successful, or false if the value was already present.
+ bool AppendIfNotPresent(Value* in_value);
+
// Insert a Value at index.
// Returns true if successful, or false if the index was out of range.
bool Insert(size_t index, Value* in_value);