summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_web_ui.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/extensions/extension_web_ui.h')
-rw-r--r--chrome/browser/extensions/extension_web_ui.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/chrome/browser/extensions/extension_web_ui.h b/chrome/browser/extensions/extension_web_ui.h
index 4aad170..3a3a80b 100644
--- a/chrome/browser/extensions/extension_web_ui.h
+++ b/chrome/browser/extensions/extension_web_ui.h
@@ -10,9 +10,11 @@
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/extension_bookmark_manager_api.h"
+#include "chrome/browser/extensions/extension_function_dispatcher.h"
#include "chrome/browser/favicon/favicon_service.h"
#include "chrome/common/extensions/extension.h"
#include "content/browser/webui/web_ui.h"
+#include "ipc/ipc_channel.h"
class GURL;
class ListValue;
@@ -20,12 +22,15 @@ class PrefService;
class Profile;
class RenderViewHost;
class TabContents;
+struct ExtensionHostMsg_Request_Params;
// This class implements WebUI for extensions and allows extensions to put UI in
// the main tab contents area. For example, each extension can specify an
// "options_page", and that page is displayed in the tab contents area and is
// hosted by this class.
-class ExtensionWebUI : public WebUI {
+class ExtensionWebUI
+ : public WebUI,
+ public ExtensionFunctionDispatcher::Delegate {
public:
static const char kExtensionURLOverrides[];
@@ -33,6 +38,21 @@ class ExtensionWebUI : public WebUI {
virtual ~ExtensionWebUI();
+ ExtensionFunctionDispatcher* extension_function_dispatcher() const {
+ return extension_function_dispatcher_.get();
+ }
+
+ // WebUI
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+ virtual void RenderViewCreated(RenderViewHost* render_view_host);
+ virtual void RenderViewReused(RenderViewHost* render_view_host);
+
+ // ExtensionFunctionDispatcher::Delegate
+ virtual Browser* GetBrowser();
+ virtual gfx::NativeView GetNativeViewOfHost();
+ virtual gfx::NativeWindow GetCustomFrameNativeWindow();
+ virtual TabContents* associated_tab_contents() const;
+
virtual ExtensionBookmarkManagerEventRouter*
extension_bookmark_manager_event_router();
@@ -67,6 +87,15 @@ class ExtensionWebUI : public WebUI {
ListValue* list,
Value* override);
+ // When the RenderViewHost changes (RenderViewCreated and RenderViewReused),
+ // we need to reset the ExtensionFunctionDispatcher so it's talking to the
+ // right one, as well as being linked to the correct URL.
+ void ResetExtensionFunctionDispatcher(RenderViewHost* render_view_host);
+
+ void ResetExtensionBookmarkManagerEventRouter();
+
+ scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_;
+
// TODO(aa): This seems out of place. Why is it not with the event routers for
// the other extension APIs?
scoped_ptr<ExtensionBookmarkManagerEventRouter>