| Index: content/renderer/render_frame_proxy.cc
|
| diff --git a/content/renderer/render_frame_proxy.cc b/content/renderer/render_frame_proxy.cc
|
| index c358944e6204422f256af02ac713adae5ef25123..11ee8108dae9a7e6489d52d28da7af518d7a7620 100644
|
| --- a/content/renderer/render_frame_proxy.cc
|
| +++ b/content/renderer/render_frame_proxy.cc
|
| @@ -7,12 +7,15 @@
|
| #include <map>
|
|
|
| #include "base/lazy_instance.h"
|
| +#include "content/child/webmessageportchannel_impl.h"
|
| #include "content/common/frame_messages.h"
|
| #include "content/common/swapped_out_messages.h"
|
| +#include "content/common/view_messages.h"
|
| #include "content/renderer/child_frame_compositing_helper.h"
|
| #include "content/renderer/render_frame_impl.h"
|
| #include "content/renderer/render_thread_impl.h"
|
| #include "content/renderer/render_view_impl.h"
|
| +#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
| #include "third_party/WebKit/public/web/WebView.h"
|
|
|
| namespace content {
|
| @@ -242,4 +245,46 @@ void RenderFrameProxy::OnDisownOpener() {
|
| web_frame_->setOpener(NULL);
|
| }
|
|
|
| +void RenderFrameProxy::postMessageEvent(
|
| + blink::WebLocalFrame* source_frame,
|
| + blink::WebRemoteFrame* target_frame,
|
| + blink::WebSecurityOrigin target_origin,
|
| + blink::WebDOMMessageEvent event) {
|
| + DCHECK(!web_frame_ || web_frame_ == target_frame);
|
| +
|
| + ViewMsg_PostMessage_Params params;
|
| + params.is_data_raw_string = false;
|
| + params.data = event.data().toString();
|
| + params.source_origin = event.origin();
|
| + if (!target_origin.isNull())
|
| + params.target_origin = target_origin.toString();
|
| +
|
| + blink::WebMessagePortChannelArray channels = event.releaseChannels();
|
| + if (!channels.isEmpty()) {
|
| + std::vector<int> message_port_ids(channels.size());
|
| + // Extract the port IDs from the channel array.
|
| + for (size_t i = 0; i < channels.size(); ++i) {
|
| + WebMessagePortChannelImpl* webchannel =
|
| + static_cast<WebMessagePortChannelImpl*>(channels[i]);
|
| + message_port_ids[i] = webchannel->message_port_id();
|
| + webchannel->QueueMessages();
|
| + DCHECK_NE(message_port_ids[i], MSG_ROUTING_NONE);
|
| + }
|
| + params.message_port_ids = message_port_ids;
|
| + }
|
| +
|
| + // Include the routing ID for the source frame (if one exists), which the
|
| + // browser process will translate into the routing ID for the equivalent
|
| + // frame in the target process.
|
| + params.source_routing_id = MSG_ROUTING_NONE;
|
| + if (source_frame) {
|
| + RenderViewImpl* source_view =
|
| + RenderViewImpl::FromWebView(source_frame->view());
|
| + if (source_view)
|
| + params.source_routing_id = source_view->routing_id();
|
| + }
|
| +
|
| + Send(new ViewHostMsg_RouteMessageEvent(render_view_->GetRoutingID(), params));
|
| +}
|
| +
|
| } // namespace
|
|
|