Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / apps / ephemeral_app_launcher.h
index 94d5ef5..a68d611 100644 (file)
@@ -8,10 +8,11 @@
 #include <string>
 
 #include "base/basictypes.h"
+#include "base/scoped_observer.h"
 #include "chrome/browser/extensions/webstore_standalone_installer.h"
 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h"
-#include "content/public/browser/notification_observer.h"
 #include "content/public/browser/web_contents_observer.h"
+#include "extensions/browser/extension_registry_observer.h"
 
 class ExtensionEnableFlow;
 class Profile;
@@ -22,16 +23,16 @@ class WebContents;
 
 namespace extensions {
 class Extension;
+class ExtensionRegistry;
 }
 
 // EphemeralAppLauncher manages the launching of ephemeral apps. It handles
 // display of a prompt, initiates install of the app (if necessary) and finally
 // launches the app.
-class EphemeralAppLauncher
-    : public extensions::WebstoreStandaloneInstaller,
-      public content::WebContentsObserver,
-      public content::NotificationObserver,
-      public ExtensionEnableFlowDelegate {
+class EphemeralAppLauncher : public extensions::WebstoreStandaloneInstaller,
+                             public content::WebContentsObserver,
+                             public extensions::ExtensionRegistryObserver,
+                             public ExtensionEnableFlowDelegate {
  public:
   typedef WebstoreStandaloneInstaller::Callback Callback;
 
@@ -89,19 +90,21 @@ class EphemeralAppLauncher
   virtual void CompleteInstall(const std::string& error) OVERRIDE;
 
   // content::WebContentsObserver implementation.
-  virtual void WebContentsDestroyed(
-      content::WebContents* web_contents) OVERRIDE;
+  virtual void WebContentsDestroyed() OVERRIDE;
 
-  // content::NotificationObserver implementation.
-  virtual void Observe(int type,
-                       const content::NotificationSource& source,
-                       const content::NotificationDetails& details) OVERRIDE;
+  // ExtensionRegistryObserver implementation.
+  virtual void OnExtensionLoaded(
+      content::BrowserContext* browser_context,
+      const extensions::Extension* extension) OVERRIDE;
 
   // ExtensionEnableFlowDelegate implementation.
   virtual void ExtensionEnableFlowFinished() OVERRIDE;
   virtual void ExtensionEnableFlowAborted(bool user_initiated) OVERRIDE;
 
-  content::NotificationRegistrar registrar_;
+  // Listen to extension unloaded notifications.
+  ScopedObserver<extensions::ExtensionRegistry,
+                 extensions::ExtensionRegistryObserver>
+      extension_registry_observer_;
 
   gfx::NativeWindow parent_window_;
   scoped_ptr<content::WebContents> dummy_web_contents_;