OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/renderer_host/ime_adapter_android.h" | 5 #include "content/browser/renderer_host/ime_adapter_android.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <android/input.h> | 8 #include <android/input.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
12 #include "base/android/jni_array.h" | 12 #include "base/android/jni_array.h" |
13 #include "base/android/jni_string.h" | 13 #include "base/android/jni_string.h" |
14 #include "base/android/scoped_java_ref.h" | 14 #include "base/android/scoped_java_ref.h" |
15 #include "base/feature_list.h" | |
16 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
17 #include "base/time/time.h" | 16 #include "base/time/time.h" |
18 #include "content/browser/frame_host/frame_tree.h" | 17 #include "content/browser/frame_host/frame_tree.h" |
19 #include "content/browser/frame_host/frame_tree_node.h" | 18 #include "content/browser/frame_host/frame_tree_node.h" |
20 #include "content/browser/frame_host/render_frame_host_impl.h" | 19 #include "content/browser/frame_host/render_frame_host_impl.h" |
21 #include "content/browser/renderer_host/render_view_host_delegate.h" | 20 #include "content/browser/renderer_host/render_view_host_delegate.h" |
22 #include "content/browser/renderer_host/render_view_host_impl.h" | 21 #include "content/browser/renderer_host/render_view_host_impl.h" |
23 #include "content/browser/renderer_host/render_widget_host_impl.h" | 22 #include "content/browser/renderer_host/render_widget_host_impl.h" |
24 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 23 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
25 #include "content/common/input_messages.h" | 24 #include "content/common/input_messages.h" |
26 #include "content/common/view_messages.h" | 25 #include "content/common/view_messages.h" |
27 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
28 #include "content/public/browser/native_web_keyboard_event.h" | 27 #include "content/public/browser/native_web_keyboard_event.h" |
29 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
30 #include "content/public/common/content_features.h" | |
31 #include "jni/ImeAdapter_jni.h" | 29 #include "jni/ImeAdapter_jni.h" |
32 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 30 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
33 #include "third_party/WebKit/public/platform/WebTextInputType.h" | 31 #include "third_party/WebKit/public/platform/WebTextInputType.h" |
34 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 32 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
35 | 33 |
36 using base::android::AttachCurrentThread; | 34 using base::android::AttachCurrentThread; |
37 using base::android::ConvertJavaStringToUTF16; | 35 using base::android::ConvertJavaStringToUTF16; |
38 using base::android::JavaParamRef; | 36 using base::android::JavaParamRef; |
39 | 37 |
40 namespace content { | 38 namespace content { |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 const base::android::JavaParamRef<jobject>& obj, | 301 const base::android::JavaParamRef<jobject>& obj, |
304 bool immediate_request, | 302 bool immediate_request, |
305 bool monitor_request) { | 303 bool monitor_request) { |
306 RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl(); | 304 RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl(); |
307 if (!rwhi) | 305 if (!rwhi) |
308 return; | 306 return; |
309 rwhi->Send(new InputMsg_RequestCompositionUpdate( | 307 rwhi->Send(new InputMsg_RequestCompositionUpdate( |
310 rwhi->GetRoutingID(), immediate_request, monitor_request)); | 308 rwhi->GetRoutingID(), immediate_request, monitor_request)); |
311 } | 309 } |
312 | 310 |
313 bool ImeAdapterAndroid::IsImeThreadEnabled( | |
314 JNIEnv* env, | |
315 const base::android::JavaParamRef<jobject>&) { | |
316 return base::FeatureList::IsEnabled(features::kImeThread); | |
317 } | |
318 | |
319 void ImeAdapterAndroid::ResetImeAdapter(JNIEnv* env, | 311 void ImeAdapterAndroid::ResetImeAdapter(JNIEnv* env, |
320 const JavaParamRef<jobject>&) { | 312 const JavaParamRef<jobject>&) { |
321 java_ime_adapter_.reset(); | 313 java_ime_adapter_.reset(); |
322 } | 314 } |
323 | 315 |
324 RenderWidgetHostImpl* ImeAdapterAndroid::GetRenderWidgetHostImpl() { | 316 RenderWidgetHostImpl* ImeAdapterAndroid::GetRenderWidgetHostImpl() { |
325 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 317 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
326 DCHECK(rwhva_); | 318 DCHECK(rwhva_); |
327 RenderWidgetHost* rwh = rwhva_->GetRenderWidgetHost(); | 319 RenderWidgetHost* rwh = rwhva_->GetRenderWidgetHost(); |
328 if (!rwh) | 320 if (!rwh) |
(...skipping 18 matching lines...) Expand all Loading... |
347 } | 339 } |
348 | 340 |
349 WebContents* ImeAdapterAndroid::GetWebContents() { | 341 WebContents* ImeAdapterAndroid::GetWebContents() { |
350 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); | 342 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); |
351 if (!rwh) | 343 if (!rwh) |
352 return nullptr; | 344 return nullptr; |
353 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); | 345 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); |
354 } | 346 } |
355 | 347 |
356 } // namespace content | 348 } // namespace content |
OLD | NEW |