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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 class ContentSettingsPref { | 36 class ContentSettingsPref { |
37 public: | 37 public: |
38 typedef base::Callback<void(const ContentSettingsPattern&, | 38 typedef base::Callback<void(const ContentSettingsPattern&, |
39 const ContentSettingsPattern&, | 39 const ContentSettingsPattern&, |
40 ContentSettingsType, | 40 ContentSettingsType, |
41 const std::string&)> NotifyObserversCallback; | 41 const std::string&)> NotifyObserversCallback; |
42 | 42 |
43 ContentSettingsPref(ContentSettingsType content_type, | 43 ContentSettingsPref(ContentSettingsType content_type, |
44 PrefService* prefs, | 44 PrefService* prefs, |
45 PrefChangeRegistrar* registrar, | 45 PrefChangeRegistrar* registrar, |
46 const char* pref_name, | 46 const std::string& pref_name, |
47 bool incognito, | 47 bool incognito, |
48 NotifyObserversCallback notify_callback); | 48 NotifyObserversCallback notify_callback); |
49 ~ContentSettingsPref(); | 49 ~ContentSettingsPref(); |
50 | 50 |
51 RuleIterator* GetRuleIterator(const ResourceIdentifier& resource_identifier, | 51 RuleIterator* GetRuleIterator(const ResourceIdentifier& resource_identifier, |
52 bool incognito) const; | 52 bool incognito) const; |
53 | 53 |
54 bool SetWebsiteSetting(const ContentSettingsPattern& primary_pattern, | 54 bool SetWebsiteSetting(const ContentSettingsPattern& primary_pattern, |
55 const ContentSettingsPattern& secondary_pattern, | 55 const ContentSettingsPattern& secondary_pattern, |
56 const ResourceIdentifier& resource_identifier, | 56 const ResourceIdentifier& resource_identifier, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // The type of content settings stored in this pref. | 103 // The type of content settings stored in this pref. |
104 ContentSettingsType content_type_; | 104 ContentSettingsType content_type_; |
105 | 105 |
106 // Weak; owned by the Profile and reset in ShutdownOnUIThread. | 106 // Weak; owned by the Profile and reset in ShutdownOnUIThread. |
107 PrefService* prefs_; | 107 PrefService* prefs_; |
108 | 108 |
109 // Owned by the PrefProvider. | 109 // Owned by the PrefProvider. |
110 PrefChangeRegistrar* registrar_; | 110 PrefChangeRegistrar* registrar_; |
111 | 111 |
112 // Name of the dictionary preference managed by this class. | 112 // Name of the dictionary preference managed by this class. |
113 const char* pref_name_; | 113 const std::string& pref_name_; |
114 | 114 |
115 bool is_incognito_; | 115 bool is_incognito_; |
116 | 116 |
117 // Whether we are currently updating preferences, this is used to ignore | 117 // Whether we are currently updating preferences, this is used to ignore |
118 // notifications from the preferences service that we triggered ourself. | 118 // notifications from the preferences service that we triggered ourself. |
119 bool updating_preferences_; | 119 bool updating_preferences_; |
120 | 120 |
121 OriginIdentifierValueMap value_map_; | 121 OriginIdentifierValueMap value_map_; |
122 | 122 |
123 OriginIdentifierValueMap incognito_value_map_; | 123 OriginIdentifierValueMap incognito_value_map_; |
124 | 124 |
125 NotifyObserversCallback notify_callback_; | 125 NotifyObserversCallback notify_callback_; |
126 | 126 |
127 // Used around accesses to the value map objects to guarantee thread safety. | 127 // Used around accesses to the value map objects to guarantee thread safety. |
128 mutable base::Lock lock_; | 128 mutable base::Lock lock_; |
129 | 129 |
130 base::ThreadChecker thread_checker_; | 130 base::ThreadChecker thread_checker_; |
131 | 131 |
132 DISALLOW_COPY_AND_ASSIGN(ContentSettingsPref); | 132 DISALLOW_COPY_AND_ASSIGN(ContentSettingsPref); |
133 }; | 133 }; |
134 | 134 |
135 } // namespace content_settings | 135 } // namespace content_settings |
136 | 136 |
137 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_PREF_H_ | 137 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_PREF_H_ |
OLD | NEW |