Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: components/content_settings/core/browser/host_content_settings_map.h

Issue 1865803002: [Policy Experimental] Add policies to allow Cookies and Pop-ups exceptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add another test to exercise main logic; renames from review. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..b1377cffe58b533008dbb7f84c6206bd49f19211 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,23 @@ 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 GetMaybeEnablePrefExceptionsForType(ContentSettingsType content_type)
Bernhard Bauer 2016/04/07 09:11:08 Why GetMaybe...? If this returns a boolean, the "m
huangs 2016/04/07 21:44:07 Changing to "AreUserExceptionsAllowedForType()", f
+ const;
// Returns a single |ContentSetting| which applies to the given URLs. Note
// that certain internal schemes are whitelisted. For |CONTENT_TYPE_COOKIES|,
@@ -350,8 +366,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
@@ -373,6 +387,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_;

Powered by Google App Engine
This is Rietveld 408576698