OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/browser/android/ime_utils.h" | |
6 | |
7 #include <android/input.h> | |
8 | |
9 #include "base/android/jni_android.h" | |
10 #include "content/public/browser/native_web_keyboard_event.h" | |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | |
12 | |
13 namespace content { | |
14 | |
15 jobject KeyEventFromNative(const NativeWebKeyboardEvent& event) { | |
16 return event.os_event; | |
17 } | |
18 | |
19 NativeWebKeyboardEvent NativeWebKeyboardEventFromKeyEvent( | |
20 JNIEnv* env, jobject java_key_event, int action, int modifiers, | |
21 long time_ms, int key_code, bool is_system_key, int unicode_char) { | |
22 WebKit::WebInputEvent::Type type = WebKit::WebInputEvent::Undefined; | |
23 if (action == AKEY_EVENT_ACTION_DOWN) | |
24 type = WebKit::WebInputEvent::RawKeyDown; | |
25 else if (action == AKEY_EVENT_ACTION_UP) | |
26 type = WebKit::WebInputEvent::KeyUp; | |
27 return NativeWebKeyboardEvent(java_key_event, type, modifiers, | |
28 time_ms, key_code, unicode_char, is_system_key); | |
29 } | |
30 | |
31 } // namespace content | |
OLD | NEW |