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

Unified Diff: chrome/browser/ui/webui/extensions/extension_settings_handler.cc

Issue 925563002: Supervised users: Slightly relax restrictions around extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@test_ext_install_disable
Patch Set: benwells review Created 5 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/ui/webui/extensions/extension_settings_handler.cc
diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
index 9537f617691251091338c3900959b8ecf8a041bb..8e3b041ca765df3aedb0401b3fde71d8ed18d532 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
+++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
@@ -272,6 +272,12 @@ base::DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue(
// recommended install.
DCHECK(!(managed_install || recommended_install) || !suspicious_install);
+ // |web_ui()| can be null in unit tests.
+ bool installed_by_custodian =
+ web_ui() && Profile::FromWebUI(web_ui())->IsSupervised() &&
+ extension->was_installed_by_custodian();
+ extension_data->SetBoolean("installedByCustodian", installed_by_custodian);
+
GURL icon =
ExtensionIconSource::GetIconURL(extension,
extension_misc::EXTENSION_ICON_MEDIUM,
@@ -1077,6 +1083,11 @@ void ExtensionSettingsHandler::HandleEnableMessage(
if (!extension)
return;
+ if (Profile::FromWebUI(web_ui())->IsSupervised() &&
+ extension->was_installed_by_custodian()) {
+ return;
+ }
+
if (!management_policy_->UserMayModifySettings(extension, NULL)) {
LOG(ERROR) << "An attempt was made to enable an extension that is "
<< "non-usermanagable. Extension id: " << extension->id();
@@ -1161,6 +1172,11 @@ void ExtensionSettingsHandler::HandleAllowFileAccessMessage(
if (!extension)
return;
+ if (Profile::FromWebUI(web_ui())->IsSupervised() &&
+ extension->was_installed_by_custodian()) {
+ return;
+ }
+
if (!management_policy_->UserMayModifySettings(extension, NULL)) {
LOG(ERROR) << "An attempt was made to change allow file access of an"
<< " extension that is non-usermanagable. Extension id : "

Powered by Google App Engine
This is Rietveld 408576698