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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
272 void RemoveObserver(content_settings::Observer* observer); | 272 void RemoveObserver(content_settings::Observer* observer); |
273 | 273 |
274 // Schedules any pending lossy website settings to be written to disk. | 274 // Schedules any pending lossy website settings to be written to disk. |
275 void FlushLossyWebsiteSettings(); | 275 void FlushLossyWebsiteSettings(); |
276 | 276 |
277 // Passes ownership of |clock|. | 277 // Passes ownership of |clock|. |
278 void SetPrefClockForTesting(scoped_ptr<base::Clock> clock); | 278 void SetPrefClockForTesting(scoped_ptr<base::Clock> clock); |
279 | 279 |
280 private: | 280 private: |
281 friend class base::RefCountedThreadSafe<HostContentSettingsMap>; | 281 friend class base::RefCountedThreadSafe<HostContentSettingsMap>; |
282 friend class HostContentSettingsMapTest_NonDefaultSettings_Test; | 282 friend class HostContentSettingsMapTest_MigrateOldSettings_Test; |
283 | |
283 friend class content_settings::TestUtils; | 284 friend class content_settings::TestUtils; |
284 | 285 |
285 typedef std::map<ProviderType, content_settings::ProviderInterface*> | 286 typedef std::map<ProviderType, content_settings::ProviderInterface*> |
286 ProviderMap; | 287 ProviderMap; |
287 typedef ProviderMap::iterator ProviderIterator; | 288 typedef ProviderMap::iterator ProviderIterator; |
288 typedef ProviderMap::const_iterator ConstProviderIterator; | 289 typedef ProviderMap::const_iterator ConstProviderIterator; |
289 | 290 |
290 ~HostContentSettingsMap() override; | 291 ~HostContentSettingsMap() override; |
291 | 292 |
292 ContentSetting GetDefaultContentSettingFromProvider( | 293 ContentSetting GetDefaultContentSettingFromProvider( |
293 ContentSettingsType content_type, | 294 ContentSettingsType content_type, |
294 content_settings::ProviderInterface* provider) const; | 295 content_settings::ProviderInterface* provider) const; |
295 | 296 |
297 // Migrate old settings for those ContentSettingsType which previously | |
298 // would use the same pattern twice instead of using | |
299 // ContentSettingsPattern::Wildcard(). This has no impact on lookups using | |
300 // GetContentSetting (because Wildcard matches everything) but it has an | |
301 // impact when trying to change the existing content setting. We need to | |
302 // migrate the old-format keys. | |
raymes
2016/03/07 01:47:55
I think we can rephrase this a bit because my expl
lshang
2016/03/23 13:58:36
Done.
| |
303 // TODO(lshang): Remove this when clients have migrated. We should leave in | |
304 // some code to remove old-format settings for a long time. | |
305 void MigrateOldSettings(); | |
306 | |
296 // Adds content settings for |content_type| and |resource_identifier|, | 307 // Adds content settings for |content_type| and |resource_identifier|, |
297 // provided by |provider|, into |settings|. If |incognito| is true, adds only | 308 // provided by |provider|, into |settings|. If |incognito| is true, adds only |
298 // the content settings which are applicable to the incognito mode and differ | 309 // the content settings which are applicable to the incognito mode and differ |
299 // from the normal mode. Otherwise, adds the content settings for the normal | 310 // from the normal mode. Otherwise, adds the content settings for the normal |
300 // mode. | 311 // mode. |
301 void AddSettingsForOneType( | 312 void AddSettingsForOneType( |
302 const content_settings::ProviderInterface* provider, | 313 const content_settings::ProviderInterface* provider, |
303 ProviderType provider_type, | 314 ProviderType provider_type, |
304 ContentSettingsType content_type, | 315 ContentSettingsType content_type, |
305 const std::string& resource_identifier, | 316 const std::string& resource_identifier, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
362 ProviderMap content_settings_providers_; | 373 ProviderMap content_settings_providers_; |
363 | 374 |
364 base::ThreadChecker thread_checker_; | 375 base::ThreadChecker thread_checker_; |
365 | 376 |
366 base::ObserverList<content_settings::Observer> observers_; | 377 base::ObserverList<content_settings::Observer> observers_; |
367 | 378 |
368 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); | 379 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); |
369 }; | 380 }; |
370 | 381 |
371 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ | 382 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ |
OLD | NEW |