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_DomainToOriginMigrationStatus_Test; | |
283 friend class HostContentSettingsMapTest_MigrateDomainScopedSettings_Test; | 284 friend class HostContentSettingsMapTest_MigrateDomainScopedSettings_Test; |
284 friend class HostContentSettingsMapTest_MigrateKeygenSettings_Test; | 285 friend class HostContentSettingsMapTest_MigrateKeygenSettings_Test; |
285 | 286 |
286 friend class content_settings::TestUtils; | 287 friend class content_settings::TestUtils; |
287 | 288 |
288 typedef std::map<ProviderType, content_settings::ProviderInterface*> | 289 typedef std::map<ProviderType, content_settings::ProviderInterface*> |
289 ProviderMap; | 290 ProviderMap; |
290 typedef ProviderMap::iterator ProviderIterator; | 291 typedef ProviderMap::iterator ProviderIterator; |
291 typedef ProviderMap::const_iterator ConstProviderIterator; | 292 typedef ProviderMap::const_iterator ConstProviderIterator; |
292 | 293 |
(...skipping 18 matching lines...) Expand all Loading... | |
311 // TODO(lshang): Remove this when clients have migrated (~M53). We should | 312 // 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. | 313 // leave in some code to remove old-format settings for a long time. |
313 void MigrateKeygenSettings(); | 314 void MigrateKeygenSettings(); |
314 | 315 |
315 // Migrate old domain scoped ALLOW settings to be origin scoped for | 316 // Migrate old domain scoped ALLOW settings to be origin scoped for |
316 // ContentSettingsTypes which are domain scoped. Only narrow down ALLOW | 317 // ContentSettingsTypes which are domain scoped. Only narrow down ALLOW |
317 // domain settings to origins so that this will not cause privacy/security | 318 // domain settings to origins so that this will not cause privacy/security |
318 // issues. | 319 // issues. |
319 // TODO(lshang): https://crbug.com/621398 Remove this when clients have | 320 // TODO(lshang): https://crbug.com/621398 Remove this when clients have |
320 // migrated (~M56). | 321 // migrated (~M56). |
321 void MigrateDomainScopedSettings(); | 322 void MigrateDomainScopedSettings(bool after_sync); |
raymes
2016/07/21 00:58:54
nit: Please add a comment for |after_sync|
lshang
2016/07/22 01:33:07
Done.
| |
322 | 323 |
323 // Collect UMA data about the number of exceptions. | 324 // Collect UMA data about the number of exceptions. |
324 void RecordNumberOfExceptions(); | 325 void RecordNumberOfExceptions(); |
325 | 326 |
326 // Adds content settings for |content_type| and |resource_identifier|, | 327 // Adds content settings for |content_type| and |resource_identifier|, |
327 // provided by |provider|, into |settings|. If |incognito| is true, adds only | 328 // provided by |provider|, into |settings|. If |incognito| is true, adds only |
328 // the content settings which are applicable to the incognito mode and differ | 329 // 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 | 330 // from the normal mode. Otherwise, adds the content settings for the normal |
330 // mode. | 331 // mode. |
331 void AddSettingsForOneType( | 332 void AddSettingsForOneType( |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
393 content_settings::PrefProvider* pref_provider_ = nullptr; | 394 content_settings::PrefProvider* pref_provider_ = nullptr; |
394 | 395 |
395 base::ThreadChecker thread_checker_; | 396 base::ThreadChecker thread_checker_; |
396 | 397 |
397 base::ObserverList<content_settings::Observer> observers_; | 398 base::ObserverList<content_settings::Observer> observers_; |
398 | 399 |
399 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); | 400 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); |
400 }; | 401 }; |
401 | 402 |
402 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ | 403 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ |
OLD | NEW |