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

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

Issue 1694923004: Use GURLs instead of patterns in SetContentSetting in notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scoping_set_content_setting
Patch Set: minor change Created 4 years, 9 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/notifications/desktop_notification_profile_util.cc
diff --git a/chrome/browser/notifications/desktop_notification_profile_util.cc b/chrome/browser/notifications/desktop_notification_profile_util.cc
index 836b7ff3dcfd0c76ba5702835d2921085966d438..22f9d16a2ffd897ac0c923bf10c48e71ca3f5233 100644
--- a/chrome/browser/notifications/desktop_notification_profile_util.cc
+++ b/chrome/browser/notifications/desktop_notification_profile_util.cc
@@ -17,39 +17,29 @@ void DesktopNotificationProfileUtil::ResetToDefaultContentSetting(
}
// Clears the notifications setting for the given pattern.
-void DesktopNotificationProfileUtil::ClearSetting(
- Profile* profile, const ContentSettingsPattern& pattern) {
- HostContentSettingsMapFactory::GetForProfile(profile)->SetContentSetting(
- pattern,
- ContentSettingsPattern::Wildcard(),
- CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
- content_settings::ResourceIdentifier(),
- CONTENT_SETTING_DEFAULT);
+void DesktopNotificationProfileUtil::ClearSetting(Profile* profile,
+ const GURL& origin) {
+ HostContentSettingsMapFactory::GetForProfile(profile)
+ ->SetContentSettingDefaultScope(
+ origin, GURL(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
+ content_settings::ResourceIdentifier(), CONTENT_SETTING_DEFAULT);
}
// Methods to setup and modify permission preferences.
void DesktopNotificationProfileUtil::GrantPermission(
Profile* profile, const GURL& origin) {
- ContentSettingsPattern primary_pattern =
- ContentSettingsPattern::FromURLNoWildcard(origin);
- HostContentSettingsMapFactory::GetForProfile(profile)->SetContentSetting(
- primary_pattern,
- ContentSettingsPattern::Wildcard(),
- CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
- content_settings::ResourceIdentifier(),
- CONTENT_SETTING_ALLOW);
+ HostContentSettingsMapFactory::GetForProfile(profile)
+ ->SetContentSettingDefaultScope(
+ origin, GURL(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
+ content_settings::ResourceIdentifier(), CONTENT_SETTING_ALLOW);
}
void DesktopNotificationProfileUtil::DenyPermission(
Profile* profile, const GURL& origin) {
- ContentSettingsPattern primary_pattern =
- ContentSettingsPattern::FromURLNoWildcard(origin);
- HostContentSettingsMapFactory::GetForProfile(profile)->SetContentSetting(
- primary_pattern,
- ContentSettingsPattern::Wildcard(),
- CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
- content_settings::ResourceIdentifier(),
- CONTENT_SETTING_BLOCK);
+ HostContentSettingsMapFactory::GetForProfile(profile)
+ ->SetContentSettingDefaultScope(
+ origin, GURL(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
+ content_settings::ResourceIdentifier(), CONTENT_SETTING_BLOCK);
}
void DesktopNotificationProfileUtil::GetNotificationsSettings(

Powered by Google App Engine
This is Rietveld 408576698