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 CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ | 8 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ |
9 #define CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ | 9 #define CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ |
10 | 10 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 // Returns true if the values for content type are of type dictionary/map. | 186 // Returns true if the values for content type are of type dictionary/map. |
187 static bool ContentTypeHasCompoundValue(ContentSettingsType type); | 187 static bool ContentTypeHasCompoundValue(ContentSettingsType type); |
188 | 188 |
189 // Detaches the HostContentSettingsMap from all Profile-related objects like | 189 // Detaches the HostContentSettingsMap from all Profile-related objects like |
190 // PrefService. This methods needs to be called before destroying the Profile. | 190 // PrefService. This methods needs to be called before destroying the Profile. |
191 // Afterwards, none of the methods above that should only be called on the UI | 191 // Afterwards, none of the methods above that should only be called on the UI |
192 // thread should be called anymore. | 192 // thread should be called anymore. |
193 void ShutdownOnUIThread(); | 193 void ShutdownOnUIThread(); |
194 | 194 |
195 // content_settings::Observer implementation. | 195 // content_settings::Observer implementation. |
196 virtual void OnContentSettingChanged( | 196 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern, |
197 const ContentSettingsPattern& primary_pattern, | 197 const ContentSettingsPattern& secondary_pattern, |
198 const ContentSettingsPattern& secondary_pattern, | 198 ContentSettingsType content_type, |
199 ContentSettingsType content_type, | 199 std::string resource_identifier) override; |
200 std::string resource_identifier) override; | |
201 | 200 |
202 // Returns true if we should allow all content types for this URL. This is | 201 // Returns true if we should allow all content types for this URL. This is |
203 // true for various internal objects like chrome:// URLs, so UI and other | 202 // true for various internal objects like chrome:// URLs, so UI and other |
204 // things users think of as "not webpages" don't break. | 203 // things users think of as "not webpages" don't break. |
205 static bool ShouldAllowAllContent(const GURL& primary_url, | 204 static bool ShouldAllowAllContent(const GURL& primary_url, |
206 const GURL& secondary_url, | 205 const GURL& secondary_url, |
207 ContentSettingsType content_type); | 206 ContentSettingsType content_type); |
208 | 207 |
209 // Returns the ProviderType associated with the given source string. | 208 // Returns the ProviderType associated with the given source string. |
210 // TODO(estade): I regret adding this. At the moment there are no legitimate | 209 // TODO(estade): I regret adding this. At the moment there are no legitimate |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 285 |
287 private: | 286 private: |
288 friend class base::RefCountedThreadSafe<HostContentSettingsMap>; | 287 friend class base::RefCountedThreadSafe<HostContentSettingsMap>; |
289 friend class HostContentSettingsMapTest_NonDefaultSettings_Test; | 288 friend class HostContentSettingsMapTest_NonDefaultSettings_Test; |
290 | 289 |
291 typedef std::map<ProviderType, content_settings::ProviderInterface*> | 290 typedef std::map<ProviderType, content_settings::ProviderInterface*> |
292 ProviderMap; | 291 ProviderMap; |
293 typedef ProviderMap::iterator ProviderIterator; | 292 typedef ProviderMap::iterator ProviderIterator; |
294 typedef ProviderMap::const_iterator ConstProviderIterator; | 293 typedef ProviderMap::const_iterator ConstProviderIterator; |
295 | 294 |
296 virtual ~HostContentSettingsMap(); | 295 ~HostContentSettingsMap() override; |
297 | 296 |
298 ContentSetting GetDefaultContentSettingFromProvider( | 297 ContentSetting GetDefaultContentSettingFromProvider( |
299 ContentSettingsType content_type, | 298 ContentSettingsType content_type, |
300 content_settings::ProviderInterface* provider) const; | 299 content_settings::ProviderInterface* provider) const; |
301 | 300 |
302 // Migrate the Clear on exit pref into equivalent content settings. | 301 // Migrate the Clear on exit pref into equivalent content settings. |
303 void MigrateObsoleteClearOnExitPref(); | 302 void MigrateObsoleteClearOnExitPref(); |
304 | 303 |
305 // Adds content settings for |content_type| and |resource_identifier|, | 304 // Adds content settings for |content_type| and |resource_identifier|, |
306 // provided by |provider|, into |settings|. If |incognito| is true, adds only | 305 // provided by |provider|, into |settings|. If |incognito| is true, adds only |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 // time and by RegisterExtensionService, both of which should happen | 352 // time and by RegisterExtensionService, both of which should happen |
354 // before any other uses of it. | 353 // before any other uses of it. |
355 ProviderMap content_settings_providers_; | 354 ProviderMap content_settings_providers_; |
356 | 355 |
357 ObserverList<content_settings::Observer> observers_; | 356 ObserverList<content_settings::Observer> observers_; |
358 | 357 |
359 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); | 358 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); |
360 }; | 359 }; |
361 | 360 |
362 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ | 361 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ |
OLD | NEW |