summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-07 22:49:20 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-07 22:49:20 +0000
commitce5064f613ad25ad49d60c998f9861bc07c60cea (patch)
treef8529fb99aff098f4eb50d8c97cb2eedbf31e979
parent77b5d50b63b575049688c9ef1edb4b5141f7235d (diff)
downloadchromium_src-ce5064f613ad25ad49d60c998f9861bc07c60cea.zip
chromium_src-ce5064f613ad25ad49d60c998f9861bc07c60cea.tar.gz
chromium_src-ce5064f613ad25ad49d60c998f9861bc07c60cea.tar.bz2
Move willCheckAndDispatchMessageEvent to RenderFrame.
BUG=361761 TEST=no visible change Review URL: https://codereview.chromium.org/276523002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268981 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/renderer/render_frame_impl.cc50
-rw-r--r--content/renderer/render_frame_impl.h6
-rw-r--r--content/renderer/render_view_impl.cc42
-rw-r--r--content/renderer/render_view_impl.h5
4 files changed, 45 insertions, 58 deletions
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 70c05b1..f19a24a 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -25,6 +25,7 @@
#include "content/child/service_worker/service_worker_network_provider.h"
#include "content/child/service_worker/web_service_worker_provider_impl.h"
#include "content/child/web_socket_stream_handle_impl.h"
+#include "content/child/webmessageportchannel_impl.h"
#include "content/common/clipboard_messages.h"
#include "content/common/frame_messages.h"
#include "content/common/input_messages.h"
@@ -2682,15 +2683,48 @@ blink::WebMIDIClient* RenderFrameImpl::webMIDIClient() {
}
bool RenderFrameImpl::willCheckAndDispatchMessageEvent(
- blink::WebLocalFrame* sourceFrame,
- blink::WebFrame* targetFrame,
- blink::WebSecurityOrigin targetOrigin,
+ blink::WebLocalFrame* source_frame,
+ blink::WebFrame* target_frame,
+ blink::WebSecurityOrigin target_origin,
blink::WebDOMMessageEvent event) {
- DCHECK(!frame_ || frame_ == targetFrame);
- // TODO(nasko): Move implementation here. Needed state:
- // * is_swapped_out_
- return render_view_->willCheckAndDispatchMessageEvent(
- sourceFrame, targetFrame, targetOrigin, event);
+ DCHECK(!frame_ || frame_ == target_frame);
+
+ if (!render_view_->is_swapped_out_)
+ return false;
+
+ ViewMsg_PostMessage_Params params;
+ 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_->routing_id_, params));
+ return true;
}
blink::WebString RenderFrameImpl::userAgentOverride(blink::WebLocalFrame* frame,
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index e0a4914..a13caa6 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -356,9 +356,9 @@ class CONTENT_EXPORT RenderFrameImpl
virtual blink::WebUserMediaClient* userMediaClient();
virtual blink::WebMIDIClient* webMIDIClient();
virtual bool willCheckAndDispatchMessageEvent(
- blink::WebLocalFrame* sourceFrame,
- blink::WebFrame* targetFrame,
- blink::WebSecurityOrigin targetOrigin,
+ blink::WebLocalFrame* source_frame,
+ blink::WebFrame* target_frame,
+ blink::WebSecurityOrigin target_origin,
blink::WebDOMMessageEvent event);
virtual blink::WebString userAgentOverride(blink::WebLocalFrame* frame,
const blink::WebURL& url);
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index ec7e834..3b7c836 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -2346,48 +2346,6 @@ void RenderViewImpl::SendFindReply(int request_id,
final_status_update));
}
-bool RenderViewImpl::willCheckAndDispatchMessageEvent(
- blink::WebLocalFrame* sourceFrame,
- blink::WebFrame* targetFrame,
- blink::WebSecurityOrigin target_origin,
- blink::WebDOMMessageEvent event) {
- if (!is_swapped_out_)
- return false;
-
- ViewMsg_PostMessage_Params params;
- 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 (sourceFrame) {
- RenderViewImpl* source_view = FromWebView(sourceFrame->view());
- if (source_view)
- params.source_routing_id = source_view->routing_id();
- }
-
- Send(new ViewHostMsg_RouteMessageEvent(routing_id_, params));
- return true;
-}
-
blink::WebString RenderViewImpl::acceptLanguages() {
return WebString::fromUTF8(renderer_preferences_.accept_languages);
}
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h
index 4089c45..c174bcf 100644
--- a/content/renderer/render_view_impl.h
+++ b/content/renderer/render_view_impl.h
@@ -660,11 +660,6 @@ class CONTENT_EXPORT RenderViewImpl
void didChangeIcon(blink::WebLocalFrame*, blink::WebIconURL::Type);
void didUpdateCurrentHistoryItem(blink::WebLocalFrame* frame);
void didChangeScrollOffset(blink::WebLocalFrame* frame);
- bool willCheckAndDispatchMessageEvent(
- blink::WebLocalFrame* sourceFrame,
- blink::WebFrame* targetFrame,
- blink::WebSecurityOrigin targetOrigin,
- blink::WebDOMMessageEvent event);
static bool IsReload(const FrameMsg_Navigate_Params& params);