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

Unified Diff: chrome/browser/extensions/extension_prefs.h

Issue 10382149: Refactor the various ways to control what users can do to extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Addressing comments from partial review Created 8 years, 7 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/extensions/extension_prefs.h
===================================================================
--- chrome/browser/extensions/extension_prefs.h (revision 138227)
+++ chrome/browser/extensions/extension_prefs.h (working copy)
@@ -16,6 +16,7 @@
#include "chrome/browser/extensions/api/content_settings/content_settings_store.h"
#include "chrome/browser/extensions/extension_prefs_scope.h"
#include "chrome/browser/extensions/extension_scoped_prefs.h"
+#include "chrome/browser/extensions/management_policy.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/string_ordinal.h"
@@ -45,6 +46,7 @@
// PrefValueStore::extension_prefs(), which this class populates and
// maintains as the underlying extensions change.
class ExtensionPrefs : public extensions::ContentSettingsStore::Observer,
+ public extensions::ManagementPolicy::Provider,
public ExtensionScopedPrefs {
public:
// Key name for a preference that keeps track of per-extension settings. This
@@ -206,10 +208,22 @@
bool IsAppNotificationDisabled(const std::string& extension_id) const;
void SetAppNotificationDisabled(const std::string& extension_id, bool value);
- // Is the extension with |extension_id| allowed by policy (checking both
- // whitelist and blacklist).
- bool IsExtensionAllowedByPolicy(const std::string& extension_id,
- extensions::Extension::Location location) const;
+ // ManagementPolicy::Provider
Aaron Boodman 2012/05/29 03:03:08 I would really prefer this be a separate helper cl
+ virtual std::string GetPolicyProviderName() const OVERRIDE;
+ // Returns true if the extension is allowed by admin policy white- and
+ // blacklists.
+ virtual bool UserMayLoad(const extensions::Extension* extension,
+ string16* error) const OVERRIDE;
+ // Returns false if the extension is required to remain running, as determined
+ // by Extension::IsRequired(). In practice this enforces the admin policy
+ // forcelist.
+ virtual bool UserMayModifySettings(const extensions::Extension* extension,
+ string16* error) const OVERRIDE;
+ // Returns true if the extension is required to remain running, as determined
+ // by Extension::IsRequired(). In practice this enforces the admin policy
+ // forcelist.
+ virtual bool MustRemainEnabled(const extensions::Extension* extension,
+ string16* error) const OVERRIDE;
// Checks if extensions are blacklisted by default, by policy. When true, this
// means that even extensions without an ID should be blacklisted (e.g.
@@ -508,6 +522,12 @@
const std::string& id,
bool incognito) const;
+ // Internal implementation for certain ManagementPolicy::Delegate methods.
+ // Returns |modifiable_value| if the extension can be modified.
+ bool ManagementPolicyImpl(const extensions::Extension* extension,
+ string16* error,
+ bool modifiable_value) const;
+
// Checks if kPrefBlacklist is set to true in the DictionaryValue.
// Return false if the value is false or kPrefBlacklist does not exist.
// This is used to decide if an extension is blacklisted.

Powered by Google App Engine
This is Rietveld 408576698