summaryrefslogtreecommitdiffstats
path: root/chrome/browser/notifications
diff options
context:
space:
mode:
authorjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-30 20:00:48 +0000
committerjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-30 20:00:48 +0000
commiteeba91ac5369e2e11b5a8dece974399de09454aa (patch)
treecf67422daadd0186670fa1b6f2199e8d48c28ad5 /chrome/browser/notifications
parent5c4c7402c5264a38aa3a25e0e17caaf3222e5a61 (diff)
downloadchromium_src-eeba91ac5369e2e11b5a8dece974399de09454aa.zip
chromium_src-eeba91ac5369e2e11b5a8dece974399de09454aa.tar.gz
chromium_src-eeba91ac5369e2e11b5a8dece974399de09454aa.tar.bz2
Need to load the permissions lists every time at startup for notifications.
BUG=26274 TEST=grant notifications permissions and restart browser Review URL: http://codereview.chromium.org/339077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30623 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications')
-rw-r--r--chrome/browser/notifications/desktop_notification_service.cc16
-rw-r--r--chrome/browser/notifications/notifications_prefs_cache.cc2
-rw-r--r--chrome/browser/notifications/notifications_prefs_cache.h2
3 files changed, 8 insertions, 12 deletions
diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc
index 0df73d7..76a7bd9 100644
--- a/chrome/browser/notifications/desktop_notification_service.cc
+++ b/chrome/browser/notifications/desktop_notification_service.cc
@@ -153,20 +153,16 @@ DesktopNotificationService::~DesktopNotificationService() {
// create the preferences if they don't exist yet.
void DesktopNotificationService::InitPrefs() {
PrefService* prefs = profile_->GetPrefs();
- ListValue* allowed_sites = NULL;
- ListValue* denied_sites = NULL;
+ const ListValue* allowed_sites;
+ const ListValue* denied_sites;
- if (prefs->FindPreference(prefs::kDesktopNotificationAllowedOrigins))
- allowed_sites =
- prefs->GetMutableList(prefs::kDesktopNotificationAllowedOrigins);
- else
+ if (!prefs->FindPreference(prefs::kDesktopNotificationAllowedOrigins))
prefs->RegisterListPref(prefs::kDesktopNotificationAllowedOrigins);
+ allowed_sites = prefs->GetList(prefs::kDesktopNotificationAllowedOrigins);
- if (prefs->FindPreference(prefs::kDesktopNotificationDeniedOrigins))
- denied_sites =
- prefs->GetMutableList(prefs::kDesktopNotificationDeniedOrigins);
- else
+ if (!prefs->FindPreference(prefs::kDesktopNotificationDeniedOrigins))
prefs->RegisterListPref(prefs::kDesktopNotificationDeniedOrigins);
+ denied_sites = prefs->GetList(prefs::kDesktopNotificationDeniedOrigins);
prefs_cache_ = new NotificationsPrefsCache(allowed_sites, denied_sites);
}
diff --git a/chrome/browser/notifications/notifications_prefs_cache.cc b/chrome/browser/notifications/notifications_prefs_cache.cc
index c5663e4..3ff90d7 100644
--- a/chrome/browser/notifications/notifications_prefs_cache.cc
+++ b/chrome/browser/notifications/notifications_prefs_cache.cc
@@ -11,7 +11,7 @@
#include "webkit/api/public/WebNotificationPresenter.h"
NotificationsPrefsCache::NotificationsPrefsCache(
- ListValue* allowed, ListValue* denied) {
+ const ListValue* allowed, const ListValue* denied) {
ListValue::const_iterator i;
std::wstring origin;
if (allowed) {
diff --git a/chrome/browser/notifications/notifications_prefs_cache.h b/chrome/browser/notifications/notifications_prefs_cache.h
index e873da7..8edbc36 100644
--- a/chrome/browser/notifications/notifications_prefs_cache.h
+++ b/chrome/browser/notifications/notifications_prefs_cache.h
@@ -19,7 +19,7 @@ class ListValue;
class NotificationsPrefsCache :
public base::RefCountedThreadSafe<NotificationsPrefsCache> {
public:
- NotificationsPrefsCache(ListValue* allowed, ListValue* denied);
+ NotificationsPrefsCache(const ListValue* allowed, const ListValue* denied);
// Checks to see if a given origin has permission to create desktop
// notifications. Returns a constant from WebNotificationPresenter