#include <map>
#include <string>
-#include "base/memory/linked_ptr.h"
+#include "base/scoped_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 "extensions/browser/extension_registry_observer.h"
class ExtensionAction;
class Profile;
namespace extensions {
class Extension;
+class ExtensionRegistry;
// Owns the ExtensionActions associated with each extension. These actions live
// while an extension is loaded and are destroyed on unload.
class ExtensionActionManager : public KeyedService,
- public content::NotificationObserver {
+ public ExtensionRegistryObserver {
public:
explicit ExtensionActionManager(Profile* profile);
virtual ~ExtensionActionManager();
const extensions::Extension& extension) const;
private:
- // Implement content::NotificationObserver.
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
+ // Implement ExtensionRegistryObserver.
+ virtual void OnExtensionUnloaded(content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason)
+ OVERRIDE;
- content::NotificationRegistrar registrar_;
Profile* profile_;
+ // Listen to extension unloaded notifications.
+ ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
+ extension_registry_observer_;
+
// Keyed by Extension ID. These maps are populated lazily when their
// ExtensionAction is first requested, and the entries are removed when the
// extension is unloaded. Not every extension has a page action or browser