| 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 // Adds/removes an observer for content settings changes. | 271 // Adds/removes an observer for content settings changes. |
| 272 void AddObserver(content_settings::Observer* observer); | 272 void AddObserver(content_settings::Observer* observer); |
| 273 void RemoveObserver(content_settings::Observer* observer); | 273 void RemoveObserver(content_settings::Observer* observer); |
| 274 | 274 |
| 275 // Schedules any pending lossy website settings to be written to disk. | 275 // Schedules any pending lossy website settings to be written to disk. |
| 276 void FlushLossyWebsiteSettings(); | 276 void FlushLossyWebsiteSettings(); |
| 277 | 277 |
| 278 // Passes ownership of |clock|. | 278 // Passes ownership of |clock|. |
| 279 void SetPrefClockForTesting(std::unique_ptr<base::Clock> clock); | 279 void SetPrefClockForTesting(std::unique_ptr<base::Clock> clock); |
| 280 | 280 |
| 281 // Migrate old domain scoped ALLOW settings to be origin scoped for |
| 282 // ContentSettingsTypes which are domain scoped. Only narrow down ALLOW |
| 283 // domain settings to origins so that this will not cause privacy/security |
| 284 // issues. |
| 285 // TODO(lshang): https://crbug.com/621398 Remove this when clients have |
| 286 // migrated (~M55). |
| 287 void MigrateDomainScopedSettings(); |
| 288 |
| 281 private: | 289 private: |
| 282 friend class base::RefCountedThreadSafe<HostContentSettingsMap>; | 290 friend class base::RefCountedThreadSafe<HostContentSettingsMap>; |
| 283 friend class HostContentSettingsMapTest_MigrateDomainScopedSettings_Test; | 291 friend class HostContentSettingsMapTest_MigrateDomainScopedSettings_Test; |
| 284 friend class HostContentSettingsMapTest_MigrateKeygenSettings_Test; | 292 friend class HostContentSettingsMapTest_MigrateKeygenSettings_Test; |
| 285 | 293 |
| 286 friend class content_settings::TestUtils; | 294 friend class content_settings::TestUtils; |
| 287 | 295 |
| 288 typedef std::map<ProviderType, content_settings::ProviderInterface*> | 296 typedef std::map<ProviderType, content_settings::ProviderInterface*> |
| 289 ProviderMap; | 297 ProviderMap; |
| 290 typedef ProviderMap::iterator ProviderIterator; | 298 typedef ProviderMap::iterator ProviderIterator; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 305 // Migrate Keygen settings which only use a primary pattern. Settings which | 313 // Migrate Keygen settings which only use a primary pattern. Settings which |
| 306 // only used a primary pattern were inconsistent in what they did with the | 314 // only used a primary pattern were inconsistent in what they did with the |
| 307 // secondary pattern. Some stored a ContentSettingsPattern::Wildcard() whereas | 315 // secondary pattern. Some stored a ContentSettingsPattern::Wildcard() whereas |
| 308 // others stored the same pattern twice. This function migrates all such | 316 // others stored the same pattern twice. This function migrates all such |
| 309 // settings to use ContentSettingsPattern::Wildcard(). This allows us to make | 317 // settings to use ContentSettingsPattern::Wildcard(). This allows us to make |
| 310 // the scoping code consistent across different settings. | 318 // the scoping code consistent across different settings. |
| 311 // TODO(lshang): Remove this when clients have migrated (~M53). We should | 319 // TODO(lshang): Remove this when clients have migrated (~M53). We should |
| 312 // leave in some code to remove old-format settings for a long time. | 320 // leave in some code to remove old-format settings for a long time. |
| 313 void MigrateKeygenSettings(); | 321 void MigrateKeygenSettings(); |
| 314 | 322 |
| 315 // Migrate old domain scoped ALLOW settings to be origin scoped for | |
| 316 // ContentSettingsTypes which are domain scoped. Only narrow down ALLOW | |
| 317 // domain settings to origins so that this will not cause privacy/security | |
| 318 // issues. | |
| 319 // TODO(lshang): https://crbug.com/621398 Remove this when clients have | |
| 320 // migrated (~M55). | |
| 321 void MigrateDomainScopedSettings(); | |
| 322 | |
| 323 // Collect UMA data about the number of exceptions. | 323 // Collect UMA data about the number of exceptions. |
| 324 void RecordNumberOfExceptions(); | 324 void RecordNumberOfExceptions(); |
| 325 | 325 |
| 326 // Adds content settings for |content_type| and |resource_identifier|, | 326 // Adds content settings for |content_type| and |resource_identifier|, |
| 327 // provided by |provider|, into |settings|. If |incognito| is true, adds only | 327 // provided by |provider|, into |settings|. If |incognito| is true, adds only |
| 328 // the content settings which are applicable to the incognito mode and differ | 328 // the content settings which are applicable to the incognito mode and differ |
| 329 // from the normal mode. Otherwise, adds the content settings for the normal | 329 // from the normal mode. Otherwise, adds the content settings for the normal |
| 330 // mode. | 330 // mode. |
| 331 void AddSettingsForOneType( | 331 void AddSettingsForOneType( |
| 332 const content_settings::ProviderInterface* provider, | 332 const content_settings::ProviderInterface* provider, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 content_settings::PrefProvider* pref_provider_ = nullptr; | 393 content_settings::PrefProvider* pref_provider_ = nullptr; |
| 394 | 394 |
| 395 base::ThreadChecker thread_checker_; | 395 base::ThreadChecker thread_checker_; |
| 396 | 396 |
| 397 base::ObserverList<content_settings::Observer> observers_; | 397 base::ObserverList<content_settings::Observer> observers_; |
| 398 | 398 |
| 399 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); | 399 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); |
| 400 }; | 400 }; |
| 401 | 401 |
| 402 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ | 402 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ |
| OLD | NEW |