diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-28 19:56:51 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-28 19:56:51 +0000 |
commit | 703e807a70e50e32b3c4821c84c23bde69f73272 (patch) | |
tree | 615d9f7d150e5ec51821a892eecc8ebdb269b447 /chrome/browser/renderer_host | |
parent | a137bdac37451b1b218cf4c43a798aa3abd4c875 (diff) | |
download | chromium_src-703e807a70e50e32b3c4821c84c23bde69f73272.zip chromium_src-703e807a70e50e32b3c4821c84c23bde69f73272.tar.gz chromium_src-703e807a70e50e32b3c4821c84c23bde69f73272.tar.bz2 |
Add more of the server-side plumbing for extension APIs. Also
added getTabsForWindow() to drive it.
Review URL: http://codereview.chromium.org/42680
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12744 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
4 files changed, 18 insertions, 6 deletions
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index 4d6d917..af974f5 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -346,6 +346,7 @@ bool BrowserRenderProcessHost::Init() { InitVisitedLinks(); InitUserScripts(); + InitExtensions(); if (max_page_id_ != -1) channel_->Send(new ViewMsg_SetNextPageID(max_page_id_ + 1)); @@ -448,6 +449,14 @@ void BrowserRenderProcessHost::InitUserScripts() { SendUserScriptsUpdate(user_script_master->GetSharedMemory()); } +void BrowserRenderProcessHost::InitExtensions() { + // TODO(aa): Should only bother sending these function names if this is an + // extension process. + std::vector<std::string> function_names; + ExtensionFunctionDispatcher::GetAllFunctionNames(&function_names); + Send(new ViewMsg_Extension_SetFunctionNames(function_names)); +} + void BrowserRenderProcessHost::SendUserScriptsUpdate( base::SharedMemory *shared_memory) { base::SharedMemoryHandle handle_for_process; diff --git a/chrome/browser/renderer_host/browser_render_process_host.h b/chrome/browser/renderer_host/browser_render_process_host.h index d6f821e..c6517b8 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.h +++ b/chrome/browser/renderer_host/browser_render_process_host.h @@ -109,6 +109,10 @@ class BrowserRenderProcessHost : public RenderProcessHost, // set of scripts and listen for updates to scripts. void InitUserScripts(); + // Initialize support for extension APIs. Send the list of registered API + // functions to thre renderer process. + void InitExtensions(); + // Sends the renderer process a new set of user scripts. void SendUserScriptsUpdate(base::SharedMemory* shared_memory); diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index 35582d4..8222ec3 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -100,7 +100,7 @@ RenderViewHost::RenderViewHost(SiteInstance* instance, has_unload_listener_(false), is_waiting_for_unload_ack_(false), are_javascript_messages_suppressed_(false), - ALLOW_THIS_IN_INITIALIZER_LIST(extension_api_handler_(this)) { + ALLOW_THIS_IN_INITIALIZER_LIST(extension_function_dispatcher_(this)) { DCHECK(instance_); DCHECK(delegate_); if (modal_dialog_event == NULL) @@ -1354,7 +1354,7 @@ void RenderViewHost::OnExtensionRequest(const std::string& name, int callback_id) { // TODO(aa): Here is where we can check that this renderer was supposed to be // able to call extension APIs. - extension_api_handler_.HandleRequest(name, args, callback_id); + extension_function_dispatcher_.HandleRequest(name, args, callback_id); } void RenderViewHost::SendExtensionResponse(int callback_id, diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h index 3142c6c..718c585 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -9,7 +9,7 @@ #include <vector> #include "base/scoped_ptr.h" -#include "chrome/browser/extensions/extension_api_handler.h" +#include "chrome/browser/extensions/extension_function_dispatcher.h" #include "chrome/browser/renderer_host/render_view_host_delegate.h" #include "chrome/browser/renderer_host/render_widget_host.h" #include "chrome/common/modal_dialog_event.h" @@ -641,9 +641,8 @@ class RenderViewHost : public RenderWidgetHost { bool are_javascript_messages_suppressed_; - // Handler for extension API requests. - // Handles processing IPC messages related to the extension system. - ExtensionAPIHandler extension_api_handler_; + // Handles processing IPC messages request extension functions be executed. + ExtensionFunctionDispatcher extension_function_dispatcher_; DISALLOW_EVIL_CONSTRUCTORS(RenderViewHost); }; |