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

Side by Side Diff: content/renderer/render_frame_proxy.cc

Issue 1046933005: Refactor postMessage for out-of-process iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Enable SupportCrossProcessPostMessage test on FYI bots Created 5 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_frame_proxy.h" 5 #include "content/renderer/render_frame_proxy.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "content/child/webmessageportchannel_impl.h" 10 #include "content/child/webmessageportchannel_impl.h"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 delete this; 311 delete this;
312 } 312 }
313 313
314 void RenderFrameProxy::postMessageEvent( 314 void RenderFrameProxy::postMessageEvent(
315 blink::WebLocalFrame* source_frame, 315 blink::WebLocalFrame* source_frame,
316 blink::WebRemoteFrame* target_frame, 316 blink::WebRemoteFrame* target_frame,
317 blink::WebSecurityOrigin target_origin, 317 blink::WebSecurityOrigin target_origin,
318 blink::WebDOMMessageEvent event) { 318 blink::WebDOMMessageEvent event) {
319 DCHECK(!web_frame_ || web_frame_ == target_frame); 319 DCHECK(!web_frame_ || web_frame_ == target_frame);
320 320
321 ViewMsg_PostMessage_Params params; 321 FrameMsg_PostMessage_Params params;
322 params.is_data_raw_string = false; 322 params.is_data_raw_string = false;
323 params.data = event.data().toString(); 323 params.data = event.data().toString();
324 params.source_origin = event.origin(); 324 params.source_origin = event.origin();
325 if (!target_origin.isNull()) 325 if (!target_origin.isNull())
326 params.target_origin = target_origin.toString(); 326 params.target_origin = target_origin.toString();
327 327
328 params.message_ports = 328 params.message_ports =
329 WebMessagePortChannelImpl::ExtractMessagePortIDs(event.releaseChannels()); 329 WebMessagePortChannelImpl::ExtractMessagePortIDs(event.releaseChannels());
330 330
331 // Include the routing ID for the source frame (if one exists), which the 331 // Include the routing ID for the source frame (if one exists), which the
332 // browser process will translate into the routing ID for the equivalent 332 // browser process will translate into the routing ID for the equivalent
333 // frame in the target process. 333 // frame in the target process.
334 params.source_routing_id = MSG_ROUTING_NONE; 334 params.source_routing_id = MSG_ROUTING_NONE;
335 if (source_frame) { 335 if (source_frame) {
336 RenderViewImpl* source_view = 336 RenderFrameImpl* source_render_frame =
337 RenderViewImpl::FromWebView(source_frame->view()); 337 RenderFrameImpl::FromWebFrame(source_frame);
338 if (source_view) 338 if (source_render_frame)
339 params.source_routing_id = source_view->routing_id(); 339 params.source_routing_id = source_render_frame->GetRoutingID();
340 } 340 }
341 params.source_view_routing_id = MSG_ROUTING_NONE;
341 342
342 Send(new ViewHostMsg_RouteMessageEvent(render_view_->GetRoutingID(), params)); 343 Send(new FrameHostMsg_RouteMessageEvent(routing_id_, params));
343 } 344 }
344 345
345 void RenderFrameProxy::initializeChildFrame( 346 void RenderFrameProxy::initializeChildFrame(
346 const blink::WebRect& frame_rect, 347 const blink::WebRect& frame_rect,
347 float scale_factor) { 348 float scale_factor) {
348 Send(new FrameHostMsg_InitializeChildFrame( 349 Send(new FrameHostMsg_InitializeChildFrame(
349 routing_id_, frame_rect, scale_factor)); 350 routing_id_, frame_rect, scale_factor));
350 } 351 }
351 352
352 void RenderFrameProxy::navigate(const blink::WebURLRequest& request, 353 void RenderFrameProxy::navigate(const blink::WebURLRequest& request,
353 bool should_replace_current_entry) { 354 bool should_replace_current_entry) {
354 FrameHostMsg_OpenURL_Params params; 355 FrameHostMsg_OpenURL_Params params;
355 params.url = request.url(); 356 params.url = request.url();
356 params.referrer = Referrer( 357 params.referrer = Referrer(
357 GURL(request.httpHeaderField(blink::WebString::fromUTF8("Referer"))), 358 GURL(request.httpHeaderField(blink::WebString::fromUTF8("Referer"))),
358 request.referrerPolicy()); 359 request.referrerPolicy());
359 params.disposition = CURRENT_TAB; 360 params.disposition = CURRENT_TAB;
360 params.should_replace_current_entry = should_replace_current_entry; 361 params.should_replace_current_entry = should_replace_current_entry;
361 params.user_gesture = 362 params.user_gesture =
362 blink::WebUserGestureIndicator::isProcessingUserGesture(); 363 blink::WebUserGestureIndicator::isProcessingUserGesture();
363 blink::WebUserGestureIndicator::consumeUserGesture(); 364 blink::WebUserGestureIndicator::consumeUserGesture();
364 Send(new FrameHostMsg_OpenURL(routing_id_, params)); 365 Send(new FrameHostMsg_OpenURL(routing_id_, params));
365 } 366 }
366 367
367 void RenderFrameProxy::forwardInputEvent(const blink::WebInputEvent* event) { 368 void RenderFrameProxy::forwardInputEvent(const blink::WebInputEvent* event) {
368 Send(new FrameHostMsg_ForwardInputEvent(routing_id_, event)); 369 Send(new FrameHostMsg_ForwardInputEvent(routing_id_, event));
369 } 370 }
370 371
371 } // namespace 372 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698