[Extensions OOPI] Convert extension functions to use RenderFrameHosts
Make ExtensionHostMsg_Request/Response send to RenderFrameHosts/RenderFrames
so that OOPI work with extension api calls.
Also update ExtensionFunctions to only have RenderFrameHosts set, and remove
the |render_view_host_| parameter, and update ExtensionFunction's
internals to use RenderFrameHost.
Note that this doesn't update all the uses of
ExtensionFunction::render_view_host() (of which there are 100+).
BUG=498017
Review URL: https://codereview.chromium.org/1182493002
Cr-Commit-Position: refs/heads/master@{#334185}
diff --git a/extensions/browser/extension_function_dispatcher.h b/extensions/browser/extension_function_dispatcher.h
index 2764449..53ec8be 100644
--- a/extensions/browser/extension_function_dispatcher.h
+++ b/extensions/browser/extension_function_dispatcher.h
@@ -18,7 +18,6 @@
namespace content {
class BrowserContext;
class RenderFrameHost;
-class RenderViewHost;
class WebContents;
}
@@ -35,11 +34,11 @@
typedef ExtensionFunction* (*ExtensionFunctionFactory)();
// ExtensionFunctionDispatcher receives requests to execute functions from
-// Chrome extensions running in a RenderViewHost and dispatches them to the
+// Chrome extensions running in a RenderFrameHost and dispatches them to the
// appropriate handler. It lives entirely on the UI thread.
//
// ExtensionFunctionDispatcher should be a member of some class that hosts
-// RenderViewHosts and wants them to be able to display extension content.
+// RenderFrameHosts and wants them to be able to display extension content.
// This class should also implement ExtensionFunctionDispatcher::Delegate.
//
// Note that a single ExtensionFunctionDispatcher does *not* correspond to a
@@ -90,7 +89,7 @@
const ExtensionHostMsg_Request_Params& params);
// Public constructor. Callers must ensure that:
- // - This object outlives any RenderViewHost's passed to created
+ // - This object outlives any RenderFrameHost's passed to created
// ExtensionFunctions.
explicit ExtensionFunctionDispatcher(
content::BrowserContext* browser_context);
@@ -99,9 +98,8 @@
// Message handlers.
// The response is sent to the corresponding render view in an
// ExtensionMsg_Response message.
- // TODO (jam): convert all callers to use RenderFrameHost.
void Dispatch(const ExtensionHostMsg_Request_Params& params,
- content::RenderViewHost* render_view_host);
+ content::RenderFrameHost* render_frame_host);
// Called when an ExtensionFunction is done executing, after it has sent
// a response (if any) to the extension.
@@ -120,10 +118,10 @@
void set_delegate(Delegate* delegate) { delegate_ = delegate; }
private:
- // For a given RenderViewHost instance, UIThreadResponseCallbackWrapper
+ // For a given RenderFrameHost instance, UIThreadResponseCallbackWrapper
// creates ExtensionFunction::ResponseCallback instances which send responses
// to the corresponding render view in ExtensionMsg_Response messages.
- // This class tracks the lifespan of the RenderViewHost instance, and will be
+ // This class tracks the lifespan of the RenderFrameHost instance, and will be
// destroyed automatically when it goes away.
class UIThreadResponseCallbackWrapper;
@@ -156,7 +154,6 @@
void DispatchWithCallbackInternal(
const ExtensionHostMsg_Request_Params& params,
- content::RenderViewHost* render_view_host,
content::RenderFrameHost* render_frame_host,
const ExtensionFunction::ResponseCallback& callback);
@@ -164,10 +161,10 @@
Delegate* delegate_;
- // This map doesn't own either the keys or the values. When a RenderViewHost
+ // This map doesn't own either the keys or the values. When a RenderFrameHost
// instance goes away, the corresponding entry in this map (if exists) will be
// removed.
- typedef std::map<content::RenderViewHost*, UIThreadResponseCallbackWrapper*>
+ typedef std::map<content::RenderFrameHost*, UIThreadResponseCallbackWrapper*>
UIThreadResponseCallbackWrapperMap;
UIThreadResponseCallbackWrapperMap ui_thread_response_callback_wrappers_;
};