summaryrefslogtreecommitdiffstats
path: root/chrome/browser/notifications/notifications_prefs_cache.cc
diff options
context:
space:
mode:
authorzork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-12 05:41:39 +0000
committerzork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-12 05:41:39 +0000
commitac579882736d975f12036fa718f4080aa41e5e14 (patch)
tree36900f1103b8a1a594cfef82f19820293ec5cc7d /chrome/browser/notifications/notifications_prefs_cache.cc
parenta6413746c7dc93abcac5573dad08aa6a07826e6e (diff)
downloadchromium_src-ac579882736d975f12036fa718f4080aa41e5e14.zip
chromium_src-ac579882736d975f12036fa718f4080aa41e5e14.tar.gz
chromium_src-ac579882736d975f12036fa718f4080aa41e5e14.tar.bz2
Revert 44234 - 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 TBR=zork@chromium.org Review URL: http://codereview.chromium.org/1607012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44235 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications/notifications_prefs_cache.cc')
-rw-r--r--chrome/browser/notifications/notifications_prefs_cache.cc41
1 files changed, 16 insertions, 25 deletions
diff --git a/chrome/browser/notifications/notifications_prefs_cache.cc b/chrome/browser/notifications/notifications_prefs_cache.cc
index 6a5172b..b127282 100644
--- a/chrome/browser/notifications/notifications_prefs_cache.cc
+++ b/chrome/browser/notifications/notifications_prefs_cache.cc
@@ -10,8 +10,23 @@
#include "chrome/browser/pref_service.h"
#include "third_party/WebKit/WebKit/chromium/public/WebNotificationPresenter.h"
-NotificationsPrefsCache::NotificationsPrefsCache()
+NotificationsPrefsCache::NotificationsPrefsCache(
+ const ListValue* allowed, const ListValue* denied)
: is_initialized_(false) {
+ ListValue::const_iterator i;
+ std::wstring origin;
+ if (allowed) {
+ for (i = allowed->begin(); i != allowed->end(); ++i) {
+ (*i)->GetAsString(&origin);
+ allowed_origins_.insert(GURL(WideToUTF8(origin)));
+ }
+ }
+ if (denied) {
+ for (i = denied->begin(); i != denied->end(); ++i) {
+ (*i)->GetAsString(&origin);
+ denied_origins_.insert(GURL(WideToUTF8(origin)));
+ }
+ }
}
void NotificationsPrefsCache::CacheAllowedOrigin(
@@ -32,30 +47,6 @@ void NotificationsPrefsCache::CacheDeniedOrigin(
allowed_origins_.erase(iter);
}
-void NotificationsPrefsCache::SetCacheAllowedOrigins(
- const std::vector<GURL>& allowed) {
- allowed_origins_.clear();
- allowed_origins_.insert(allowed.begin(), allowed.end());
-}
-
-void NotificationsPrefsCache::SetCacheDeniedOrigins(
- const std::vector<GURL>& denied) {
- denied_origins_.clear();
- denied_origins_.insert(denied.begin(), denied.end());
-}
-
-// static
-void NotificationsPrefsCache::ListValueToGurlVector(
- const ListValue& origin_list,
- std::vector<GURL>* origin_vector) {
- ListValue::const_iterator i;
- std::wstring origin;
- for (i = origin_list.begin(); i != origin_list.end(); ++i) {
- (*i)->GetAsString(&origin);
- origin_vector->push_back(GURL(WideToUTF8(origin)));
- }
-}
-
int NotificationsPrefsCache::HasPermission(const GURL& origin) {
if (IsOriginAllowed(origin))
return WebKit::WebNotificationPresenter::PermissionAllowed;