| Index: chrome/browser/notifications/notifications_prefs_cache.cc
|
| diff --git a/chrome/browser/notifications/notifications_prefs_cache.cc b/chrome/browser/notifications/notifications_prefs_cache.cc
|
| index b1272820991ccda08c73b3d37254bb7813e26547..6a5172bb192956cc43089db8b3cfd0b098e0af67 100644
|
| --- a/chrome/browser/notifications/notifications_prefs_cache.cc
|
| +++ b/chrome/browser/notifications/notifications_prefs_cache.cc
|
| @@ -10,23 +10,8 @@
|
| #include "chrome/browser/pref_service.h"
|
| #include "third_party/WebKit/WebKit/chromium/public/WebNotificationPresenter.h"
|
|
|
| -NotificationsPrefsCache::NotificationsPrefsCache(
|
| - const ListValue* allowed, const ListValue* denied)
|
| +NotificationsPrefsCache::NotificationsPrefsCache()
|
| : 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(
|
| @@ -47,6 +32,30 @@ 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;
|
|
|