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

Unified Diff: content/browser/android/content_view_core_impl.cc

Issue 332693004: Add a content API for postMessage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: get rid of json. plain string is fine. Created 6 years, 6 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
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();

Powered by Google App Engine
This is Rietveld 408576698