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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 private: | 281 private: |
282 friend class base::RefCountedThreadSafe<HostContentSettingsMap>; | 282 friend class base::RefCountedThreadSafe<HostContentSettingsMap>; |
| 283 friend class HostContentSettingsMapTest_MigrateDomainScopedSettings_Test; |
283 friend class HostContentSettingsMapTest_MigrateKeygenSettings_Test; | 284 friend class HostContentSettingsMapTest_MigrateKeygenSettings_Test; |
284 | 285 |
285 friend class content_settings::TestUtils; | 286 friend class content_settings::TestUtils; |
286 | 287 |
287 typedef std::map<ProviderType, content_settings::ProviderInterface*> | 288 typedef std::map<ProviderType, content_settings::ProviderInterface*> |
288 ProviderMap; | 289 ProviderMap; |
289 typedef ProviderMap::iterator ProviderIterator; | 290 typedef ProviderMap::iterator ProviderIterator; |
290 typedef ProviderMap::const_iterator ConstProviderIterator; | 291 typedef ProviderMap::const_iterator ConstProviderIterator; |
291 | 292 |
292 ~HostContentSettingsMap() override; | 293 ~HostContentSettingsMap() override; |
(...skipping 11 matching lines...) Expand all Loading... |
304 // Migrate Keygen settings which only use a primary pattern. Settings which | 305 // Migrate Keygen settings which only use a primary pattern. Settings which |
305 // only used a primary pattern were inconsistent in what they did with the | 306 // only used a primary pattern were inconsistent in what they did with the |
306 // secondary pattern. Some stored a ContentSettingsPattern::Wildcard() whereas | 307 // secondary pattern. Some stored a ContentSettingsPattern::Wildcard() whereas |
307 // others stored the same pattern twice. This function migrates all such | 308 // others stored the same pattern twice. This function migrates all such |
308 // settings to use ContentSettingsPattern::Wildcard(). This allows us to make | 309 // settings to use ContentSettingsPattern::Wildcard(). This allows us to make |
309 // the scoping code consistent across different settings. | 310 // the scoping code consistent across different settings. |
310 // TODO(lshang): Remove this when clients have migrated (~M53). We should | 311 // TODO(lshang): Remove this when clients have migrated (~M53). We should |
311 // leave in some code to remove old-format settings for a long time. | 312 // leave in some code to remove old-format settings for a long time. |
312 void MigrateKeygenSettings(); | 313 void MigrateKeygenSettings(); |
313 | 314 |
| 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 (~M56). |
| 321 void MigrateDomainScopedSettings(); |
| 322 |
314 // Collect UMA data about the number of exceptions. | 323 // Collect UMA data about the number of exceptions. |
315 void RecordNumberOfExceptions(); | 324 void RecordNumberOfExceptions(); |
316 | 325 |
317 // Adds content settings for |content_type| and |resource_identifier|, | 326 // Adds content settings for |content_type| and |resource_identifier|, |
318 // provided by |provider|, into |settings|. If |incognito| is true, adds only | 327 // provided by |provider|, into |settings|. If |incognito| is true, adds only |
319 // 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 |
320 // 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 |
321 // mode. | 330 // mode. |
322 void AddSettingsForOneType( | 331 void AddSettingsForOneType( |
323 const content_settings::ProviderInterface* provider, | 332 const content_settings::ProviderInterface* provider, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 content_settings::PrefProvider* pref_provider_ = nullptr; | 393 content_settings::PrefProvider* pref_provider_ = nullptr; |
385 | 394 |
386 base::ThreadChecker thread_checker_; | 395 base::ThreadChecker thread_checker_; |
387 | 396 |
388 base::ObserverList<content_settings::Observer> observers_; | 397 base::ObserverList<content_settings::Observer> observers_; |
389 | 398 |
390 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); | 399 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); |
391 }; | 400 }; |
392 | 401 |
393 #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 |