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

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

Issue 376253005: Migrate the notification permission to the new common permission classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
Index: chrome/browser/ui/webui/options/content_settings_handler.cc
diff --git a/chrome/browser/ui/webui/options/content_settings_handler.cc b/chrome/browser/ui/webui/options/content_settings_handler.cc
index 145061e32bb5200ac4e2c28bd60dacc9ff11d71e..50612e65c795b50524975ce3b79e338e3f231714 100644
--- a/chrome/browser/ui/webui/options/content_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/content_settings_handler.cc
@@ -677,15 +677,9 @@ std::string ContentSettingsHandler::GetSettingDefaultFromModel(
ContentSettingsType type, std::string* provider_id) {
Profile* profile = Profile::FromWebUI(web_ui());
ContentSetting default_setting;
- if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
- default_setting =
- DesktopNotificationServiceFactory::GetForProfile(profile)->
- GetDefaultContentSetting(provider_id);
- } else {
- default_setting =
- profile->GetHostContentSettingsMap()->
- GetDefaultContentSetting(type, provider_id);
- }
+ default_setting =
+ profile->GetHostContentSettingsMap()->
+ GetDefaultContentSetting(type, provider_id);
return ContentSettingToString(default_setting);
}
@@ -1170,8 +1164,12 @@ void ContentSettingsHandler::RemoveNotificationException(
DCHECK(content_setting == CONTENT_SETTING_ALLOW ||
content_setting == CONTENT_SETTING_BLOCK);
- DesktopNotificationServiceFactory::GetForProfile(profile)->
- ClearSetting(ContentSettingsPattern::FromString(origin));
+ profile->GetHostContentSettingsMap()->SetContentSetting(
+ ContentSettingsPattern::FromString(origin),
+ ContentSettingsPattern::Wildcard(),
+ CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
+ NO_RESOURCE_IDENTIFIER,
+ CONTENT_SETTING_DEFAULT);
}
void ContentSettingsHandler::RemoveMediaException(const base::ListValue* args) {
@@ -1313,14 +1311,11 @@ void ContentSettingsHandler::SetContentFilter(const base::ListValue* args) {
profile = profile->GetOriginalProfile();
#endif
- if (content_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
- DesktopNotificationServiceFactory::GetForProfile(profile)->
- SetDefaultContentSetting(default_setting);
- } else {
- HostContentSettingsMap* map = profile->GetHostContentSettingsMap();
- ApplyWhitelist(content_type, default_setting);
- map->SetDefaultContentSetting(content_type, default_setting);
- }
+
+ HostContentSettingsMap* map = profile->GetHostContentSettingsMap();
+ ApplyWhitelist(content_type, default_setting);
+ map->SetDefaultContentSetting(content_type, default_setting);
+
switch (content_type) {
case CONTENT_SETTINGS_TYPE_COOKIES:
content::RecordAction(

Powered by Google App Engine
This is Rietveld 408576698