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

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

Issue 1312453005: Removed Profile::GetHostContentSettingsMap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed patch conflict Created 5 years, 3 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 2a004193688506a49a9e525b33bbf1e17f460185..836b7ff3dcfd0c76ba5702835d2921085966d438 100644
--- a/chrome/browser/notifications/desktop_notification_profile_util.cc
+++ b/chrome/browser/notifications/desktop_notification_profile_util.cc
@@ -4,56 +4,67 @@
#include "chrome/browser/notifications/desktop_notification_profile_util.h"
+#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings_pattern.h"
void DesktopNotificationProfileUtil::ResetToDefaultContentSetting(
Profile* profile) {
- profile->GetHostContentSettingsMap()->SetDefaultContentSetting(
- CONTENT_SETTINGS_TYPE_NOTIFICATIONS, CONTENT_SETTING_DEFAULT);
+ HostContentSettingsMapFactory::GetForProfile(profile)
+ ->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
+ CONTENT_SETTING_DEFAULT);
}
// Clears the notifications setting for the given pattern.
void DesktopNotificationProfileUtil::ClearSetting(
Profile* profile, const ContentSettingsPattern& pattern) {
- profile->GetHostContentSettingsMap()->SetContentSetting(
- pattern, ContentSettingsPattern::Wildcard(),
+ HostContentSettingsMapFactory::GetForProfile(profile)->SetContentSetting(
+ pattern,
+ ContentSettingsPattern::Wildcard(),
CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
- content_settings::ResourceIdentifier(), CONTENT_SETTING_DEFAULT);
+ 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);
- profile->GetHostContentSettingsMap()->SetContentSetting(
- primary_pattern, ContentSettingsPattern::Wildcard(),
- CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
- content_settings::ResourceIdentifier(), CONTENT_SETTING_ALLOW);
+ ContentSettingsPattern primary_pattern =
+ ContentSettingsPattern::FromURLNoWildcard(origin);
+ HostContentSettingsMapFactory::GetForProfile(profile)->SetContentSetting(
+ primary_pattern,
+ ContentSettingsPattern::Wildcard(),
+ CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
+ content_settings::ResourceIdentifier(),
+ CONTENT_SETTING_ALLOW);
}
void DesktopNotificationProfileUtil::DenyPermission(
Profile* profile, const GURL& origin) {
- ContentSettingsPattern primary_pattern =
+ ContentSettingsPattern primary_pattern =
ContentSettingsPattern::FromURLNoWildcard(origin);
- profile->GetHostContentSettingsMap()->SetContentSetting(
- primary_pattern, ContentSettingsPattern::Wildcard(),
- CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
- content_settings::ResourceIdentifier(), CONTENT_SETTING_BLOCK);
+ HostContentSettingsMapFactory::GetForProfile(profile)->SetContentSetting(
+ primary_pattern,
+ ContentSettingsPattern::Wildcard(),
+ CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
+ content_settings::ResourceIdentifier(),
+ CONTENT_SETTING_BLOCK);
}
void DesktopNotificationProfileUtil::GetNotificationsSettings(
Profile* profile, ContentSettingsForOneType* settings) {
- profile->GetHostContentSettingsMap()->GetSettingsForOneType(
- CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
- content_settings::ResourceIdentifier(), settings);
+ HostContentSettingsMapFactory::GetForProfile(profile)
+ ->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
+ content_settings::ResourceIdentifier(),
+ settings);
}
ContentSetting DesktopNotificationProfileUtil::GetContentSetting(
Profile* profile, const GURL& origin) {
- return profile->GetHostContentSettingsMap()->GetContentSetting(
- origin, origin, CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
- content_settings::ResourceIdentifier());
+ return HostContentSettingsMapFactory::GetForProfile(profile)
+ ->GetContentSetting(origin,
+ origin,
+ CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
+ content_settings::ResourceIdentifier());
}

Powered by Google App Engine
This is Rietveld 408576698