| Index: components/content_settings/core/browser/host_content_settings_map.h
|
| diff --git a/components/content_settings/core/browser/host_content_settings_map.h b/components/content_settings/core/browser/host_content_settings_map.h
|
| index 17d9e126481f3c1910ff9b54f18441a9a880663b..c938e1b3136d2395b011480e08ce067d5c7c7b08 100644
|
| --- a/components/content_settings/core/browser/host_content_settings_map.h
|
| +++ b/components/content_settings/core/browser/host_content_settings_map.h
|
| @@ -36,6 +36,7 @@ class Value;
|
|
|
| namespace content_settings {
|
| class ObservableProvider;
|
| +class PolicyProvider;
|
| class ProviderInterface;
|
| class PrefProvider;
|
| class TestUtils;
|
| @@ -58,7 +59,12 @@ class HostContentSettingsMap : public content_settings::Observer,
|
| CUSTOM_EXTENSION_PROVIDER,
|
| PREF_PROVIDER,
|
| DEFAULT_PROVIDER,
|
| - NUM_PROVIDER_TYPES,
|
| + NUM_PROVIDER_TYPES
|
| + };
|
| +
|
| + struct ContentSettingWithProviderType {
|
| + ContentSetting content_setting = CONTENT_SETTING_DEFAULT;
|
| + ProviderType provider_type = NUM_PROVIDER_TYPES;
|
| };
|
|
|
| // This should be called on the UI thread, otherwise |thread_checker_| handles
|
| @@ -75,13 +81,22 @@ class HostContentSettingsMap : public content_settings::Observer,
|
| ProviderType type,
|
| scoped_ptr<content_settings::ObservableProvider> provider);
|
|
|
| - // Returns the default setting for a particular content type. If |provider_id|
|
| - // is not NULL, the id of the provider which provided the default setting is
|
| - // assigned to it.
|
| + // Returns the default setting and the provider type for a given content type.
|
| + //
|
| + // This may be called on any thread.
|
| + ContentSettingWithProviderType
|
| + GetDefaultContentSetting(ContentSettingsType content_type) const;
|
| +
|
| + // Alternative interface that returns the content setting, and writes the
|
| + // provider name to |provider_name| if not null.
|
| //
|
| // This may be called on any thread.
|
| ContentSetting GetDefaultContentSetting(ContentSettingsType content_type,
|
| - std::string* provider_id) const;
|
| + std::string* provider_name) const;
|
| +
|
| + // Returns whether user preference exceptions may be enabled for a given
|
| + // content type.
|
| + bool AreUserExceptionsAllowedForType(ContentSettingsType content_type) const;
|
|
|
| // Returns a single |ContentSetting| which applies to the given URLs. Note
|
| // that certain internal schemes are whitelisted. For |CONTENT_TYPE_COOKIES|,
|
| @@ -291,6 +306,11 @@ class HostContentSettingsMap : public content_settings::Observer,
|
|
|
| ~HostContentSettingsMap() override;
|
|
|
| + // For testing.
|
| + content_settings::PrefProvider* GetPrefProvider() {
|
| + return pref_provider_;
|
| + }
|
| +
|
| ContentSetting GetDefaultContentSettingFromProvider(
|
| ContentSettingsType content_type,
|
| content_settings::ProviderInterface* provider) const;
|
| @@ -351,8 +371,6 @@ class HostContentSettingsMap : public content_settings::Observer,
|
| ContentSettingsPattern* primary_pattern,
|
| ContentSettingsPattern* secondary_pattern);
|
|
|
| - content_settings::PrefProvider* GetPrefProvider();
|
| -
|
| #ifndef NDEBUG
|
| // This starts as the thread ID of the thread that constructs this
|
| // object, and remains until used by a different thread, at which
|
| @@ -374,6 +392,12 @@ class HostContentSettingsMap : public content_settings::Observer,
|
| // before any other uses of it.
|
| ProviderMap content_settings_providers_;
|
|
|
| + // content_settings_providers_[POLICY_PROVIDER] but specialized.
|
| + content_settings::PolicyProvider* policy_provider_ = nullptr;
|
| +
|
| + // content_settings_providers_[PREF_PROVIDER] but specialized.
|
| + content_settings::PrefProvider* pref_provider_ = nullptr;
|
| +
|
| base::ThreadChecker thread_checker_;
|
|
|
| base::ObserverList<content_settings::Observer> observers_;
|
|
|