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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/notifications/desktop_notification_profile_util.h" 5 #include "chrome/browser/notifications/desktop_notification_profile_util.h"
6 6
7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
7 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
8 #include "components/content_settings/core/browser/host_content_settings_map.h" 9 #include "components/content_settings/core/browser/host_content_settings_map.h"
9 #include "components/content_settings/core/common/content_settings_pattern.h" 10 #include "components/content_settings/core/common/content_settings_pattern.h"
10 11
11 void DesktopNotificationProfileUtil::ResetToDefaultContentSetting( 12 void DesktopNotificationProfileUtil::ResetToDefaultContentSetting(
12 Profile* profile) { 13 Profile* profile) {
13 profile->GetHostContentSettingsMap()->SetDefaultContentSetting( 14 HostContentSettingsMapFactory::GetForProfile(profile)
14 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, CONTENT_SETTING_DEFAULT); 15 ->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
16 CONTENT_SETTING_DEFAULT);
15 } 17 }
16 18
17 // Clears the notifications setting for the given pattern. 19 // Clears the notifications setting for the given pattern.
18 void DesktopNotificationProfileUtil::ClearSetting( 20 void DesktopNotificationProfileUtil::ClearSetting(
19 Profile* profile, const ContentSettingsPattern& pattern) { 21 Profile* profile, const ContentSettingsPattern& pattern) {
20 profile->GetHostContentSettingsMap()->SetContentSetting( 22 HostContentSettingsMapFactory::GetForProfile(profile)->SetContentSetting(
21 pattern, ContentSettingsPattern::Wildcard(), 23 pattern,
24 ContentSettingsPattern::Wildcard(),
22 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 25 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
23 content_settings::ResourceIdentifier(), CONTENT_SETTING_DEFAULT); 26 content_settings::ResourceIdentifier(),
27 CONTENT_SETTING_DEFAULT);
24 } 28 }
25 29
26 // Methods to setup and modify permission preferences. 30 // Methods to setup and modify permission preferences.
27 void DesktopNotificationProfileUtil::GrantPermission( 31 void DesktopNotificationProfileUtil::GrantPermission(
28 Profile* profile, const GURL& origin) { 32 Profile* profile, const GURL& origin) {
29 ContentSettingsPattern primary_pattern = 33 ContentSettingsPattern primary_pattern =
30 ContentSettingsPattern::FromURLNoWildcard(origin); 34 ContentSettingsPattern::FromURLNoWildcard(origin);
31 profile->GetHostContentSettingsMap()->SetContentSetting( 35 HostContentSettingsMapFactory::GetForProfile(profile)->SetContentSetting(
32 primary_pattern, ContentSettingsPattern::Wildcard(), 36 primary_pattern,
33 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 37 ContentSettingsPattern::Wildcard(),
34 content_settings::ResourceIdentifier(), CONTENT_SETTING_ALLOW); 38 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
39 content_settings::ResourceIdentifier(),
40 CONTENT_SETTING_ALLOW);
35 } 41 }
36 42
37 void DesktopNotificationProfileUtil::DenyPermission( 43 void DesktopNotificationProfileUtil::DenyPermission(
38 Profile* profile, const GURL& origin) { 44 Profile* profile, const GURL& origin) {
39 ContentSettingsPattern primary_pattern = 45 ContentSettingsPattern primary_pattern =
40 ContentSettingsPattern::FromURLNoWildcard(origin); 46 ContentSettingsPattern::FromURLNoWildcard(origin);
41 profile->GetHostContentSettingsMap()->SetContentSetting( 47 HostContentSettingsMapFactory::GetForProfile(profile)->SetContentSetting(
42 primary_pattern, ContentSettingsPattern::Wildcard(), 48 primary_pattern,
43 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 49 ContentSettingsPattern::Wildcard(),
44 content_settings::ResourceIdentifier(), CONTENT_SETTING_BLOCK); 50 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
51 content_settings::ResourceIdentifier(),
52 CONTENT_SETTING_BLOCK);
45 } 53 }
46 54
47 void DesktopNotificationProfileUtil::GetNotificationsSettings( 55 void DesktopNotificationProfileUtil::GetNotificationsSettings(
48 Profile* profile, ContentSettingsForOneType* settings) { 56 Profile* profile, ContentSettingsForOneType* settings) {
49 profile->GetHostContentSettingsMap()->GetSettingsForOneType( 57 HostContentSettingsMapFactory::GetForProfile(profile)
50 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 58 ->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
51 content_settings::ResourceIdentifier(), settings); 59 content_settings::ResourceIdentifier(),
60 settings);
52 } 61 }
53 62
54 ContentSetting DesktopNotificationProfileUtil::GetContentSetting( 63 ContentSetting DesktopNotificationProfileUtil::GetContentSetting(
55 Profile* profile, const GURL& origin) { 64 Profile* profile, const GURL& origin) {
56 return profile->GetHostContentSettingsMap()->GetContentSetting( 65 return HostContentSettingsMapFactory::GetForProfile(profile)
57 origin, origin, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 66 ->GetContentSetting(origin,
58 content_settings::ResourceIdentifier()); 67 origin,
68 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
69 content_settings::ResourceIdentifier());
59 } 70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698