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 13 matching lines...) Expand all Loading... | |
24 #include "content/common/frame_messages.h" | 24 #include "content/common/frame_messages.h" |
25 #include "content/common/input_messages.h" | 25 #include "content/common/input_messages.h" |
26 #include "content/common/view_messages.h" | 26 #include "content/common/view_messages.h" |
27 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
28 #include "content/public/browser/native_web_keyboard_event.h" | 28 #include "content/public/browser/native_web_keyboard_event.h" |
29 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
30 #include "jni/ImeAdapter_jni.h" | 30 #include "jni/ImeAdapter_jni.h" |
31 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 31 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
32 #include "third_party/WebKit/public/web/WebInputEvent.h" | 32 #include "third_party/WebKit/public/web/WebInputEvent.h" |
33 #include "third_party/WebKit/public/web/WebTextInputType.h" | 33 #include "third_party/WebKit/public/web/WebTextInputType.h" |
34 #include "ui/base/ime/text_input_mode.h" | |
34 | 35 |
35 using base::android::AttachCurrentThread; | 36 using base::android::AttachCurrentThread; |
36 using base::android::ConvertJavaStringToUTF16; | 37 using base::android::ConvertJavaStringToUTF16; |
37 | 38 |
38 namespace content { | 39 namespace content { |
39 namespace { | 40 namespace { |
40 | 41 |
41 // Maps a java KeyEvent into a NativeWebKeyboardEvent. | 42 // Maps a java KeyEvent into a NativeWebKeyboardEvent. |
42 // |java_key_event| is used to maintain a globalref for KeyEvent. | 43 // |java_key_event| is used to maintain a globalref for KeyEvent. |
43 // |action| will help determine the WebInputEvent type. | 44 // |action| will help determine the WebInputEvent type. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 ui::TEXT_INPUT_TYPE_NONE, | 83 ui::TEXT_INPUT_TYPE_NONE, |
83 ui::TEXT_INPUT_TYPE_TEXT, | 84 ui::TEXT_INPUT_TYPE_TEXT, |
84 ui::TEXT_INPUT_TYPE_TEXT_AREA, | 85 ui::TEXT_INPUT_TYPE_TEXT_AREA, |
85 ui::TEXT_INPUT_TYPE_PASSWORD, | 86 ui::TEXT_INPUT_TYPE_PASSWORD, |
86 ui::TEXT_INPUT_TYPE_SEARCH, | 87 ui::TEXT_INPUT_TYPE_SEARCH, |
87 ui::TEXT_INPUT_TYPE_URL, | 88 ui::TEXT_INPUT_TYPE_URL, |
88 ui::TEXT_INPUT_TYPE_EMAIL, | 89 ui::TEXT_INPUT_TYPE_EMAIL, |
89 ui::TEXT_INPUT_TYPE_TELEPHONE, | 90 ui::TEXT_INPUT_TYPE_TELEPHONE, |
90 ui::TEXT_INPUT_TYPE_NUMBER, | 91 ui::TEXT_INPUT_TYPE_NUMBER, |
91 ui::TEXT_INPUT_TYPE_CONTENT_EDITABLE); | 92 ui::TEXT_INPUT_TYPE_CONTENT_EDITABLE); |
93 Java_ImeAdapter_initializeTextInputModes( | |
aurimas (slooooooooow)
2015/01/06 21:08:09
Could we switch to using java_cpp_enum.gypi to gen
bcwhite
2015/01/07 15:21:31
I didn't even know about that possibility. I'll l
aurimas (slooooooooow)
2015/01/07 16:23:31
Sure, please file a bug to track that then.
| |
94 env, | |
95 ui::TEXT_INPUT_MODE_VERBATIM, | |
96 ui::TEXT_INPUT_MODE_LATIN_NAME, | |
97 ui::TEXT_INPUT_MODE_LATIN_PROSE); | |
92 Java_ImeAdapter_initializeTextInputFlags( | 98 Java_ImeAdapter_initializeTextInputFlags( |
93 env, | 99 env, |
94 blink::WebTextInputFlagAutocompleteOn, | 100 blink::WebTextInputFlagAutocompleteOn, |
95 blink::WebTextInputFlagAutocompleteOff, | 101 blink::WebTextInputFlagAutocompleteOff, |
96 blink::WebTextInputFlagAutocorrectOn, | 102 blink::WebTextInputFlagAutocorrectOn, |
97 blink::WebTextInputFlagAutocorrectOff, | 103 blink::WebTextInputFlagAutocorrectOff, |
98 blink::WebTextInputFlagSpellcheckOn, | 104 blink::WebTextInputFlagSpellcheckOn, |
99 blink::WebTextInputFlagSpellcheckOff); | 105 blink::WebTextInputFlagSpellcheckOff); |
100 return true; | 106 return true; |
101 } | 107 } |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
392 WebContents* ImeAdapterAndroid::GetWebContents() { | 398 WebContents* ImeAdapterAndroid::GetWebContents() { |
393 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); | 399 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); |
394 if (!rwh) | 400 if (!rwh) |
395 return NULL; | 401 return NULL; |
396 if (!rwh->IsRenderView()) | 402 if (!rwh->IsRenderView()) |
397 return NULL; | 403 return NULL; |
398 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); | 404 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); |
399 } | 405 } |
400 | 406 |
401 } // namespace content | 407 } // namespace content |
OLD | NEW |