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

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

Issue 12221065: Disable normal default extensions in case of managed users (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | « no previous file | chrome/common/chrome_paths.h » ('j') | 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 641996e44ff40784ac93143e12256322593d33d0..a6bb1c6bfcf58f40fa5dc7974776a8716a4f23fb 100644
--- a/chrome/browser/extensions/external_provider_impl.cc
+++ b/chrome/browser/extensions/external_provider_impl.cc
@@ -41,6 +41,11 @@
#include "chrome/browser/extensions/external_registry_loader_win.h"
#endif
+#if defined(ENABLE_MANAGED_USERS)
Bernhard Bauer 2013/02/08 13:38:18 Nit: Could you move this before the OS_* #ifdefs,
Dmitry Polukhin 2013/02/11 07:55:22 Done.
+#include "chrome/browser/managed_mode/managed_user_service.h"
+#include "chrome/browser/managed_mode/managed_user_service_factory.h"
+#endif
+
using content::BrowserThread;
namespace extensions {
@@ -356,7 +361,26 @@ void ExternalProviderImpl::CreateExternalProviders(
Extension::WAS_INSTALLED_BY_DEFAULT;
#endif
- if (!is_chromeos_demo_session) {
+ bool is_managed_profile = false;
+#if defined(ENABLE_MANAGED_USERS)
+ ManagedUserService* managed_user_service =
+ ManagedUserServiceFactory::GetForProfile(profile);
+ is_managed_profile = managed_user_service->ProfileIsManaged();
+
+ if (is_managed_profile) {
+ provider_list->push_back(
+ linked_ptr<ExternalProviderInterface>(
+ new ExternalProviderImpl(
+ service,
+ new ExternalPrefLoader(chrome::DIR_MANAGED_USERS_DEFAULT_APPS,
+ check_admin_permissions_on_mac),
Bernhard Bauer 2013/02/08 13:38:18 Nit: alignment.
Dmitry Polukhin 2013/02/11 07:55:22 Done.
+ Manifest::EXTERNAL_PREF,
+ Manifest::EXTERNAL_PREF_DOWNLOAD,
+ bundled_extension_creation_flags)));
+ }
+#endif
+
+ if (!is_chromeos_demo_session && !is_managed_profile) {
provider_list->push_back(
linked_ptr<ExternalProviderInterface>(
new ExternalProviderImpl(
@@ -369,61 +393,72 @@ void ExternalProviderImpl::CreateExternalProviders(
}
#if defined(OS_CHROMEOS) || defined (OS_MACOSX)
- // Define a per-user source of external extensions.
- // On Chrome OS, this serves as a source for OEM customization.
- provider_list->push_back(
- linked_ptr<ExternalProviderInterface>(
- new ExternalProviderImpl(
- service,
- new ExternalPrefLoader(chrome::DIR_USER_EXTERNAL_EXTENSIONS,
- ExternalPrefLoader::NONE),
- Manifest::EXTERNAL_PREF,
- Manifest::EXTERNAL_PREF_DOWNLOAD,
- Extension::NO_FLAGS)));
+ if (!is_managed_profile) {
+ // Define a per-user source of external extensions.
+ // On Chrome OS, this serves as a source for OEM customization.
+ provider_list->push_back(
+ linked_ptr<ExternalProviderInterface>(
+ new ExternalProviderImpl(
+ service,
+ new ExternalPrefLoader(chrome::DIR_USER_EXTERNAL_EXTENSIONS,
+ ExternalPrefLoader::NONE),
+ Manifest::EXTERNAL_PREF,
+ Manifest::EXTERNAL_PREF_DOWNLOAD,
+ Extension::NO_FLAGS)));
+ }
#endif
+
#if defined(OS_WIN)
- provider_list->push_back(
- linked_ptr<ExternalProviderInterface>(
- new ExternalProviderImpl(
- service,
- new ExternalRegistryLoader,
- Manifest::EXTERNAL_REGISTRY,
- Manifest::INVALID_LOCATION,
- Extension::NO_FLAGS)));
+ if (!is_managed_profile) {
+ provider_list->push_back(
+ linked_ptr<ExternalProviderInterface>(
+ new ExternalProviderImpl(
+ service,
+ new ExternalRegistryLoader,
+ Manifest::EXTERNAL_REGISTRY,
+ Manifest::INVALID_LOCATION,
+ Extension::NO_FLAGS)));
+ }
#endif
#if defined(OS_LINUX)
- provider_list->push_back(
- linked_ptr<ExternalProviderInterface>(
- new ExternalProviderImpl(
- service,
- new ExternalPrefLoader(chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS,
- ExternalPrefLoader::NONE),
- Manifest::EXTERNAL_PREF,
- Manifest::EXTERNAL_PREF_DOWNLOAD,
- bundled_extension_creation_flags)));
+ if (!is_managed_profile) {
+ provider_list->push_back(
+ linked_ptr<ExternalProviderInterface>(
+ new ExternalProviderImpl(
+ service,
+ new ExternalPrefLoader(
+ chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS,
+ ExternalPrefLoader::NONE),
+ Manifest::EXTERNAL_PREF,
+ Manifest::EXTERNAL_PREF_DOWNLOAD,
+ bundled_extension_creation_flags)));
+ }
#endif
#if !defined(OS_CHROMEOS)
- // The default apps are installed as INTERNAL but use the external
- // extension installer codeflow.
- provider_list->push_back(
- linked_ptr<ExternalProviderInterface>(
- new default_apps::Provider(
- profile,
- service,
- new ExternalPrefLoader(chrome::DIR_DEFAULT_APPS,
- ExternalPrefLoader::NONE),
- Manifest::INTERNAL,
- Manifest::INVALID_LOCATION,
- Extension::FROM_WEBSTORE |
- Extension::WAS_INSTALLED_BY_DEFAULT)));
+ if (!is_managed_profile) {
+ // The default apps are installed as INTERNAL but use the external
+ // extension installer codeflow.
+ provider_list->push_back(
+ linked_ptr<ExternalProviderInterface>(
+ new default_apps::Provider(
+ profile,
+ service,
+ new ExternalPrefLoader(chrome::DIR_DEFAULT_APPS,
+ ExternalPrefLoader::NONE),
+ Manifest::INTERNAL,
+ Manifest::INVALID_LOCATION,
+ Extension::FROM_WEBSTORE |
+ Extension::WAS_INSTALLED_BY_DEFAULT)));
+ }
#endif
#if defined(OS_CHROMEOS)
policy::BrowserPolicyConnector* connector =
g_browser_process->browser_policy_connector();
- if (is_chromeos_demo_session && connector->GetAppPackUpdater()) {
+ if (!is_managed_profile &&
+ is_chromeos_demo_session && connector->GetAppPackUpdater()) {
provider_list->push_back(
linked_ptr<ExternalProviderInterface>(
new ExternalProviderImpl(
« no previous file with comments | « no previous file | chrome/common/chrome_paths.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698