Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(902)

Unified Diff: content/renderer/render_frame_proxy.cc

Issue 545653002: Make RenderFrameProxy a WebRemoteFrameClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address avi's comments Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_frame_proxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « content/renderer/render_frame_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698