Index: chrome/browser/ui/extensions/shell_window.h |
diff --git a/chrome/browser/ui/extensions/shell_window.h b/chrome/browser/ui/extensions/shell_window.h |
index 2790b74d1d823f51a22b29135e1fec4eacf0a4e2..0c8564252f21874ff4aadfaedfb9a16f61af7c2c 100644 |
--- a/chrome/browser/ui/extensions/shell_window.h |
+++ b/chrome/browser/ui/extensions/shell_window.h |
@@ -7,23 +7,29 @@ |
#pragma once |
#include "base/memory/scoped_ptr.h" |
+#include "chrome/browser/extensions/extension_function_dispatcher.h" |
#include "chrome/browser/sessions/session_id.h" |
-#include "chrome/browser/extensions/extension_host.h" |
#include "chrome/browser/ui/base_window.h" |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
+#include "content/public/browser/web_contents_delegate.h" |
+#include "content/public/browser/web_contents_observer.h" |
+class Browser; |
class Extension; |
-class ExtensionHost; |
class ExtensionWindowController; |
class GURL; |
class Profile; |
namespace content { |
+class SiteInstance; |
class WebContents; |
} |
class ShellWindow : public content::NotificationObserver, |
+ public content::WebContentsDelegate, |
+ public content::WebContentsObserver, |
+ public ExtensionFunctionDispatcher::Delegate, |
public BaseWindow { |
public: |
// TODO(mihaip): Switch from hardcoded defaults to passing in the window |
@@ -31,7 +37,7 @@ class ShellWindow : public content::NotificationObserver, |
static const int kDefaultWidth = 512; |
static const int kDefaultHeight = 384; |
- content::WebContents* web_contents() const { return host_->host_contents(); } |
+ content::WebContents* web_contents() const { return web_contents_.get(); } |
const SessionID& session_id() const { return session_id_; } |
const ExtensionWindowController* extension_window_controller() const { |
return extension_window_controller_.get(); |
@@ -41,24 +47,49 @@ class ShellWindow : public content::NotificationObserver, |
const Extension* extension, |
const GURL& url); |
+ // ExtensionFunctionDispatcher::Delegate |
+ virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE; |
+ |
+ // content::WebContentsObserver |
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
+ |
+ // content::WebContentsDelegate |
+ virtual void CloseContents(content::WebContents* contents) OVERRIDE; |
+ virtual bool ShouldSuppressDialogs() OVERRIDE; |
+ |
// content::NotificationObserver implementation. |
virtual void Observe(int type, |
const content::NotificationSource& source, |
const content::NotificationDetails& details) OVERRIDE; |
protected: |
- explicit ShellWindow(ExtensionHost* host_); |
+ ShellWindow(Profile* profile, |
+ const Extension* extension, |
+ const GURL& url); |
virtual ~ShellWindow(); |
// Instantiates a platform-specific ShellWindow subclass (one implementation |
// per platform). Public users of ShellWindow should use ShellWindow::Create. |
- static ShellWindow* CreateShellWindow(ExtensionHost* host); |
+ static ShellWindow* CreateShellWindow(Profile* profile, |
+ const Extension* extension, |
+ const GURL& url); |
+ // ExtensionFunctionDispatcher::Delegate |
+ virtual Browser* GetBrowser() OVERRIDE; |
+ |
+ // Message handlers. |
+ void OnRequest(const ExtensionHostMsg_Request_Params& params); |
+ |
+ Profile* profile_; // weak pointer - owned by ProfileManager. |
const SessionID session_id_; |
- scoped_ptr<ExtensionHost> host_; |
+ const Extension* extension_; // weak pointer - owned by ExtensionService. |
content::NotificationRegistrar registrar_; |
scoped_ptr<ExtensionWindowController> extension_window_controller_; |
+ scoped_ptr<content::WebContents> web_contents_; |
+ |
+ ExtensionFunctionDispatcher extension_function_dispatcher_; |
+ scoped_refptr<content::SiteInstance> site_instance_; |
private: |
DISALLOW_COPY_AND_ASSIGN(ShellWindow); |
}; |