OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_PREF_H_ | 5 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_PREF_H_ |
6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_PREF_H_ | 6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_PREF_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 23 matching lines...) Expand all Loading... |
34 namespace content_settings { | 34 namespace content_settings { |
35 | 35 |
36 class RuleIterator; | 36 class RuleIterator; |
37 | 37 |
38 // Represents a single pref for reading/writing content settings of one type. | 38 // Represents a single pref for reading/writing content settings of one type. |
39 class ContentSettingsPref { | 39 class ContentSettingsPref { |
40 public: | 40 public: |
41 typedef base::Callback<void(const ContentSettingsPattern&, | 41 typedef base::Callback<void(const ContentSettingsPattern&, |
42 const ContentSettingsPattern&, | 42 const ContentSettingsPattern&, |
43 ContentSettingsType, | 43 ContentSettingsType, |
| 44 ContentSetting, |
44 const std::string&)> NotifyObserversCallback; | 45 const std::string&)> NotifyObserversCallback; |
45 | 46 |
46 ContentSettingsPref(ContentSettingsType content_type, | 47 ContentSettingsPref(ContentSettingsType content_type, |
47 PrefService* prefs, | 48 PrefService* prefs, |
48 PrefChangeRegistrar* registrar, | 49 PrefChangeRegistrar* registrar, |
49 const std::string& pref_name, | 50 const std::string& pref_name, |
50 bool incognito, | 51 bool incognito, |
51 NotifyObserversCallback notify_callback); | 52 NotifyObserversCallback notify_callback); |
52 ~ContentSettingsPref(); | 53 ~ContentSettingsPref(); |
53 | 54 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // into the |value_map_|. The |value_map_| is cleared first. | 86 // into the |value_map_|. The |value_map_| is cleared first. |
86 void ReadContentSettingsFromPref(); | 87 void ReadContentSettingsFromPref(); |
87 | 88 |
88 // Callback for changes in the pref with the same name. | 89 // Callback for changes in the pref with the same name. |
89 void OnPrefChanged(); | 90 void OnPrefChanged(); |
90 | 91 |
91 // Update the preference that stores content settings exceptions and syncs the | 92 // Update the preference that stores content settings exceptions and syncs the |
92 // value to the obsolete preference. When calling this function, |lock_| | 93 // value to the obsolete preference. When calling this function, |lock_| |
93 // should not be held, since this function will send out notifications of | 94 // should not be held, since this function will send out notifications of |
94 // preference changes. | 95 // preference changes. |
95 void UpdatePref( | 96 ContentSetting UpdatePref( |
96 const ContentSettingsPattern& primary_pattern, | 97 const ContentSettingsPattern& primary_pattern, |
97 const ContentSettingsPattern& secondary_pattern, | 98 const ContentSettingsPattern& secondary_pattern, |
98 const ResourceIdentifier& resource_identifier, | 99 const ResourceIdentifier& resource_identifier, |
99 const base::Value* value); | 100 const base::Value* value); |
100 | 101 |
101 static void CanonicalizeContentSettingsExceptions( | 102 static void CanonicalizeContentSettingsExceptions( |
102 base::DictionaryValue* all_settings_dictionary); | 103 base::DictionaryValue* all_settings_dictionary); |
103 | 104 |
104 // In the debug mode, asserts that |lock_| is not held by this thread. It's | 105 // In the debug mode, asserts that |lock_| is not held by this thread. It's |
105 // ok if some other thread holds |lock_|, as long as it will eventually | 106 // ok if some other thread holds |lock_|, as long as it will eventually |
(...skipping 28 matching lines...) Expand all Loading... |
134 mutable base::Lock lock_; | 135 mutable base::Lock lock_; |
135 | 136 |
136 base::ThreadChecker thread_checker_; | 137 base::ThreadChecker thread_checker_; |
137 | 138 |
138 DISALLOW_COPY_AND_ASSIGN(ContentSettingsPref); | 139 DISALLOW_COPY_AND_ASSIGN(ContentSettingsPref); |
139 }; | 140 }; |
140 | 141 |
141 } // namespace content_settings | 142 } // namespace content_settings |
142 | 143 |
143 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_PREF_H_ | 144 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_PREF_H_ |
OLD | NEW |