Chromium Code Reviews| 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 7a75222a41f073a10c60b6e62f2b4280e7fc4cc1..f385b004b34e669a883e5182c23e571af7d99f83 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,18 @@ 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; |
|
raymes
2016/04/12 04:52:47
I don't think we should have two functions for Get
huangs
2016/04/12 14:19:14
I'm fine with changing all callers (see FIXME(huan
huangs
2016/04/13 17:36:18
Removed from this CL.
|
| + |
| + // 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 a single |ContentSetting| which applies to the given URLs. Note |
| // that certain internal schemes are whitelisted. For |CONTENT_TYPE_COOKIES|, |
| @@ -131,6 +142,10 @@ class HostContentSettingsMap : public content_settings::Observer, |
| void SetDefaultContentSetting(ContentSettingsType content_type, |
| ContentSetting setting); |
| + // Returns whether user preference exceptions may be enabled for a given |
| + // content type. |
| + bool AreUserExceptionsAllowedForType(ContentSettingsType content_type) const; |
| + |
| // Sets the content |setting| for the given patterns, |content_type| and |
| // |resource_identifier|. Setting the value to CONTENT_SETTING_DEFAULT causes |
| // the default setting for that type to be used when loading pages matching |
| @@ -373,6 +388,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_; |