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

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, more fix 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
« no previous file with comments | « chrome/browser/resources/extensions/extension_list.js ('k') | extensions/browser/management_policy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b56fbe0297478c6ec3c5d455c41291947129aeda..7f949360938782f5d185b463791264c76f729f2b 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
+++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
@@ -241,8 +241,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,
@@ -316,7 +322,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 &&
@@ -542,6 +550,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",
@@ -1146,7 +1156,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;
« no previous file with comments | « chrome/browser/resources/extensions/extension_list.js ('k') | extensions/browser/management_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698