Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / extensions / extension_action_manager.h
index fc50b08..b78e8a2 100644 (file)
@@ -8,10 +8,9 @@
 #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;
@@ -19,11 +18,12 @@ 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();
@@ -42,14 +42,18 @@ class ExtensionActionManager : public KeyedService,
       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