Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3359)

Unified Diff: chrome/browser/notifications/notifications_prefs_cache.cc

Issue 1578023: Add notifications to allow desktop notification permissions to be synced. (Closed)
Patch Set: pre-commit Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/notifications/notifications_prefs_cache.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « chrome/browser/notifications/notifications_prefs_cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698