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 @@ ...@@ -10,7 +10,6 @@
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_service.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.h"
#include "chrome/browser/managed_mode/custodian_profile_downloader_service_factory.h" #include "chrome/browser/managed_mode/custodian_profile_downloader_service_factory.h"
...@@ -43,9 +42,8 @@ ...@@ -43,9 +42,8 @@
#include "components/signin/core/browser/signin_manager.h" #include "components/signin/core/browser/signin_manager.h"
#include "components/signin/core/browser/signin_manager_base.h" #include "components/signin/core/browser/signin_manager_base.h"
#include "content/public/browser/browser_thread.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 "content/public/browser/user_metrics.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h" #include "extensions/browser/extension_system.h"
#include "extensions/common/extension_set.h" #include "extensions/common/extension_set.h"
#include "google_apis/gaia/google_service_auth_error.h" #include "google_apis/gaia/google_service_auth_error.h"
...@@ -127,6 +125,7 @@ void ManagedUserService::URLFilterContext::SetManualURLs( ...@@ -127,6 +125,7 @@ void ManagedUserService::URLFilterContext::SetManualURLs(
ManagedUserService::ManagedUserService(Profile* profile) ManagedUserService::ManagedUserService(Profile* profile)
: profile_(profile), : profile_(profile),
extension_registry_observer_(this),
waiting_for_sync_initialization_(false), waiting_for_sync_initialization_(false),
is_profile_active_(false), is_profile_active_(false),
elevated_for_testing_(false), elevated_for_testing_(false),
...@@ -334,30 +333,19 @@ void ManagedUserService::OnStateChanged() { ...@@ -334,30 +333,19 @@ void ManagedUserService::OnStateChanged() {
<< "Credentials rejected"; << "Credentials rejected";
} }
void ManagedUserService::Observe(int type, void ManagedUserService::OnExtensionLoaded(
const content::NotificationSource& source, content::BrowserContext* browser_context,
const content::NotificationDetails& details) { const extensions::Extension* extension) {
switch (type) { if (!extensions::ManagedModeInfo::GetContentPackSiteList(extension).empty()) {
case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { UpdateSiteLists();
const extensions::Extension* extension = }
content::Details<extensions::Extension>(details).ptr(); }
if (!extensions::ManagedModeInfo::GetContentPackSiteList( void ManagedUserService::OnExtensionUnloaded(
extension).empty()) { content::BrowserContext* browser_context,
UpdateSiteLists(); const extensions::Extension* extension,
} extensions::UnloadedExtensionInfo::Reason reason) {
break; if (!extensions::ManagedModeInfo::GetContentPackSiteList(extension).empty()) {
} UpdateSiteLists();
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()) {
UpdateSiteLists();
}
break;
}
default:
NOTREACHED();
} }
} }
...@@ -566,11 +554,8 @@ void ManagedUserService::Init() { ...@@ -566,11 +554,8 @@ void ManagedUserService::Init() {
if (management_policy) if (management_policy)
extension_system->management_policy()->RegisterProvider(this); extension_system->management_policy()->RegisterProvider(this);
registrar_.Add(this, extension_registry_observer_.Add(
chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, extensions::ExtensionRegistry::Get(profile_));
content::Source<Profile>(profile_));
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
content::Source<Profile>(profile_));
pref_change_registrar_.Init(profile_->GetPrefs()); pref_change_registrar_.Init(profile_->GetPrefs());
pref_change_registrar_.Add( pref_change_registrar_.Add(
......
...@@ -11,15 +11,15 @@ ...@@ -11,15 +11,15 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/prefs/pref_change_registrar.h" #include "base/prefs/pref_change_registrar.h"
#include "base/scoped_observer.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "chrome/browser/managed_mode/managed_mode_url_filter.h" #include "chrome/browser/managed_mode/managed_mode_url_filter.h"
#include "chrome/browser/managed_mode/managed_users.h" #include "chrome/browser/managed_mode/managed_users.h"
#include "chrome/browser/sync/profile_sync_service_observer.h" #include "chrome/browser/sync/profile_sync_service_observer.h"
#include "chrome/browser/ui/browser_list_observer.h" #include "chrome/browser/ui/browser_list_observer.h"
#include "components/keyed_service/core/keyed_service.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 "content/public/browser/web_contents.h"
#include "extensions/browser/extension_registry_observer.h"
#include "extensions/browser/management_policy.h" #include "extensions/browser/management_policy.h"
class Browser; class Browser;
...@@ -31,6 +31,10 @@ class ManagedUserSettingsService; ...@@ -31,6 +31,10 @@ class ManagedUserSettingsService;
class PermissionRequestCreator; class PermissionRequestCreator;
class Profile; class Profile;
namespace extensions {
class ExtensionRegistry;
}
namespace user_prefs { namespace user_prefs {
class PrefRegistrySyncable; class PrefRegistrySyncable;
} }
...@@ -41,7 +45,7 @@ class PrefRegistrySyncable; ...@@ -41,7 +45,7 @@ class PrefRegistrySyncable;
class ManagedUserService : public KeyedService, class ManagedUserService : public KeyedService,
public extensions::ManagementPolicy::Provider, public extensions::ManagementPolicy::Provider,
public ProfileSyncServiceObserver, public ProfileSyncServiceObserver,
public content::NotificationObserver, public extensions::ExtensionRegistryObserver,
public chrome::BrowserListObserver { public chrome::BrowserListObserver {
public: public:
typedef std::vector<base::string16> CategoryList; typedef std::vector<base::string16> CategoryList;
...@@ -145,10 +149,14 @@ class ManagedUserService : public KeyedService, ...@@ -145,10 +149,14 @@ class ManagedUserService : public KeyedService,
// ProfileSyncServiceObserver implementation: // ProfileSyncServiceObserver implementation:
virtual void OnStateChanged() OVERRIDE; virtual void OnStateChanged() OVERRIDE;
// content::NotificationObserver implementation: // extensions::ExtensionRegistryObserver implementation.
virtual void Observe(int type, virtual void OnExtensionLoaded(
const content::NotificationSource& source, content::BrowserContext* browser_context,
const content::NotificationDetails& details) OVERRIDE; const extensions::Extension* extension) OVERRIDE;
virtual void OnExtensionUnloaded(
content::BrowserContext* browser_context,
const extensions::Extension* extension,
extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE;
// chrome::BrowserListObserver implementation: // chrome::BrowserListObserver implementation:
virtual void OnBrowserSetLastActive(Browser* browser) OVERRIDE; virtual void OnBrowserSetLastActive(Browser* browser) OVERRIDE;
...@@ -230,7 +238,10 @@ class ManagedUserService : public KeyedService, ...@@ -230,7 +238,10 @@ class ManagedUserService : public KeyedService,
// Owns us via the KeyedService mechanism. // Owns us via the KeyedService mechanism.
Profile* profile_; Profile* profile_;
content::NotificationRegistrar registrar_; ScopedObserver<extensions::ExtensionRegistry,
extensions::ExtensionRegistryObserver>
extension_registry_observer_;
PrefChangeRegistrar pref_change_registrar_; PrefChangeRegistrar pref_change_registrar_;
// True iff we're waiting for the Sync service to be initialized. // 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