Commit f2253ace authored by limasdf@gmail.com's avatar limasdf@gmail.com

Remove NOTIFICATION_EXTENSION_UNLOADED from managed_user_service.cc

BUG=354046
R=pam@chromium.org

Review URL: https://codereview.chromium.org/251733007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273179 0039d316-1c4b-4281-b951-d872f2087c98
parent f38b08cd
......@@ -10,7 +10,6 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/managed_mode/custodian_profile_downloader_service.h"
#include "chrome/browser/managed_mode/custodian_profile_downloader_service_factory.h"
......@@ -43,9 +42,8 @@
#include "components/signin/core/browser/signin_manager.h"
#include "components/signin/core/browser/signin_manager_base.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/user_metrics.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension_set.h"
#include "google_apis/gaia/google_service_auth_error.h"
......@@ -127,6 +125,7 @@ void ManagedUserService::URLFilterContext::SetManualURLs(
ManagedUserService::ManagedUserService(Profile* profile)
: profile_(profile),
extension_registry_observer_(this),
waiting_for_sync_initialization_(false),
is_profile_active_(false),
elevated_for_testing_(false),
......@@ -334,31 +333,20 @@ void ManagedUserService::OnStateChanged() {
<< "Credentials rejected";
}
void ManagedUserService::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: {
const extensions::Extension* extension =
content::Details<extensions::Extension>(details).ptr();
if (!extensions::ManagedModeInfo::GetContentPackSiteList(
extension).empty()) {
void ManagedUserService::OnExtensionLoaded(
content::BrowserContext* browser_context,
const extensions::Extension* extension) {
if (!extensions::ManagedModeInfo::GetContentPackSiteList(extension).empty()) {
UpdateSiteLists();
}
break;
}
case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: {
const extensions::UnloadedExtensionInfo* extension_info =
content::Details<extensions::UnloadedExtensionInfo>(details).ptr();
if (!extensions::ManagedModeInfo::GetContentPackSiteList(
extension_info->extension).empty()) {
}
void ManagedUserService::OnExtensionUnloaded(
content::BrowserContext* browser_context,
const extensions::Extension* extension,
extensions::UnloadedExtensionInfo::Reason reason) {
if (!extensions::ManagedModeInfo::GetContentPackSiteList(extension).empty()) {
UpdateSiteLists();
}
break;
}
default:
NOTREACHED();
}
}
void ManagedUserService::SetupSync() {
......@@ -566,11 +554,8 @@ void ManagedUserService::Init() {
if (management_policy)
extension_system->management_policy()->RegisterProvider(this);
registrar_.Add(this,
chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
content::Source<Profile>(profile_));
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
content::Source<Profile>(profile_));
extension_registry_observer_.Add(
extensions::ExtensionRegistry::Get(profile_));
pref_change_registrar_.Init(profile_->GetPrefs());
pref_change_registrar_.Add(
......
......@@ -11,15 +11,15 @@
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
#include "base/prefs/pref_change_registrar.h"
#include "base/scoped_observer.h"
#include "base/strings/string16.h"
#include "chrome/browser/managed_mode/managed_mode_url_filter.h"
#include "chrome/browser/managed_mode/managed_users.h"
#include "chrome/browser/sync/profile_sync_service_observer.h"
#include "chrome/browser/ui/browser_list_observer.h"
#include "components/keyed_service/core/keyed_service.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_registry_observer.h"
#include "extensions/browser/management_policy.h"
class Browser;
......@@ -31,6 +31,10 @@ class ManagedUserSettingsService;
class PermissionRequestCreator;
class Profile;
namespace extensions {
class ExtensionRegistry;
}
namespace user_prefs {
class PrefRegistrySyncable;
}
......@@ -41,7 +45,7 @@ class PrefRegistrySyncable;
class ManagedUserService : public KeyedService,
public extensions::ManagementPolicy::Provider,
public ProfileSyncServiceObserver,
public content::NotificationObserver,
public extensions::ExtensionRegistryObserver,
public chrome::BrowserListObserver {
public:
typedef std::vector<base::string16> CategoryList;
......@@ -145,10 +149,14 @@ class ManagedUserService : public KeyedService,
// ProfileSyncServiceObserver implementation:
virtual void OnStateChanged() OVERRIDE;
// content::NotificationObserver implementation:
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
// extensions::ExtensionRegistryObserver implementation.
virtual void OnExtensionLoaded(
content::BrowserContext* browser_context,
const extensions::Extension* extension) OVERRIDE;
virtual void OnExtensionUnloaded(
content::BrowserContext* browser_context,
const extensions::Extension* extension,
extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE;
// chrome::BrowserListObserver implementation:
virtual void OnBrowserSetLastActive(Browser* browser) OVERRIDE;
......@@ -230,7 +238,10 @@ class ManagedUserService : public KeyedService,
// Owns us via the KeyedService mechanism.
Profile* profile_;
content::NotificationRegistrar registrar_;
ScopedObserver<extensions::ExtensionRegistry,
extensions::ExtensionRegistryObserver>
extension_registry_observer_;
PrefChangeRegistrar pref_change_registrar_;
// True iff we're waiting for the Sync service to be initialized.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment