| 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 26 matching lines...) Expand all Loading... |
| 37 PrefProvider(PrefService* prefs, | 37 PrefProvider(PrefService* prefs, |
| 38 bool incognito); | 38 bool incognito); |
| 39 virtual ~PrefProvider(); | 39 virtual ~PrefProvider(); |
| 40 | 40 |
| 41 // ProviderInterface implementations. | 41 // ProviderInterface implementations. |
| 42 virtual RuleIterator* GetRuleIterator( | 42 virtual RuleIterator* GetRuleIterator( |
| 43 ContentSettingsType content_type, | 43 ContentSettingsType content_type, |
| 44 const ResourceIdentifier& resource_identifier, | 44 const ResourceIdentifier& resource_identifier, |
| 45 bool incognito) const OVERRIDE; | 45 bool incognito) const OVERRIDE; |
| 46 | 46 |
| 47 virtual void SetContentSetting( | 47 virtual bool SetWebsiteSetting( |
| 48 const ContentSettingsPattern& primary_pattern, | 48 const ContentSettingsPattern& primary_pattern, |
| 49 const ContentSettingsPattern& secondary_pattern, | 49 const ContentSettingsPattern& secondary_pattern, |
| 50 ContentSettingsType content_type, | 50 ContentSettingsType content_type, |
| 51 const ResourceIdentifier& resource_identifier, | 51 const ResourceIdentifier& resource_identifier, |
| 52 ContentSetting content_setting) OVERRIDE; | 52 Value* value) OVERRIDE; |
| 53 | 53 |
| 54 virtual void ClearAllContentSettingsRules( | 54 virtual void ClearAllContentSettingsRules( |
| 55 ContentSettingsType content_type) OVERRIDE; | 55 ContentSettingsType content_type) OVERRIDE; |
| 56 | 56 |
| 57 virtual void ShutdownOnUIThread() OVERRIDE; | 57 virtual void ShutdownOnUIThread() OVERRIDE; |
| 58 | 58 |
| 59 // content::NotificationObserver implementation. | 59 // content::NotificationObserver implementation. |
| 60 virtual void Observe(int type, | 60 virtual void Observe(int type, |
| 61 const content::NotificationSource& source, | 61 const content::NotificationSource& source, |
| 62 const content::NotificationDetails& details) OVERRIDE; | 62 const content::NotificationDetails& details) OVERRIDE; |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 friend class DeadlockCheckerThread; // For testing. | 65 friend class DeadlockCheckerThread; // For testing. |
| 66 // Reads all content settings exceptions from the preference and load them | 66 // Reads all content settings exceptions from the preference and load them |
| 67 // into the |value_map_|. The |value_map_| is cleared first if |overwrite| is | 67 // into the |value_map_|. The |value_map_| is cleared first if |overwrite| is |
| 68 // true. | 68 // true. |
| 69 void ReadContentSettingsFromPref(bool overwrite); | 69 void ReadContentSettingsFromPref(bool overwrite); |
| 70 | 70 |
| 71 // Update the preference that stores content settings exceptions and syncs the | 71 // Update the preference that stores content settings exceptions and syncs the |
| 72 // value to the obsolete preference. When calling this function, |lock_| | 72 // value to the obsolete preference. When calling this function, |lock_| |
| 73 // should not be held, since this function will send out notifications of | 73 // should not be held, since this function will send out notifications of |
| 74 // preference changes. | 74 // preference changes. |
| 75 void UpdatePref( | 75 void UpdatePref( |
| 76 const ContentSettingsPattern& primary_pattern, | 76 const ContentSettingsPattern& primary_pattern, |
| 77 const ContentSettingsPattern& secondary_pattern, | 77 const ContentSettingsPattern& secondary_pattern, |
| 78 ContentSettingsType content_type, | 78 ContentSettingsType content_type, |
| 79 const ResourceIdentifier& resource_identifier, | 79 const ResourceIdentifier& resource_identifier, |
| 80 ContentSetting setting); | 80 const base::Value* value); |
| 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 ContentSetting setting, | 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 | 91 // Updates the preferences prefs::kContentSettingsPatterns. This preferences |
| 92 // is obsolete and only used for compatibility reasons. | 92 // is obsolete and only used for compatibility reasons. |
| 93 void UpdateObsoletePatternsPref( | 93 void UpdateObsoletePatternsPref( |
| 94 const ContentSettingsPattern& primary_pattern, | 94 const ContentSettingsPattern& primary_pattern, |
| 95 const ContentSettingsPattern& secondary_pattern, | 95 const ContentSettingsPattern& secondary_pattern, |
| 96 ContentSettingsType content_type, | 96 ContentSettingsType content_type, |
| 97 const ResourceIdentifier& resource_identifier, | 97 const ResourceIdentifier& resource_identifier, |
| 98 ContentSetting setting); | 98 ContentSetting setting); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 // Used around accesses to the value map objects to guarantee thread safety. | 164 // Used around accesses to the value map objects to guarantee thread safety. |
| 165 mutable base::Lock lock_; | 165 mutable base::Lock lock_; |
| 166 | 166 |
| 167 DISALLOW_COPY_AND_ASSIGN(PrefProvider); | 167 DISALLOW_COPY_AND_ASSIGN(PrefProvider); |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 } // namespace content_settings | 170 } // namespace content_settings |
| 171 | 171 |
| 172 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PREF_PROVIDER_H_ | 172 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PREF_PROVIDER_H_ |
| OLD | NEW |