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

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: extend content api to set source origin Created 6 years, 5 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 16e83d8a457ae3969bb8eed13a164c4879ec6290..6d27cdbbd9219e1fc0cb098b2133d159efaa52e9 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -1423,6 +1423,26 @@ void ContentViewCoreImpl::EvaluateJavaScript(JNIEnv* env,
c_callback);
}
+// TODO(sgurun) add support for posting a frame whose name is known (only
+// main frame is supported at this time, see crbug.com/389721)
+// TODO(sgurun) add support for passing message ports
+void ContentViewCoreImpl::PostMessageToFrame(JNIEnv* env, jobject obj,
+ jstring frame_name, jstring message, jstring source_origin,
+ jstring target_origin) {
+
+ RenderViewHost* host = web_contents_->GetRenderViewHost();
+ ViewMsg_PostMessage_Params params;
+ params.source_origin = ConvertJavaStringToUTF16(env, source_origin);
+ params.target_origin = ConvertJavaStringToUTF16(env, target_origin);
+ params.data = ConvertJavaStringToUTF16(env, message);
+ params.is_data_raw_string = true;
+ // TODO(sgurun) What is the right value here?
+ params.source_routing_id = MSG_ROUTING_NONE;
+ if (host)
mnaganov (inactive) 2014/07/14 15:19:29 nit: bail out early if there is no host?
sgurun-gerrit only 2014/07/16 00:43:28 Done.
+ 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