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

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

Issue 536753003: Add recommended extension installation support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ext-3
Patch Set: rebase Created 6 years, 2 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 ec898a88135771bbd1d0284150b77274d1699e21..51f416fea7da88bc67e89d2567474a9f098975cf 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
+++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
@@ -238,8 +238,14 @@ base::DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue(
!management_policy_->UserMayModifySettings(extension, NULL);
extension_data->SetBoolean("managedInstall", managed_install);
- // We should not get into a state where both are true.
- DCHECK(!managed_install || !suspicious_install);
+ bool recommended_install =
+ !managed_install &&
+ management_policy_->MustRemainInstalled(extension, NULL);
+ extension_data->SetBoolean("recommendedInstall", recommended_install);
+
+ // Suspicious install should always be mutually exclusive to managed and/or
+ // recommended install.
+ DCHECK(!(managed_install || recommended_install) || !suspicious_install);
GURL icon =
ExtensionIconSource::GetIconURL(extension,
@@ -313,7 +319,9 @@ base::DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue(
extension_service_->GetBrowserContext()));
base::string16 location_text;
- if (Manifest::IsPolicyLocation(extension->location())) {
+ if (Manifest::IsPolicyLocation(extension->location()) ||
+ (extension->location() == Manifest::EXTERNAL_PREF_DOWNLOAD &&
+ recommended_install)) {
location_text = l10n_util::GetStringUTF16(
IDS_OPTIONS_INSTALL_LOCATION_ENTERPRISE);
} else if (extension->location() == Manifest::INTERNAL &&
@@ -532,6 +540,8 @@ void ExtensionSettingsHandler::GetLocalizedValues(
l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSTORE));
source->AddString("extensionSettingsPolicyControlled",
l10n_util::GetStringUTF16(IDS_EXTENSIONS_POLICY_CONTROLLED));
+ source->AddString("extensionSettingsPolicyRecommeneded",
+ l10n_util::GetStringUTF16(IDS_EXTENSIONS_POLICY_RECOMMENDED));
source->AddString("extensionSettingsDependentExtensions",
l10n_util::GetStringUTF16(IDS_EXTENSIONS_DEPENDENT_EXTENSIONS));
source->AddString("extensionSettingsSupervisedUser",
@@ -1132,7 +1142,8 @@ void ExtensionSettingsHandler::HandleUninstallMessage(
if (!extension)
return;
- if (!management_policy_->UserMayModifySettings(extension, NULL)) {
+ if (!management_policy_->UserMayModifySettings(extension, NULL) ||
+ management_policy_->MustRemainInstalled(extension, NULL)) {
LOG(ERROR) << "An attempt was made to uninstall an extension that is "
<< "non-usermanagable. Extension id : " << extension->id();
return;

Powered by Google App Engine
This is Rietveld 408576698