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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 307 |
308 base::WeakPtr<HostContentSettingsMap> GetWeakPtr(); | 308 base::WeakPtr<HostContentSettingsMap> GetWeakPtr(); |
309 | 309 |
310 private: | 310 private: |
311 friend class base::RefCountedThreadSafe<HostContentSettingsMap>; | 311 friend class base::RefCountedThreadSafe<HostContentSettingsMap>; |
312 | 312 |
313 FRIEND_TEST_ALL_PREFIXES(HostContentSettingsMapTest, | 313 FRIEND_TEST_ALL_PREFIXES(HostContentSettingsMapTest, |
314 DomainToOriginMigrationStatus); | 314 DomainToOriginMigrationStatus); |
315 FRIEND_TEST_ALL_PREFIXES(HostContentSettingsMapTest, | 315 FRIEND_TEST_ALL_PREFIXES(HostContentSettingsMapTest, |
316 MigrateDomainScopedSettings); | 316 MigrateDomainScopedSettings); |
317 FRIEND_TEST_ALL_PREFIXES(HostContentSettingsMapTest, MigrateKeygenSettings); | |
318 | 317 |
319 friend class content_settings::TestUtils; | 318 friend class content_settings::TestUtils; |
320 | 319 |
321 ~HostContentSettingsMap() override; | 320 ~HostContentSettingsMap() override; |
322 | 321 |
323 ContentSetting GetDefaultContentSettingFromProvider( | 322 ContentSetting GetDefaultContentSettingFromProvider( |
324 ContentSettingsType content_type, | 323 ContentSettingsType content_type, |
325 content_settings::ProviderInterface* provider) const; | 324 content_settings::ProviderInterface* provider) const; |
326 | 325 |
327 // Retrieves default content setting for |content_type|, and writes the | 326 // Retrieves default content setting for |content_type|, and writes the |
328 // provider's type to |provider_type| (must not be null). | 327 // provider's type to |provider_type| (must not be null). |
329 ContentSetting GetDefaultContentSettingInternal( | 328 ContentSetting GetDefaultContentSettingInternal( |
330 ContentSettingsType content_type, | 329 ContentSettingsType content_type, |
331 ProviderType* provider_type) const; | 330 ProviderType* provider_type) const; |
332 | 331 |
333 // Migrate Keygen settings which only use a primary pattern. Settings which | |
334 // only used a primary pattern were inconsistent in what they did with the | |
335 // secondary pattern. Some stored a ContentSettingsPattern::Wildcard() whereas | |
336 // others stored the same pattern twice. This function migrates all such | |
337 // settings to use ContentSettingsPattern::Wildcard(). This allows us to make | |
338 // the scoping code consistent across different settings. | |
339 // TODO(lshang): Remove this when clients have migrated (~M53). We should | |
340 // leave in some code to remove old-format settings for a long time. | |
341 void MigrateKeygenSettings(); | |
342 | |
343 // Collect UMA data of exceptions. | 332 // Collect UMA data of exceptions. |
344 void RecordExceptionMetrics(); | 333 void RecordExceptionMetrics(); |
345 | 334 |
346 // Adds content settings for |content_type| and |resource_identifier|, | 335 // Adds content settings for |content_type| and |resource_identifier|, |
347 // provided by |provider|, into |settings|. If |incognito| is true, adds only | 336 // provided by |provider|, into |settings|. If |incognito| is true, adds only |
348 // the content settings which are applicable to the incognito mode and differ | 337 // the content settings which are applicable to the incognito mode and differ |
349 // from the normal mode. Otherwise, adds the content settings for the normal | 338 // from the normal mode. Otherwise, adds the content settings for the normal |
350 // mode. | 339 // mode. |
351 void AddSettingsForOneType( | 340 void AddSettingsForOneType( |
352 const content_settings::ProviderInterface* provider, | 341 const content_settings::ProviderInterface* provider, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 base::ThreadChecker thread_checker_; | 410 base::ThreadChecker thread_checker_; |
422 | 411 |
423 base::ObserverList<content_settings::Observer> observers_; | 412 base::ObserverList<content_settings::Observer> observers_; |
424 | 413 |
425 base::WeakPtrFactory<HostContentSettingsMap> weak_ptr_factory_; | 414 base::WeakPtrFactory<HostContentSettingsMap> weak_ptr_factory_; |
426 | 415 |
427 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); | 416 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); |
428 }; | 417 }; |
429 | 418 |
430 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ | 419 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ |
OLD | NEW |