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

Unified Diff: chrome/browser/extensions/external_provider_impl.cc

Issue 1144033003: Don't install OEM default apps for enterprise users (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/extensions/external_provider_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/external_provider_impl.cc
diff --git a/chrome/browser/extensions/external_provider_impl.cc b/chrome/browser/extensions/external_provider_impl.cc
index 12ab37ed85d7438b951be9c2668a21c4055e5555..cd7f17ddc8ee54bd7e6ca8bb35f6912d0d20ad4c 100644
--- a/chrome/browser/extensions/external_provider_impl.cc
+++ b/chrome/browser/extensions/external_provider_impl.cc
@@ -43,6 +43,8 @@
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/chromeos/policy/device_local_account.h"
#include "chrome/browser/chromeos/policy/device_local_account_policy_service.h"
+#include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
+#include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "components/user_manager/user.h"
#else
@@ -229,19 +231,18 @@ void ExternalProviderImpl::SetPrefs(base::DictionaryValue* prefs) {
continue;
}
}
- bool was_installed_by_oem = false;
- if (extension->GetBoolean(kWasInstalledByOem, &was_installed_by_oem) &&
- was_installed_by_oem) {
- creation_flags |= Extension::WAS_INSTALLED_BY_OEM;
- }
+ if (!HandleInstalledByOem(extension, extension_id, &unsupported_extensions,
+ &creation_flags))
+ continue;
+
bool may_be_untrusted = false;
if (extension->GetBoolean(kMayBeUntrusted, &may_be_untrusted) &&
may_be_untrusted) {
creation_flags |= Extension::MAY_BE_UNTRUSTED;
}
- if (!ExternalProviderImpl::HandleMinProfileVersion(extension, extension_id,
- &unsupported_extensions))
+ if (!HandleMinProfileVersion(extension, extension_id,
+ &unsupported_extensions))
continue;
std::string install_parameter;
@@ -393,6 +394,29 @@ bool ExternalProviderImpl::HandleMinProfileVersion(
return true;
}
+bool ExternalProviderImpl::HandleInstalledByOem(
+ const base::DictionaryValue* extension,
+ const std::string& extension_id,
+ std::set<std::string>* unsupported_extensions,
+ int* creation_flags) {
+ bool was_installed_by_oem = false;
+ if (extension->GetBoolean(kWasInstalledByOem, &was_installed_by_oem) &&
+ was_installed_by_oem) {
+#if defined(OS_CHROMEOS)
+ policy::UserCloudPolicyManagerChromeOS* policy_manager =
+ policy::UserCloudPolicyManagerFactoryChromeOS::GetForProfile(profile_);
+ if (policy_manager && policy_manager->core()->store()->is_managed()) {
+ unsupported_extensions->insert(extension_id);
+ VLOG(1) << "Skip installing (or uninstall) external extension "
+ << extension_id << " installed by OEM for managed user";
+ return false;
+ }
+#endif
+ *creation_flags |= Extension::WAS_INSTALLED_BY_OEM;
+ }
+ return true;
+}
+
// static
void ExternalProviderImpl::CreateExternalProviders(
VisitorInterface* service,
« no previous file with comments | « chrome/browser/extensions/external_provider_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698