summaryrefslogtreecommitdiffstats
path: root/content/browser/webui/web_ui.cc
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-26 23:51:09 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-26 23:51:09 +0000
commit39755c360cd4c5884f590aa0548cdd72d30dbdb0 (patch)
treebf599e2be3b4b226f7be5ca4a3327d22e4561f2b /content/browser/webui/web_ui.cc
parent84ec056834c1625b7b7d316817b018564f76e22a (diff)
downloadchromium_src-39755c360cd4c5884f590aa0548cdd72d30dbdb0.zip
chromium_src-39755c360cd4c5884f590aa0548cdd72d30dbdb0.tar.gz
chromium_src-39755c360cd4c5884f590aa0548cdd72d30dbdb0.tar.bz2
Revert 83100 - Remove weird dependency on extensions from webui.Re-plumb extension request messages in a more sane way.Before, each RVH had ProcessWebUIMessage(), which wasserving as a manual way of plumbing both WebUI andextension messages to the right place, even though onlya few RVHD responded to either message.Instead of this, we now just teach more of the stack howto handle IPC messages in general, and delegate them upthrough the stack, giving each layer a chance to handlethem if it knows how.The result is simpler and smaller:179 insertions(+), 252 deletions(-)BUG=80311Review URL: http://codereview.chromium.org/6901021
TBR=aa@chromium.org Review URL: http://codereview.chromium.org/6905045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83103 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/webui/web_ui.cc')
-rw-r--r--content/browser/webui/web_ui.cc29
1 files changed, 4 insertions, 25 deletions
diff --git a/content/browser/webui/web_ui.cc b/content/browser/webui/web_ui.cc
index 87a14204..636f9e8 100644
--- a/content/browser/webui/web_ui.cc
+++ b/content/browser/webui/web_ui.cc
@@ -12,16 +12,11 @@
#include "base/values.h"
#include "chrome/common/extensions/extension_messages.h"
#include "chrome/common/render_messages.h"
-#include "content/browser/child_process_security_policy.h"
-#include "content/browser/renderer_host/render_process_host.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/tab_contents_view.h"
#include "content/browser/webui/generic_handler.h"
#include "content/common/bindings_policy.h"
-#include "content/common/view_messages.h"
-#include "ipc/ipc_message.h"
-#include "ipc/ipc_message_macros.h"
namespace {
@@ -65,32 +60,16 @@ WebUI::~WebUI() {
const WebUI::TypeID WebUI::kNoWebUI = NULL;
-bool WebUI::OnMessageReceived(const IPC::Message& message) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(WebUI, message)
- IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
-}
-
-void WebUI::OnWebUISend(const GURL& source_url,
- const std::string& message,
- const ListValue& args) {
- if (!ChildProcessSecurityPolicy::GetInstance()->
- HasWebUIBindings(tab_contents_->GetRenderProcessHost()->id())) {
- NOTREACHED() << "Blocked unauthorized use of WebUIBindings.";
- return;
- }
-
+void WebUI::ProcessWebUIMessage(
+ const ExtensionHostMsg_DomMessage_Params& params) {
// Look up the callback for this message.
MessageCallbackMap::const_iterator callback =
- message_callbacks_.find(message);
+ message_callbacks_.find(params.name);
if (callback == message_callbacks_.end())
return;
// Forward this message and content on.
- callback->second->Run(&args);
+ callback->second->Run(&params.arguments);
}
void WebUI::CallJavascriptFunction(const std::string& function_name) {