Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Unified Diff: chrome/browser/ui/extensions/shell_window.h

Issue 10119003: Pull shell window stuff out of ExtensionHost and put in ShellWindow (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Mac shell window Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..bdf87cc70df1ca8b7598223fbb19c864b1ef5786 100644
--- a/chrome/browser/ui/extensions/shell_window.h
+++ b/chrome/browser/ui/extensions/shell_window.h
@@ -7,14 +7,16 @@
#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;
@@ -24,6 +26,9 @@ 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 +36,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 +46,47 @@ class ShellWindow : public content::NotificationObserver,
const Extension* extension,
const GURL& url);
+ // ExtensionFunctionDispatcher::Delegate
Aaron Boodman 2012/04/27 16:20:31 None of these implemented interfaces need to be pu
benwells 2012/05/03 09:22:40 Done. I didn't even realize you could do this ...
+ 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.
Aaron Boodman 2012/04/27 16:20:31 Name this CreateImpl()?
benwells 2012/05/03 09:22:40 Done.
- static ShellWindow* CreateShellWindow(ExtensionHost* host);
+ static ShellWindow* CreateShellWindow(Profile* profile,
Aaron Boodman 2012/04/27 16:20:31 Does all of this really need to be accessible to s
benwells 2012/05/03 09:22:40 Agreed. I moved other stuff in this class to be as
+ 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_;
private:
DISALLOW_COPY_AND_ASSIGN(ShellWindow);
};

Powered by Google App Engine
This is Rietveld 408576698