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

Unified Diff: chrome/browser/extensions/extension_disabled_ui.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: fix 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/extensions/extension_disabled_ui.cc
diff --git a/chrome/browser/extensions/extension_disabled_ui.cc b/chrome/browser/extensions/extension_disabled_ui.cc
index adba0e8afb8f16c80a2e10dd3bbbaa1e774c8e0f..1244ec228d3635dcf225e7cb7829f475cf7f73ab 100644
--- a/chrome/browser/extensions/extension_disabled_ui.cc
+++ b/chrome/browser/extensions/extension_disabled_ui.cc
@@ -136,6 +136,7 @@ void ExtensionDisabledDialogDelegate::InstallUIAbort(bool user_initiated) {
extension_, histogram_name.c_str());
// Do nothing. The extension will remain disabled.
+
Release();
}
@@ -306,6 +307,7 @@ ExtensionDisabledGlobalError::GetBubbleViewMessages() {
messages.push_back(
l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO));
} else {
+ // TODO(treib): Add an extra message for supervised users?
Pam (message me for reviews) 2015/02/23 10:18:50 +1
Marc Treib 2015/02/23 12:07:38 I'd like to do that in a different CL, though.
messages.push_back(l10n_util::GetStringFUTF16(
extension_->is_app() ? IDS_APP_DISABLED_ERROR_LABEL
: IDS_EXTENSION_DISABLED_ERROR_LABEL,
@@ -321,15 +323,26 @@ ExtensionDisabledGlobalError::GetBubbleViewMessages() {
}
base::string16 ExtensionDisabledGlobalError::GetBubbleViewAcceptButtonLabel() {
+ if (service_->profile()->IsSupervised() &&
+ extension_->was_installed_by_custodian()) {
+ // TODO(treib): Probably use a new string here once we get UX design.
+ // For now, just re-use an existing string that says "OK".
+ return l10n_util::GetStringUTF16(IDS_EXTENSION_ALERT_ITEM_OK);
+ }
if (is_remote_install_) {
return l10n_util::GetStringUTF16(
IDS_EXTENSION_PROMPT_REMOTE_INSTALL_BUTTON);
- } else {
- return l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_RE_ENABLE_BUTTON);
}
+ return l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_RE_ENABLE_BUTTON);
}
base::string16 ExtensionDisabledGlobalError::GetBubbleViewCancelButtonLabel() {
+ // For custodian-installed extensions, supervised users only get a single
+ // "acknowledge" button.
+ if (service_->profile()->IsSupervised() &&
+ extension_->was_installed_by_custodian()) {
+ return base::string16();
+ }
return l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNINSTALL);
}
@@ -338,6 +351,12 @@ void ExtensionDisabledGlobalError::OnBubbleViewDidClose(Browser* browser) {
void ExtensionDisabledGlobalError::BubbleViewAcceptButtonPressed(
Browser* browser) {
+ // Supervised users can't re-enable custodian-installed extensions, just
+ // acknowledge that they've been disabled.
+ if (service_->profile()->IsSupervised() &&
+ extension_->was_installed_by_custodian()) {
+ return;
+ }
// Delay extension reenabling so this bubble closes properly.
base::MessageLoop::current()->PostTask(FROM_HERE,
base::Bind(&ExtensionService::GrantPermissionsAndEnableExtension,
@@ -346,6 +365,10 @@ void ExtensionDisabledGlobalError::BubbleViewAcceptButtonPressed(
void ExtensionDisabledGlobalError::BubbleViewCancelButtonPressed(
Browser* browser) {
+ // This button shouldn't exist for custodian-installed extensions in a
+ // supervised profile.
Pam (message me for reviews) 2015/02/23 10:18:50 What other kind of extension in a supervised profi
Marc Treib 2015/02/23 12:07:38 Or if we decide to have an "allow everything, even
+ DCHECK(!service_->profile()->IsSupervised() ||
+ !extension_->was_installed_by_custodian());
uninstall_dialog_.reset(extensions::ExtensionUninstallDialog::Create(
service_->profile(), browser->window()->GetNativeWindow(), this));
// Delay showing the uninstall dialog, so that this function returns

Powered by Google App Engine
This is Rietveld 408576698