Disable uninstalling and editing permissions for policy controlled extensions.
Continuation of the work on Jochen's CL 4115004.
BUG=63599
TEST=unit_tests: ExtensionServiceTest suite.
Review URL: http://codereview.chromium.org/6680001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79982 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index 861cad6..4d48ccd 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -264,6 +264,14 @@
IsExternalLocation(location);
}
+ // Whether extensions with |location| can be uninstalled or not. Policy
+ // controlled extensions are silently auto-installed and updated, and cannot
+ // be disabled by the user. The same applies for internal components.
+ static inline bool UserMayDisable(Location location) {
+ return location != Extension::EXTERNAL_POLICY_DOWNLOAD &&
+ location != Extension::COMPONENT;
+ }
+
// Whether extensions with |location| should be loaded with strict
// error checking. Strict error checks may flag errors older versions
// of chrome did not detect. To avoid breaking installed extensions,