Add recommended extension installation support
Extensions on recommended installation list will be automatically installed just like forced installed extensions, but are allowed to be disabled (not allowed to be uninstalled).
This CL adds a new ExternalLoader for recommended extension (use EXTERNAL_PREF_DOWNLOAD as location), another MustRemainInstalled() function to interface of ManagementPolicy, and related WebUI changes.
BUG=177351
Review URL: https://codereview.chromium.org/536753003
Cr-Commit-Position: refs/heads/master@{#299336}
diff --git a/chrome/browser/extensions/extension_management.cc b/chrome/browser/extensions/extension_management.cc
index 33b066b..85c69841 100644
--- a/chrome/browser/extensions/extension_management.cc
+++ b/chrome/browser/extensions/extension_management.cc
@@ -78,16 +78,30 @@
scoped_ptr<base::DictionaryValue> ExtensionManagement::GetForceInstallList()
const {
- scoped_ptr<base::DictionaryValue> forcelist(new base::DictionaryValue());
+ scoped_ptr<base::DictionaryValue> install_list(new base::DictionaryValue());
for (SettingsIdMap::const_iterator it = settings_by_id_.begin();
it != settings_by_id_.end();
++it) {
if (it->second->installation_mode == INSTALLATION_FORCED) {
ExternalPolicyLoader::AddExtension(
- forcelist.get(), it->first, it->second->update_url);
+ install_list.get(), it->first, it->second->update_url);
}
}
- return forcelist.Pass();
+ return install_list.Pass();
+}
+
+scoped_ptr<base::DictionaryValue>
+ExtensionManagement::GetRecommendedInstallList() const {
+ scoped_ptr<base::DictionaryValue> install_list(new base::DictionaryValue());
+ for (SettingsIdMap::const_iterator it = settings_by_id_.begin();
+ it != settings_by_id_.end();
+ ++it) {
+ if (it->second->installation_mode == INSTALLATION_RECOMMENDED) {
+ ExternalPolicyLoader::AddExtension(
+ install_list.get(), it->first, it->second->update_url);
+ }
+ }
+ return install_list.Pass();
}
bool ExtensionManagement::IsInstallationAllowed(const ExtensionId& id) const {