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

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

Issue 944443003: Step two of optionally sending messages to/from message ports as base::Value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-c-message-as-values-take2
Patch Set: use auto where it makes sense Created 5 years, 9 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
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 blink::WebDOMMessageEvent event) { 282 blink::WebDOMMessageEvent event) {
283 DCHECK(!web_frame_ || web_frame_ == target_frame); 283 DCHECK(!web_frame_ || web_frame_ == target_frame);
284 284
285 ViewMsg_PostMessage_Params params; 285 ViewMsg_PostMessage_Params params;
286 params.is_data_raw_string = false; 286 params.is_data_raw_string = false;
287 params.data = event.data().toString(); 287 params.data = event.data().toString();
288 params.source_origin = event.origin(); 288 params.source_origin = event.origin();
289 if (!target_origin.isNull()) 289 if (!target_origin.isNull())
290 params.target_origin = target_origin.toString(); 290 params.target_origin = target_origin.toString();
291 291
292 blink::WebMessagePortChannelArray channels = event.releaseChannels(); 292 params.message_ports =
293 if (!channels.isEmpty()) { 293 WebMessagePortChannelImpl::ExtractMessagePortIDs(event.releaseChannels());
294 std::vector<int> message_port_ids(channels.size());
295 // Extract the port IDs from the channel array.
296 for (size_t i = 0; i < channels.size(); ++i) {
297 WebMessagePortChannelImpl* webchannel =
298 static_cast<WebMessagePortChannelImpl*>(channels[i]);
299 message_port_ids[i] = webchannel->message_port_id();
300 webchannel->QueueMessages();
301 DCHECK_NE(message_port_ids[i], MSG_ROUTING_NONE);
302 }
303 params.message_port_ids = message_port_ids;
304 }
305 294
306 // Include the routing ID for the source frame (if one exists), which the 295 // Include the routing ID for the source frame (if one exists), which the
307 // browser process will translate into the routing ID for the equivalent 296 // browser process will translate into the routing ID for the equivalent
308 // frame in the target process. 297 // frame in the target process.
309 params.source_routing_id = MSG_ROUTING_NONE; 298 params.source_routing_id = MSG_ROUTING_NONE;
310 if (source_frame) { 299 if (source_frame) {
311 RenderViewImpl* source_view = 300 RenderViewImpl* source_view =
312 RenderViewImpl::FromWebView(source_frame->view()); 301 RenderViewImpl::FromWebView(source_frame->view());
313 if (source_view) 302 if (source_view)
314 params.source_routing_id = source_view->routing_id(); 303 params.source_routing_id = source_view->routing_id();
(...skipping 22 matching lines...) Expand all
337 blink::WebUserGestureIndicator::isProcessingUserGesture(); 326 blink::WebUserGestureIndicator::isProcessingUserGesture();
338 blink::WebUserGestureIndicator::consumeUserGesture(); 327 blink::WebUserGestureIndicator::consumeUserGesture();
339 Send(new FrameHostMsg_OpenURL(routing_id_, params)); 328 Send(new FrameHostMsg_OpenURL(routing_id_, params));
340 } 329 }
341 330
342 void RenderFrameProxy::forwardInputEvent(const blink::WebInputEvent* event) { 331 void RenderFrameProxy::forwardInputEvent(const blink::WebInputEvent* event) {
343 Send(new FrameHostMsg_ForwardInputEvent(routing_id_, event)); 332 Send(new FrameHostMsg_ForwardInputEvent(routing_id_, event));
344 } 333 }
345 334
346 } // namespace 335 } // namespace
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698