| 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 b53f88c6e6b77162cbbf8c0b31e3a5760de7f35d..a05836df435f1d4b122a2375a9eedcda328c5578 100644
|
| --- a/content/browser/android/content_view_core_impl.cc
|
| +++ b/content/browser/android/content_view_core_impl.cc
|
| @@ -687,6 +687,22 @@ ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() const {
|
| return Java_ContentViewCore_getContext(env, obj);
|
| }
|
|
|
| +gfx::Size ContentViewCoreImpl::GetViewSizeWithOSKHidden() const {
|
| + gfx::Size size_pix;
|
| + JNIEnv* env = AttachCurrentThread();
|
| + ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
|
| + if (j_obj.is_null())
|
| + return size_pix = gfx::Size();
|
| + size_pix = gfx::Size(
|
| + Java_ContentViewCore_getViewportWidthPix(env, j_obj),
|
| + Java_ContentViewCore_getViewportHeightWithOSKHiddenPix(env, j_obj));
|
| +
|
| + gfx::Size size_dip = gfx::ScaleToCeiledSize(size_pix, 1.0f / dpi_scale());
|
| + if (DoBrowserControlsShrinkBlinkSize())
|
| + size_dip.Enlarge(0, -GetTopControlsHeightDip());
|
| + return size_dip;
|
| +}
|
| +
|
| gfx::Size ContentViewCoreImpl::GetViewSize() const {
|
| gfx::Size size = GetViewportSizeDip();
|
| if (DoBrowserControlsShrinkBlinkSize())
|
| @@ -1076,6 +1092,46 @@ void ContentViewCoreImpl::WasResized(JNIEnv* env,
|
| SendScreenRectsAndResizeWidget();
|
| }
|
|
|
| +long ContentViewCoreImpl::GetNativeImeAdapter(
|
| + JNIEnv* env,
|
| + const JavaParamRef<jobject>& obj) {
|
| + RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid();
|
| + if (!rwhva)
|
| + return 0;
|
| + return rwhva->GetNativeImeAdapter();
|
| +}
|
| +
|
| +void ContentViewCoreImpl::ForceUpdateImeAdapter(long native_ime_adapter) {
|
| + JNIEnv* env = AttachCurrentThread();
|
| + ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
|
| + if (obj.is_null())
|
| + return;
|
| + Java_ContentViewCore_forceUpdateImeAdapter(env, obj, native_ime_adapter);
|
| +}
|
| +
|
| +void ContentViewCoreImpl::UpdateImeAdapter(long native_ime_adapter,
|
| + int text_input_type,
|
| + int text_input_flags,
|
| + int text_input_mode,
|
| + const std::string& text,
|
| + int selection_start,
|
| + int selection_end,
|
| + int composition_start,
|
| + int composition_end,
|
| + bool show_ime_if_needed,
|
| + bool reply_to_request) {
|
| + JNIEnv* env = AttachCurrentThread();
|
| + ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
|
| + if (obj.is_null())
|
| + return;
|
| +
|
| + ScopedJavaLocalRef<jstring> jstring_text = ConvertUTF8ToJavaString(env, text);
|
| + Java_ContentViewCore_updateImeAdapter(
|
| + env, obj, native_ime_adapter, text_input_type, text_input_flags,
|
| + text_input_mode, jstring_text, selection_start, selection_end,
|
| + composition_start, composition_end, show_ime_if_needed, reply_to_request);
|
| +}
|
| +
|
| void ContentViewCoreImpl::SetAccessibilityEnabled(
|
| JNIEnv* env,
|
| const JavaParamRef<jobject>& obj,
|
| @@ -1280,7 +1336,7 @@ jlong Init(JNIEnv* env,
|
| const JavaParamRef<jobject>& jweb_contents,
|
| const JavaParamRef<jobject>& jview_android_delegate,
|
| jlong jwindow_android,
|
| - jfloat dip_scale,
|
| + jfloat dipScale,
|
| const JavaParamRef<jobject>& retained_objects_set) {
|
| WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(
|
| WebContents::FromJavaWebContents(jweb_contents));
|
| @@ -1295,8 +1351,9 @@ jlong Init(JNIEnv* env,
|
| DCHECK(window_android);
|
| window_android->AddChild(view_android);
|
|
|
| + // TODO: pass dipScale.
|
| ContentViewCoreImpl* view = new ContentViewCoreImpl(
|
| - env, obj, web_contents, dip_scale, retained_objects_set);
|
| + env, obj, web_contents, dipScale, retained_objects_set);
|
| return reinterpret_cast<intptr_t>(view);
|
| }
|
|
|
|
|