diff options
author | joshia@google.com <joshia@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-21 20:34:45 +0000 |
---|---|---|
committer | joshia@google.com <joshia@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-21 20:34:45 +0000 |
commit | 18cb257530f2a7b6a5d8ce74d3486c1784fcdbf0 (patch) | |
tree | daa421607577ba79de24e9d9d8c62f60dff60a29 /chrome/browser/render_view_host.cc | |
parent | 8c026e7a5ab2077eb8381e7b79a78020624a5a64 (diff) | |
download | chromium_src-18cb257530f2a7b6a5d8ce74d3486c1784fcdbf0.zip chromium_src-18cb257530f2a7b6a5d8ce74d3486c1784fcdbf0.tar.gz chromium_src-18cb257530f2a7b6a5d8ce74d3486c1784fcdbf0.tar.bz2 |
Code review changes. Incorporated all the suggestions from previous review.
One item not changed yet is to rename 'receiver' in ForwardMessageToExternalHost.
The idea is to invoke receiver("message") at the other end. So for example if the
args to ForwardMessageToExternalHost("hello", "world") then we will invoke a
script hello("world") on the other side.
'receiver' doesn't really describe the first argument here so if there is a
better suggestion, I would be happy to change it :)
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1176 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/render_view_host.cc')
-rw-r--r-- | chrome/browser/render_view_host.cc | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/chrome/browser/render_view_host.cc b/chrome/browser/render_view_host.cc index 0a6912b..4a3339f 100644 --- a/chrome/browser/render_view_host.cc +++ b/chrome/browser/render_view_host.cc @@ -101,6 +101,7 @@ RenderViewHost::RenderViewHost(SiteInstance* instance, : RenderWidgetHost(instance->GetProcess(), routing_id), instance_(instance), enable_dom_ui_bindings_(false), + enable_external_host_bindings_(false), delegate_(delegate), renderer_initialized_(false), waiting_for_drag_context_response_(false), @@ -175,8 +176,8 @@ bool RenderViewHost::CreateRenderView() { // If it's enabled, tell the renderer to set up the Javascript bindings for // sending messages back to the browser. - if (enable_dom_ui_bindings_) - Send(new ViewMsg_AllowDOMUIBindings(routing_id_)); + Send(new ViewMsg_AllowBindings( + routing_id_, enable_dom_ui_bindings_, enable_external_host_bindings_)); // Let our delegate know that we created a RenderView. delegate_->RendererCreated(this); @@ -571,6 +572,10 @@ void RenderViewHost::AllowDOMUIBindings() { RendererSecurityPolicy::GetInstance()->GrantDOMUIBindings(process()->host_id()); } +void RenderViewHost::AllowExternalHostBindings() { + enable_external_host_bindings_ = true; +} + void RenderViewHost::SetDOMUIProperty(const std::string& name, const std::string& value) { DCHECK(enable_dom_ui_bindings_); @@ -665,8 +670,8 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) { OnMsgDomOperationResponse) IPC_MESSAGE_HANDLER(ViewHostMsg_DOMUISend, OnMsgDOMUISend) - IPC_MESSAGE_HANDLER(ViewHostMsg_ExternalHostMessage, - OnMsgExternalHostMessage) + IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardMessageToExternalHost, + OnMsgForwardMessageToExternalHost) #ifdef CHROME_PERSONALIZATION IPC_MESSAGE_HANDLER(ViewHostMsg_PersonalizationEvent, OnPersonalizationEvent) @@ -1015,7 +1020,7 @@ void RenderViewHost::OnMsgDOMUISend( delegate_->ProcessDOMUIMessage(message, content); } -void RenderViewHost::OnMsgExternalHostMessage( +void RenderViewHost::OnMsgForwardMessageToExternalHost( const std::string& receiver, const std::string& message) { delegate_->ProcessExternalHostMessage(receiver, message); @@ -1220,7 +1225,7 @@ void RenderViewHost::OnDebugDisconnect() { } } -void RenderViewHost::PostMessage(const std::string& target, - const std::string& message) { - Send(new ViewMsg_PostMessage(routing_id_, target, message)); +void RenderViewHost::ForwardMessageFromExternalHost( + const std::string& target, const std::string& message) { + Send(new ViewMsg_HandleMessageFromExternalHost(routing_id_, target, message)); } |