diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-11 04:32:28 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-11 04:32:28 +0000 |
commit | 52836b694190e9deae90e4bfce2cced4545849f4 (patch) | |
tree | 48bbaa88a7533bd0d1c4699c92dec918a545a70b /chrome/browser/extensions/extension_tab_helper.h | |
parent | 8164ae1c8061f04a3da53ee01e7134ab540db66a (diff) | |
download | chromium_src-52836b694190e9deae90e4bfce2cced4545849f4.zip chromium_src-52836b694190e9deae90e4bfce2cced4545849f4.tar.gz chromium_src-52836b694190e9deae90e4bfce2cced4545849f4.tar.bz2 |
Move ExtensionFunctionDispatcher to ExtensionTabHelper. This
sets the stage for us to expose certain extension functions
to content scripts and normal web pages.
This required two major structural changes:
1. Made EFD stateless, except for the pointer to its
delegate. This is important to gracefully handle the case
of a RVH navigating between different extensions or even
to normal web content. Especially in the case of
TabContents, where the entire RVH can be torn down and
replaced during navigation.
2. Centralize all per-(extension, RVH) setup in
ChromeContentBrowserClient::RenderViewCreated(). In
particular, responsibility for enabling extension bindings
was very spread out before, making it hard to follow when
exactly they were enabled.
BUG=80308
Review URL: http://codereview.chromium.org/6927076
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84928 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_tab_helper.h')
-rw-r--r-- | chrome/browser/extensions/extension_tab_helper.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_tab_helper.h b/chrome/browser/extensions/extension_tab_helper.h index 46b0348..8a4b51e 100644 --- a/chrome/browser/extensions/extension_tab_helper.h +++ b/chrome/browser/extensions/extension_tab_helper.h @@ -7,6 +7,7 @@ #pragma once #include "content/browser/tab_contents/tab_contents_observer.h" +#include "chrome/browser/extensions/extension_function_dispatcher.h" #include "chrome/browser/extensions/image_loading_tracker.h" #include "chrome/common/web_apps.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -17,6 +18,7 @@ struct WebApplicationInfo; // Per-tab extension helper. Also handles non-extension apps. class ExtensionTabHelper : public TabContentsObserver, + public ExtensionFunctionDispatcher::Delegate, public ImageLoadingTracker::Observer { public: explicit ExtensionTabHelper(TabContentsWrapper* wrapper); @@ -77,9 +79,16 @@ class ExtensionTabHelper : public TabContentsObserver, const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message); + // ExtensionFunctionDispatcher::Delegate overrides. + virtual Browser* GetBrowser(); + virtual gfx::NativeView GetNativeViewOfHost(); + virtual gfx::NativeWindow GetCustomFrameNativeWindow(); + virtual TabContents* GetAssociatedTabContents() const; + // Message handlers. void OnDidGetApplicationInfo(int32 page_id, const WebApplicationInfo& info); void OnInstallApplication(const WebApplicationInfo& info); + void OnRequest(const ExtensionHostMsg_Request_Params& params); // App extensions related methods: @@ -101,6 +110,9 @@ class ExtensionTabHelper : public TabContentsObserver, // non-extension apps. SkBitmap extension_app_icon_; + // Process any extension messages coming from the tab. + ExtensionFunctionDispatcher extension_function_dispatcher_; + // Used for loading extension_app_icon_. scoped_ptr<ImageLoadingTracker> extension_app_image_loader_; |