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

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: Comments Created 8 years, 7 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..b1f1a6bcab87ac8ab84ca35e7ac76790c77893a9 100644
--- a/chrome/browser/ui/extensions/shell_window.h
+++ b/chrome/browser/ui/extensions/shell_window.h
@@ -7,14 +7,15 @@
#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 Extension;
-class ExtensionHost;
class ExtensionWindowController;
class GURL;
class Profile;
@@ -24,42 +25,71 @@ class WebContents;
}
Evan Stade 2012/05/08 00:58:16 please add a file level comment here as I have no
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
- // creation parameters to ShellWindow::Create.
- static const int kDefaultWidth = 512;
- static const int kDefaultHeight = 384;
+ static ShellWindow* Create(Profile* profile,
+ const Extension* extension,
+ const GURL& url);
- content::WebContents* web_contents() const { return host_->host_contents(); }
const SessionID& session_id() const { return session_id_; }
const ExtensionWindowController* extension_window_controller() const {
return extension_window_controller_.get();
}
- static ShellWindow* Create(Profile* profile,
- const Extension* extension,
- const GURL& url);
+ protected:
+ // TODO(mihaip): Switch from hardcoded defaults to passing in the window
+ // creation parameters to ShellWindow::Create.
+ static const int kDefaultWidth = 512;
+ static const int kDefaultHeight = 384;
+
+ ShellWindow(Profile* profile,
+ const Extension* extension,
+ const GURL& url);
+ virtual ~ShellWindow();
+
+ const Extension* extension() const { return extension_; }
+ content::WebContents* web_contents() const { return web_contents_.get(); }
+
+ private:
+ // PlatformAppBrowserTest needs access to web_contents()
+ friend class PlatformAppBrowserTest;
+
+ // Instantiates a platform-specific ShellWindow subclass (one implementation
+ // per platform). Public users of ShellWindow should use ShellWindow::Create.
+ static ShellWindow* CreateImpl(Profile* profile,
+ const Extension* extension,
+ const GURL& url);
+
+ // 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_);
- virtual ~ShellWindow();
+ virtual ExtensionWindowController* GetExtensionWindowController() const
+ OVERRIDE;
- // Instantiates a platform-specific ShellWindow subclass (one implementation
- // per platform). Public users of ShellWindow should use ShellWindow::Create.
- static ShellWindow* CreateShellWindow(ExtensionHost* host);
+ // Message handlers.
+ void OnRequest(const ExtensionHostMsg_Request_Params& params);
+
+ Profile* profile_; // weak pointer - owned by ProfileManager.
+ const Extension* extension_; // weak pointer - owned by ExtensionService.
const SessionID session_id_;
- scoped_ptr<ExtensionHost> host_;
+ scoped_ptr<content::WebContents> web_contents_;
content::NotificationRegistrar registrar_;
scoped_ptr<ExtensionWindowController> extension_window_controller_;
+ ExtensionFunctionDispatcher extension_function_dispatcher_;
- private:
DISALLOW_COPY_AND_ASSIGN(ShellWindow);
};

Powered by Google App Engine
This is Rietveld 408576698