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

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

Issue 500043003: Add PolicyProvider to ExtensionManagement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ext-1
Patch Set: fixes to #3 Created 6 years, 3 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/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 9524b5cf2caf36a32ff52e865df09f711bc329e9..3acec125ef1a24fd22b279a5e0a6b22cb09966c3 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -54,7 +54,6 @@
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/features/feature_channel.h"
#include "chrome/common/extensions/manifest_url_handler.h"
-#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "components/crx_file/id_util.h"
#include "components/signin/core/browser/signin_manager.h"
@@ -69,7 +68,6 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/install_flag.h"
-#include "extensions/browser/pref_names.h"
#include "extensions/browser/runtime_data.h"
#include "extensions/browser/uninstall_reason.h"
#include "extensions/browser/update_observer.h"
@@ -298,15 +296,10 @@ ExtensionService::ExtensionService(Profile* profile,
registrar_.Add(this,
chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED,
content::Source<Profile>(profile_));
- pref_change_registrar_.Init(profile->GetPrefs());
- base::Closure callback =
- base::Bind(&ExtensionService::OnExtensionInstallPrefChanged,
- base::Unretained(this));
- pref_change_registrar_.Add(extensions::pref_names::kInstallAllowList,
- callback);
- pref_change_registrar_.Add(extensions::pref_names::kInstallDenyList,
- callback);
- pref_change_registrar_.Add(extensions::pref_names::kAllowedTypes, callback);
+
+ extensions::ExtensionManagementFactory::GetInstance()
+ ->GetForBrowserContext(profile_)
+ ->AddObserver(this);
// Set up the ExtensionUpdater
if (autoupdate_enabled) {
@@ -377,6 +370,9 @@ ExtensionService::~ExtensionService() {
}
void ExtensionService::Shutdown() {
+ extensions::ExtensionManagementFactory::GetInstance()
+ ->GetForBrowserContext(profile())
+ ->RemoveObserver(this);
system_->management_policy()->UnregisterProvider(
shared_module_policy_provider_.get());
}
@@ -1732,6 +1728,11 @@ void ExtensionService::OnExtensionInstalled(
}
}
+void ExtensionService::OnExtensionManagementSettingsChanged() {
+ error_controller_->ShowErrorIfNeeded();
+ CheckManagementPolicy();
+}
+
void ExtensionService::AddNewOrUpdatedExtension(
const Extension* extension,
Extension::State initial_state,
@@ -2118,11 +2119,6 @@ void ExtensionService::Observe(int type,
}
}
-void ExtensionService::OnExtensionInstallPrefChanged() {
- error_controller_->ShowErrorIfNeeded();
- CheckManagementPolicy();
-}
-
bool ExtensionService::ShouldEnableOnInstall(const Extension* extension) {
// Extensions installed by policy can't be disabled. So even if a previous
// installation disabled the extension, make sure it is now enabled.

Powered by Google App Engine
This is Rietveld 408576698