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

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 649933006: Move PostMessageToFrame to WebContentsAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address code review Created 6 years, 2 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/browser/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 } 1138 }
1139 } 1139 }
1140 1140
1141 long ContentViewCoreImpl::GetNativeImeAdapter(JNIEnv* env, jobject obj) { 1141 long ContentViewCoreImpl::GetNativeImeAdapter(JNIEnv* env, jobject obj) {
1142 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid(); 1142 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid();
1143 if (!rwhva) 1143 if (!rwhva)
1144 return 0; 1144 return 0;
1145 return rwhva->GetNativeImeAdapter(); 1145 return rwhva->GetNativeImeAdapter();
1146 } 1146 }
1147 1147
1148 // TODO(sgurun) add support for posting a frame whose name is known (only
1149 // main frame is supported at this time, see crbug.com/389721)
1150 // TODO(sgurun) add support for passing message ports
1151 void ContentViewCoreImpl::PostMessageToFrame(JNIEnv* env, jobject obj,
1152 jstring frame_name, jstring message, jstring source_origin,
1153 jstring target_origin) {
1154
1155 RenderViewHost* host = web_contents_->GetRenderViewHost();
1156 if (!host)
1157 return;
1158 ViewMsg_PostMessage_Params params;
1159 params.source_origin = ConvertJavaStringToUTF16(env, source_origin);
1160 params.target_origin = ConvertJavaStringToUTF16(env, target_origin);
1161 params.data = ConvertJavaStringToUTF16(env, message);
1162 params.is_data_raw_string = true;
1163 params.source_routing_id = MSG_ROUTING_NONE;
1164 host->Send(new ViewMsg_PostMessageEvent(host->GetRoutingID(), params));
1165 }
1166
1167 void ContentViewCoreImpl::UpdateImeAdapter(long native_ime_adapter, 1148 void ContentViewCoreImpl::UpdateImeAdapter(long native_ime_adapter,
1168 int text_input_type, 1149 int text_input_type,
1169 int text_input_flags, 1150 int text_input_flags,
1170 const std::string& text, 1151 const std::string& text,
1171 int selection_start, 1152 int selection_start,
1172 int selection_end, 1153 int selection_end,
1173 int composition_start, 1154 int composition_start,
1174 int composition_end, 1155 int composition_end,
1175 bool show_ime_if_needed, 1156 bool show_ime_if_needed,
1176 bool is_non_ime_change) { 1157 bool is_non_ime_change) {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 reinterpret_cast<ui::WindowAndroid*>(window_android), 1299 reinterpret_cast<ui::WindowAndroid*>(window_android),
1319 retained_objects_set); 1300 retained_objects_set);
1320 return reinterpret_cast<intptr_t>(view); 1301 return reinterpret_cast<intptr_t>(view);
1321 } 1302 }
1322 1303
1323 bool RegisterContentViewCore(JNIEnv* env) { 1304 bool RegisterContentViewCore(JNIEnv* env) {
1324 return RegisterNativesImpl(env); 1305 return RegisterNativesImpl(env);
1325 } 1306 }
1326 1307
1327 } // namespace content 1308 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/browser/web_contents/web_contents_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698