Index: content/browser/android/content_view_core_impl.cc |
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc |
index 9f74b84ea1e282adc42c8e7e8e172918c4b22d4c..3f9d02f5042197f061e28297d2938a8e3d13ab69 100644 |
--- a/content/browser/android/content_view_core_impl.cc |
+++ b/content/browser/android/content_view_core_impl.cc |
@@ -1445,6 +1445,26 @@ void ContentViewCoreImpl::EvaluateJavaScript(JNIEnv* env, |
c_callback); |
} |
+void ContentViewCoreImpl::PostMessageToMainWindow(JNIEnv* env, jobject obj, |
+ jstring message, jstring target_origin) { |
+ |
+ RenderViewHost* host = web_contents_->GetRenderViewHost(); |
+ ViewMsg_PostMessage_Params params; |
+ // TODO(sgurun) What should be the value of source_origin for webview |
+ // params.source_origin =? "/"; |
+ // TODO(sgurun) see why this seems to not work |
+ //params.target_origin = ConvertJavaStringToUTF16(env, target_origin); |
+ // TODO(sgurun) do not use JSON, pass as base::value |
+ params.data = ConvertJavaStringToUTF16(env, message); |
+ params.is_data_raw_string = true; |
+ params.source_routing_id = GetWebContents()->GetRoutingID(); |
nasko
2014/06/20 16:56:52
The source routing id is the same routing ID as th
sgurun-gerrit only
2014/07/11 00:45:46
Done.
|
+ // TODO(sgurun) do add port ids once we add support for that. |
+ |
+ if (host) |
+ host->Send(new ViewMsg_PostMessageEvent(host->GetRoutingID(), params)); |
+} |
+ |
+ |
bool ContentViewCoreImpl::GetUseDesktopUserAgent( |
JNIEnv* env, jobject obj) { |
NavigationEntry* entry = web_contents_->GetController().GetVisibleEntry(); |