Chromium Code Reviews| 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..f8524acc093f37171aaadd474e6d5d628b4679be 100644 |
| --- a/chrome/browser/extensions/extension_disabled_ui.cc |
| +++ b/chrome/browser/extensions/extension_disabled_ui.cc |
| @@ -306,6 +306,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? |
| messages.push_back(l10n_util::GetStringFUTF16( |
| extension_->is_app() ? IDS_APP_DISABLED_ERROR_LABEL |
| : IDS_EXTENSION_DISABLED_ERROR_LABEL, |
| @@ -321,15 +322,26 @@ ExtensionDisabledGlobalError::GetBubbleViewMessages() { |
| } |
| base::string16 ExtensionDisabledGlobalError::GetBubbleViewAcceptButtonLabel() { |
| + if (service_->profile()->IsSupervised() && |
| + extension_->was_installed_by_custodian()) { |
|
benwells
2015/02/24 07:33:47
This logic is repeated a few times. You should put
Marc Treib
2015/02/24 10:33:39
The "well-named" is the hard part ;)
Done (I hope)
|
| + // TODO(treib): Probably use a new string here once we get UX design. |
|
benwells
2015/02/24 07:33:47
These TODOs are a bit concerning. If this doesn't
Marc Treib
2015/02/24 10:33:39
There's currently no way for a user to trigger thi
|
| + // 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 +350,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 +364,10 @@ void ExtensionDisabledGlobalError::BubbleViewAcceptButtonPressed( |
| void ExtensionDisabledGlobalError::BubbleViewCancelButtonPressed( |
| Browser* browser) { |
| + // This button shouldn't exist for custodian-installed extensions in a |
| + // supervised profile. |
| + 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 |