| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PREF_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PREF_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PREF_PROVIDER_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PREF_PROVIDER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 // A content settings provider that takes its settings out of the pref service. | 9 // A content settings provider that takes its settings out of the pref service. |
| 10 | 10 |
| 11 #include <vector> | 11 #include <vector> |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 // Updates the given |pattern_pairs_settings| dictionary value. | 82 // Updates the given |pattern_pairs_settings| dictionary value. |
| 83 void UpdatePatternPairsSettings( | 83 void UpdatePatternPairsSettings( |
| 84 const ContentSettingsPattern& primary_pattern, | 84 const ContentSettingsPattern& primary_pattern, |
| 85 const ContentSettingsPattern& secondary_pattern, | 85 const ContentSettingsPattern& secondary_pattern, |
| 86 ContentSettingsType content_type, | 86 ContentSettingsType content_type, |
| 87 const ResourceIdentifier& resource_identifier, | 87 const ResourceIdentifier& resource_identifier, |
| 88 const base::Value* value, | 88 const base::Value* value, |
| 89 DictionaryValue* pattern_pairs_settings); | 89 DictionaryValue* pattern_pairs_settings); |
| 90 | 90 |
| 91 // Updates the preferences prefs::kContentSettingsPatterns. This preferences | |
| 92 // is obsolete and only used for compatibility reasons. | |
| 93 void UpdateObsoletePatternsPref( | |
| 94 const ContentSettingsPattern& primary_pattern, | |
| 95 const ContentSettingsPattern& secondary_pattern, | |
| 96 ContentSettingsType content_type, | |
| 97 const ResourceIdentifier& resource_identifier, | |
| 98 ContentSetting setting); | |
| 99 | |
| 100 // Updates the preference prefs::kGeolocationContentSettings. This preference | |
| 101 // is obsolete and only used to keep sync working with older chrome versions | |
| 102 // that do not know about the new preference. | |
| 103 void UpdateObsoleteGeolocationPref( | |
| 104 const ContentSettingsPattern& primary_pattern, | |
| 105 const ContentSettingsPattern& secondary_pattern, | |
| 106 ContentSetting setting); | |
| 107 | |
| 108 // Updates the obsolete notifications settings in the passed list values | |
| 109 // |allowed_sites| and |denied_sites|. | |
| 110 void UpdateObsoleteNotificationsSettings( | |
| 111 const ContentSettingsPattern& primary_pattern, | |
| 112 const ContentSettingsPattern& secondary_pattern, | |
| 113 ContentSetting setting, | |
| 114 ListValue* allowed_sites, | |
| 115 ListValue* denied_sites); | |
| 116 | |
| 117 // Various migration methods (old cookie, popup and per-host data gets | 91 // Various migration methods (old cookie, popup and per-host data gets |
| 118 // migrated to the new format). When calling these functions, |lock_| | 92 // migrated to the new format). When calling these functions, |lock_| |
| 119 // should not be held, since these functions will send out notifications of | 93 // should not be held, since these functions will send out notifications of |
| 120 // preference changes. | 94 // preference changes. |
| 121 void MigrateObsoletePerhostPref(); | 95 void MigrateObsoletePerhostPref(); |
| 122 void MigrateObsoletePopupsPref(); | 96 void MigrateObsoletePopupsPref(); |
| 123 void MigrateObsoleteContentSettingsPatternPref(); | 97 void MigrateObsoleteContentSettingsPatternPref(); |
| 124 void MigrateObsoleteGeolocationPref(); | 98 void MigrateObsoleteGeolocationPref(); |
| 125 void MigrateObsoleteNotificationsPrefs(); | 99 void MigrateObsoleteNotificationsPrefs(); |
| 126 | 100 |
| 127 // Copies the value of the preference that stores the content settings | |
| 128 // exceptions to the obsolete preference for content settings exceptions. This | |
| 129 // is necessary to allow content settings exceptions beeing synced to older | |
| 130 // versions of chrome that only use the obsolete preference. | |
| 131 void SyncObsoletePatternPref(); | |
| 132 | |
| 133 // Copies the notifications and geolocation content settings exceptions from | |
| 134 // the preference that stores the content settings exceptions to the obsolete | |
| 135 // preference for notification and geolocation content settings exceptions. | |
| 136 // This is necessary to allow notifications and geolocation content settings | |
| 137 // exceptions being synced to older versions of chrome that only use the | |
| 138 // obsolete preference. | |
| 139 void SyncObsoletePrefs(); | |
| 140 | |
| 141 static void CanonicalizeContentSettingsExceptions( | 101 static void CanonicalizeContentSettingsExceptions( |
| 142 base::DictionaryValue* all_settings_dictionary); | 102 base::DictionaryValue* all_settings_dictionary); |
| 143 | 103 |
| 144 // In the debug mode, asserts that |lock_| is not held by this thread. It's | 104 // In the debug mode, asserts that |lock_| is not held by this thread. It's |
| 145 // ok if some other thread holds |lock_|, as long as it will eventually | 105 // ok if some other thread holds |lock_|, as long as it will eventually |
| 146 // release it. | 106 // release it. |
| 147 void AssertLockNotHeld() const; | 107 void AssertLockNotHeld() const; |
| 148 | 108 |
| 149 // Weak; owned by the Profile and reset in ShutdownOnUIThread. | 109 // Weak; owned by the Profile and reset in ShutdownOnUIThread. |
| 150 PrefService* prefs_; | 110 PrefService* prefs_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 163 | 123 |
| 164 // Used around accesses to the value map objects to guarantee thread safety. | 124 // Used around accesses to the value map objects to guarantee thread safety. |
| 165 mutable base::Lock lock_; | 125 mutable base::Lock lock_; |
| 166 | 126 |
| 167 DISALLOW_COPY_AND_ASSIGN(PrefProvider); | 127 DISALLOW_COPY_AND_ASSIGN(PrefProvider); |
| 168 }; | 128 }; |
| 169 | 129 |
| 170 } // namespace content_settings | 130 } // namespace content_settings |
| 171 | 131 |
| 172 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PREF_PROVIDER_H_ | 132 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PREF_PROVIDER_H_ |
| OLD | NEW |