OLD | NEW |
1 // Copyright (c) 2012 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 // Maps hostnames to custom content settings. Written on the UI thread and read | 5 // Maps hostnames to custom content settings. Written on the UI thread and read |
6 // on any thread. One instance per profile. | 6 // on any thread. One instance per profile. |
7 | 7 |
8 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ | 8 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ |
9 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ | 9 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ |
10 | 10 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // Sets the default setting for a particular content type. This method must | 127 // Sets the default setting for a particular content type. This method must |
128 // not be invoked on an incognito map. | 128 // not be invoked on an incognito map. |
129 // | 129 // |
130 // This should only be called on the UI thread. | 130 // This should only be called on the UI thread. |
131 void SetDefaultContentSetting(ContentSettingsType content_type, | 131 void SetDefaultContentSetting(ContentSettingsType content_type, |
132 ContentSetting setting); | 132 ContentSetting setting); |
133 | 133 |
134 // Sets the content |setting| for the given patterns, |content_type| and | 134 // Sets the content |setting| for the given patterns, |content_type| and |
135 // |resource_identifier|. Setting the value to CONTENT_SETTING_DEFAULT causes | 135 // |resource_identifier|. Setting the value to CONTENT_SETTING_DEFAULT causes |
136 // the default setting for that type to be used when loading pages matching | 136 // the default setting for that type to be used when loading pages matching |
137 // this pattern. | 137 // this pattern. Unless adding a custom-scoped setting, most developers will |
| 138 // want to use SetContentSettingDefaultScope() instead. |
| 139 // |
138 // NOTICE: This is just a convenience method for content types that use | 140 // NOTICE: This is just a convenience method for content types that use |
139 // |CONTENT_SETTING| as their data type. For content types that use other | 141 // |CONTENT_SETTING| as their data type. For content types that use other |
140 // data types please use the method SetWebsiteSettingDefaultScope(). | 142 // data types please use the method SetWebsiteSettingDefaultScope(). |
141 // | 143 // |
142 // This should only be called on the UI thread. | 144 // This should only be called on the UI thread. |
143 // TODO(raymes): Create a version of this function which uses the default | |
144 // scope. | |
145 void SetContentSetting(const ContentSettingsPattern& primary_pattern, | 145 void SetContentSetting(const ContentSettingsPattern& primary_pattern, |
146 const ContentSettingsPattern& secondary_pattern, | 146 const ContentSettingsPattern& secondary_pattern, |
147 ContentSettingsType content_type, | 147 ContentSettingsType content_type, |
148 const std::string& resource_identifier, | 148 const std::string& resource_identifier, |
149 ContentSetting setting); | 149 ContentSetting setting); |
150 | 150 |
| 151 // Sets the content |setting| for the default scope of the url that is |
| 152 // appropriate for the given |content_type| and |resource_identifier|. |
| 153 // Setting the value to CONTENT_SETTING_DEFAULT causes the default setting |
| 154 // for that type to be used. |
| 155 // |
| 156 // NOTICE: This is just a convenience method for content types that use |
| 157 // |CONTENT_SETTING| as their data type. For content types that use other |
| 158 // data types please use the method SetWebsiteSettingDefaultScope(). |
| 159 // |
| 160 // This should only be called on the UI thread. |
| 161 // |
| 162 // Internally this will call SetContentSetting() with the default scope |
| 163 // patterns for the given |content_type|. Developers will generally want |
| 164 // to use this function instead of SetContentSetting() unless they need |
| 165 // to specify custom scoping. |
| 166 void SetContentSettingDefaultScope(const GURL& primary_url, |
| 167 const GURL& secondary_url, |
| 168 ContentSettingsType content_type, |
| 169 const std::string& resource_identifier, |
| 170 ContentSetting setting); |
| 171 |
151 // Sets the |value| for the default scope of the url that is appropriate for | 172 // Sets the |value| for the default scope of the url that is appropriate for |
152 // the given |content_type| and |resource_identifier|. Setting the value to | 173 // the given |content_type| and |resource_identifier|. Setting the value to |
153 // null removes the default pattern pair for this content type. | 174 // null removes the default pattern pair for this content type. |
154 // | 175 // |
155 // Internally this will call SetWebsiteSettingCustomScope() with the default | 176 // Internally this will call SetWebsiteSettingCustomScope() with the default |
156 // scope patterns for the given |content_type|. Developers will generally want | 177 // scope patterns for the given |content_type|. Developers will generally want |
157 // to use this function instead of SetWebsiteSettingCustomScope() unless they | 178 // to use this function instead of SetWebsiteSettingCustomScope() unless they |
158 // need to specify custom scoping. | 179 // need to specify custom scoping. |
159 void SetWebsiteSettingDefaultScope(const GURL& requesting_url, | 180 void SetWebsiteSettingDefaultScope(const GURL& requesting_url, |
160 const GURL& top_level_url, | 181 const GURL& top_level_url, |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 ProviderMap content_settings_providers_; | 362 ProviderMap content_settings_providers_; |
342 | 363 |
343 base::ThreadChecker thread_checker_; | 364 base::ThreadChecker thread_checker_; |
344 | 365 |
345 base::ObserverList<content_settings::Observer> observers_; | 366 base::ObserverList<content_settings::Observer> observers_; |
346 | 367 |
347 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); | 368 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); |
348 }; | 369 }; |
349 | 370 |
350 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ | 371 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ |
OLD | NEW |