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

Unified Diff: components/content_settings/core/browser/content_settings_policy_provider.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/content_settings_policy_provider.h
diff --git a/components/content_settings/core/browser/content_settings_policy_provider.h b/components/content_settings/core/browser/content_settings_policy_provider.h
index f2058456a24949fde95f63ec1d912f6c53506d9e..3e306cd83d73c3493380bfa38bcc910760b942a5 100644
--- a/components/content_settings/core/browser/content_settings_policy_provider.h
+++ b/components/content_settings/core/browser/content_settings_policy_provider.h
@@ -7,6 +7,7 @@
// A content settings provider that takes its settings out of policies.
+#include <map>
#include <vector>
#include "base/macros.h"
@@ -46,14 +47,24 @@ class PolicyProvider : public ObservableProvider {
void ShutdownOnUIThread() override;
+ // Returns the pref exception usage setting for a given content type.
+ ContentSetting AllowUserExceptionsForType(
Bernhard Bauer 2016/04/07 09:11:08 What does the return value here mean?
huangs 2016/04/07 21:44:07 Updated comments and function name.
+ ContentSettingsType content_type) const;
+
private:
struct PrefsForManagedDefaultMapEntry;
+ using UserExceptionsAllowedMap =
+ std::map<ContentSettingsType, ContentSetting>;
+
static const PrefsForManagedDefaultMapEntry kPrefsForManagedDefault[];
// Reads the policy managed default settings.
void ReadManagedDefaultSettings();
+ // Reads the policy managed exceptions settings (but not exception lists).
+ void ReadUserExceptionsAllowed();
+
// Callback for preference changes.
void OnPreferenceChanged(const std::string& pref_name);
@@ -71,6 +82,10 @@ class PolicyProvider : public ObservableProvider {
OriginIdentifierValueMap value_map_;
+ // Preference exceptions can be explictly enabled or disabled by policy for
+ // various content types. Only non-CONTENT_SETTING_DEFAULT values are stored.
+ UserExceptionsAllowedMap user_exceptions_allowed_map_;
+
PrefService* prefs_;
PrefChangeRegistrar pref_change_registrar_;

Powered by Google App Engine
This is Rietveld 408576698