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

Unified Diff: chrome/browser/ui/webui/options/content_settings_handler.cc

Issue 7810017: Revert 98938 - Migrate Obsolete NotificationsSettings and remove content_settings::NotificationsP... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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/prefs/browser_prefs.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/content_settings_handler.cc
===================================================================
--- chrome/browser/ui/webui/options/content_settings_handler.cc (revision 98940)
+++ chrome/browser/ui/webui/options/content_settings_handler.cc (working copy)
@@ -24,6 +24,7 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/content_settings_helper.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "content/browser/tab_contents/tab_contents.h"
@@ -167,12 +168,13 @@
// in the desktop notifications exceptions table. Ownership of the pointer is
// passed to the caller.
DictionaryValue* GetNotificationExceptionForPage(
- const ContentSettingsPattern& pattern,
+ const GURL& url,
ContentSetting setting) {
DictionaryValue* exception = new DictionaryValue();
- exception->SetString(kDisplayPattern, pattern.ToString());
+ exception->SetString(kDisplayPattern,
+ content_settings_helper::OriginToString(url));
exception->SetString(kSetting, ContentSettingToString(setting));
- exception->SetString(kOrigin, pattern.ToString());
+ exception->SetString(kOrigin, url.spec());
return exception;
}
@@ -508,18 +510,18 @@
DesktopNotificationService* service =
DesktopNotificationServiceFactory::GetForProfile(profile);
- HostContentSettingsMap::SettingsForOneType settings;
- service->GetNotificationsSettings(&settings);
+ std::vector<GURL> allowed(service->GetAllowedOrigins());
+ std::vector<GURL> blocked(service->GetBlockedOrigins());
ListValue exceptions;
- for (HostContentSettingsMap::SettingsForOneType::const_iterator i =
- settings.begin();
- i != settings.end();
- ++i) {
- const HostContentSettingsMap::PatternSettingSourceTuple& tuple(*i);
+ for (size_t i = 0; i < allowed.size(); ++i) {
exceptions.Append(
- GetNotificationExceptionForPage(tuple.a, tuple.c));
+ GetNotificationExceptionForPage(allowed[i], CONTENT_SETTING_ALLOW));
}
+ for (size_t i = 0; i < blocked.size(); ++i) {
+ exceptions.Append(
+ GetNotificationExceptionForPage(blocked[i], CONTENT_SETTING_BLOCK));
+ }
StringValue type_string(
ContentSettingsTypeToGroupName(CONTENT_SETTINGS_TYPE_NOTIFICATIONS));
@@ -649,11 +651,14 @@
rv = args->GetString(arg_i++, &setting);
DCHECK(rv);
ContentSetting content_setting = ContentSettingFromString(setting);
-
- DCHECK(content_setting == CONTENT_SETTING_ALLOW ||
- content_setting == CONTENT_SETTING_BLOCK);
- DesktopNotificationServiceFactory::GetForProfile(profile)->
- ClearSetting(ContentSettingsPattern::FromString(origin));
+ if (content_setting == CONTENT_SETTING_ALLOW) {
+ DesktopNotificationServiceFactory::GetForProfile(profile)->
+ ResetAllowedOrigin(GURL(origin));
+ } else {
+ DCHECK_EQ(content_setting, CONTENT_SETTING_BLOCK);
+ DesktopNotificationServiceFactory::GetForProfile(profile)->
+ ResetBlockedOrigin(GURL(origin));
+ }
} else {
std::string mode;
bool rv = args->GetString(arg_i++, &mode);
« no previous file with comments | « chrome/browser/prefs/browser_prefs.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698