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 |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "content/common/frame_messages.h" | 23 #include "content/common/frame_messages.h" |
24 #include "content/common/input_messages.h" | 24 #include "content/common/input_messages.h" |
25 #include "content/common/view_messages.h" | 25 #include "content/common/view_messages.h" |
26 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
27 #include "content/public/browser/native_web_keyboard_event.h" | 27 #include "content/public/browser/native_web_keyboard_event.h" |
28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
29 #include "jni/ImeAdapter_jni.h" | 29 #include "jni/ImeAdapter_jni.h" |
30 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 30 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
31 #include "third_party/WebKit/public/web/WebInputEvent.h" | 31 #include "third_party/WebKit/public/web/WebInputEvent.h" |
32 #include "third_party/WebKit/public/web/WebTextInputType.h" | 32 #include "third_party/WebKit/public/web/WebTextInputType.h" |
| 33 #include "ui/base/ime/text_input_mode.h" |
33 | 34 |
34 using base::android::AttachCurrentThread; | 35 using base::android::AttachCurrentThread; |
35 using base::android::ConvertJavaStringToUTF16; | 36 using base::android::ConvertJavaStringToUTF16; |
36 | 37 |
37 namespace content { | 38 namespace content { |
38 namespace { | 39 namespace { |
39 | 40 |
40 // Maps a java KeyEvent into a NativeWebKeyboardEvent. | 41 // Maps a java KeyEvent into a NativeWebKeyboardEvent. |
41 // |java_key_event| is used to maintain a globalref for KeyEvent. | 42 // |java_key_event| is used to maintain a globalref for KeyEvent. |
42 // |action| will help determine the WebInputEvent type. | 43 // |action| will help determine the WebInputEvent type. |
(...skipping 28 matching lines...) Expand all Loading... |
71 | 72 |
72 Java_ImeAdapter_initializeWebInputEvents(env, | 73 Java_ImeAdapter_initializeWebInputEvents(env, |
73 blink::WebInputEvent::RawKeyDown, | 74 blink::WebInputEvent::RawKeyDown, |
74 blink::WebInputEvent::KeyUp, | 75 blink::WebInputEvent::KeyUp, |
75 blink::WebInputEvent::Char, | 76 blink::WebInputEvent::Char, |
76 blink::WebInputEvent::ShiftKey, | 77 blink::WebInputEvent::ShiftKey, |
77 blink::WebInputEvent::AltKey, | 78 blink::WebInputEvent::AltKey, |
78 blink::WebInputEvent::ControlKey, | 79 blink::WebInputEvent::ControlKey, |
79 blink::WebInputEvent::CapsLockOn, | 80 blink::WebInputEvent::CapsLockOn, |
80 blink::WebInputEvent::NumLockOn); | 81 blink::WebInputEvent::NumLockOn); |
| 82 Java_ImeAdapter_initializeTextInputModes( |
| 83 env, |
| 84 ui::TEXT_INPUT_MODE_VERBATIM, |
| 85 ui::TEXT_INPUT_MODE_LATIN_NAME, |
| 86 ui::TEXT_INPUT_MODE_LATIN_PROSE); |
81 Java_ImeAdapter_initializeTextInputFlags( | 87 Java_ImeAdapter_initializeTextInputFlags( |
82 env, | 88 env, |
83 blink::WebTextInputFlagAutocompleteOn, | 89 blink::WebTextInputFlagAutocompleteOn, |
84 blink::WebTextInputFlagAutocompleteOff, | 90 blink::WebTextInputFlagAutocompleteOff, |
85 blink::WebTextInputFlagAutocorrectOn, | 91 blink::WebTextInputFlagAutocorrectOn, |
86 blink::WebTextInputFlagAutocorrectOff, | 92 blink::WebTextInputFlagAutocorrectOff, |
87 blink::WebTextInputFlagSpellcheckOn, | 93 blink::WebTextInputFlagSpellcheckOn, |
88 blink::WebTextInputFlagSpellcheckOff); | 94 blink::WebTextInputFlagSpellcheckOff); |
89 return true; | 95 return true; |
90 } | 96 } |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 WebContents* ImeAdapterAndroid::GetWebContents() { | 357 WebContents* ImeAdapterAndroid::GetWebContents() { |
352 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); | 358 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); |
353 if (!rwh) | 359 if (!rwh) |
354 return NULL; | 360 return NULL; |
355 if (!rwh->IsRenderView()) | 361 if (!rwh->IsRenderView()) |
356 return NULL; | 362 return NULL; |
357 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); | 363 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); |
358 } | 364 } |
359 | 365 |
360 } // namespace content | 366 } // namespace content |
OLD | NEW |