| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // DefaultContentSettingsProvider implementation. | 39 // DefaultContentSettingsProvider implementation. |
| 40 virtual ContentSetting ProvideDefaultSetting( | 40 virtual ContentSetting ProvideDefaultSetting( |
| 41 ContentSettingsType content_type) const; | 41 ContentSettingsType content_type) const; |
| 42 virtual void UpdateDefaultSetting(ContentSettingsType content_type, | 42 virtual void UpdateDefaultSetting(ContentSettingsType content_type, |
| 43 ContentSetting setting); | 43 ContentSetting setting); |
| 44 virtual bool DefaultSettingIsManaged(ContentSettingsType content_type) const; | 44 virtual bool DefaultSettingIsManaged(ContentSettingsType content_type) const; |
| 45 | 45 |
| 46 static void RegisterUserPrefs(PrefService* prefs); | 46 static void RegisterUserPrefs(PrefService* prefs); |
| 47 | 47 |
| 48 // NotificationObserver implementation. | 48 // NotificationObserver implementation. |
| 49 virtual void Observe(NotificationType type, | 49 virtual void Observe(int type, |
| 50 const NotificationSource& source, | 50 const NotificationSource& source, |
| 51 const NotificationDetails& details); | 51 const NotificationDetails& details); |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 // Informs observers that content settings have changed. Make sure that | 54 // Informs observers that content settings have changed. Make sure that |
| 55 // |lock_| is not held when calling this, as listeners will usually call one | 55 // |lock_| is not held when calling this, as listeners will usually call one |
| 56 // of the GetSettings functions in response, which would then lead to a | 56 // of the GetSettings functions in response, which would then lead to a |
| 57 // mutex deadlock. | 57 // mutex deadlock. |
| 58 void NotifyObservers(const ContentSettingsDetails& details); | 58 void NotifyObservers(const ContentSettingsDetails& details); |
| 59 | 59 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 virtual void GetAllContentSettingsRules( | 124 virtual void GetAllContentSettingsRules( |
| 125 ContentSettingsType content_type, | 125 ContentSettingsType content_type, |
| 126 const ResourceIdentifier& resource_identifier, | 126 const ResourceIdentifier& resource_identifier, |
| 127 Rules* content_setting_rules) const; | 127 Rules* content_setting_rules) const; |
| 128 | 128 |
| 129 virtual void ClearAllContentSettingsRules( | 129 virtual void ClearAllContentSettingsRules( |
| 130 ContentSettingsType content_type); | 130 ContentSettingsType content_type); |
| 131 | 131 |
| 132 // NotificationObserver implementation. | 132 // NotificationObserver implementation. |
| 133 virtual void Observe(NotificationType type, | 133 virtual void Observe(int type, |
| 134 const NotificationSource& source, | 134 const NotificationSource& source, |
| 135 const NotificationDetails& details); | 135 const NotificationDetails& details); |
| 136 | 136 |
| 137 private: | 137 private: |
| 138 void Init(); | 138 void Init(); |
| 139 | 139 |
| 140 // Reads all content settings exceptions from the preference and load them | 140 // Reads all content settings exceptions from the preference and load them |
| 141 // into the |value_map_|. The |value_map_| is cleared first if |overwrite| is | 141 // into the |value_map_|. The |value_map_| is cleared first if |overwrite| is |
| 142 // true. | 142 // true. |
| 143 void ReadContentSettingsFromPref(bool overwrite); | 143 void ReadContentSettingsFromPref(bool overwrite); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // Used around accesses to the value map objects to guarantee | 210 // Used around accesses to the value map objects to guarantee |
| 211 // thread safety. | 211 // thread safety. |
| 212 mutable base::Lock lock_; | 212 mutable base::Lock lock_; |
| 213 | 213 |
| 214 DISALLOW_COPY_AND_ASSIGN(PrefProvider); | 214 DISALLOW_COPY_AND_ASSIGN(PrefProvider); |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 } // namespace content_settings | 217 } // namespace content_settings |
| 218 | 218 |
| 219 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PREF_PROVIDER_H_ | 219 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PREF_PROVIDER_H_ |
| OLD | NEW |