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

Unified Diff: chrome/browser/content_settings/content_settings_policy_provider.h

Issue 6542048: Add content_settings::PolicyProvider and a set of new policies to managed content settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 10 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: chrome/browser/content_settings/content_settings_policy_provider.h
diff --git a/chrome/browser/content_settings/content_settings_policy_provider.h b/chrome/browser/content_settings/content_settings_policy_provider.h
index 82aaf260fea9d71c81abb4ab2437c4f6aa514dfa..8f5042efb34599e5458a60bcec81902e5eec101a 100644
--- a/chrome/browser/content_settings/content_settings_policy_provider.h
+++ b/chrome/browser/content_settings/content_settings_policy_provider.h
@@ -11,6 +11,7 @@
#include "base/basictypes.h"
#include "base/synchronization/lock.h"
#include "chrome/browser/content_settings/content_settings_provider.h"
+#include "chrome/browser/content_settings/content_settings_base_provider.h"
#include "chrome/browser/prefs/pref_change_registrar.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
@@ -76,6 +77,61 @@ class PolicyDefaultProvider : public DefaultProviderInterface,
DISALLOW_COPY_AND_ASSIGN(PolicyDefaultProvider);
};
+// PolicyProvider that provider managed content-settings.
+class PolicyProvider : public BaseProvider,
+ public NotificationObserver {
+ public:
+ explicit PolicyProvider(Profile* profile);
+ ~PolicyProvider();
+ static void RegisterUserPrefs(PrefService* prefs);
+
+ // BaseProvider Implementation
+ virtual void Init();
+
+ // ProviderInterface Implementation
+ virtual bool ContentSettingsTypeIsManaged(
+ ContentSettingsType content_type);
+
+ virtual void SetContentSetting(
+ const ContentSettingsPattern& requesting_pattern,
+ const ContentSettingsPattern& embedding_pattern,
+ ContentSettingsType content_type,
+ const ResourceIdentifier& resource_identifier,
+ ContentSetting content_setting);
+
+ virtual void ClearAllContentSettingsRules(
+ ContentSettingsType content_type);
+
+ virtual void ResetToDefaults();
+
+ // NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+ private:
+ void ReadManagedContentSettings(bool overwrite);
+
+ void ReadManagedContentSettingsTypes(
+ ContentSettingsType content_type);
+
+ void GetPatternsFromPref(const char* pref_name,
+ ContentSettingsType content_type,
+ ContentSetting setting);
+
+ void NotifyObservers(const ContentSettingsDetails& details);
+
+ void UnregisterObservers();
+
+ Profile* profile_;
+
+ bool content_type_is_managed_[CONTENT_SETTINGS_NUM_TYPES];
+
+ PrefChangeRegistrar pref_change_registrar_;
+ NotificationRegistrar notification_registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(PolicyProvider);
+};
+
} // namespace content_settings
#endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_POLICY_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698