summaryrefslogtreecommitdiffstats
path: root/content/browser/android/ime_utils.h
blob: 87a6e8b6228fd82fcef97708e5d8c381066d78b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_BROWSER_ANDROID_IME_UTILS_H_
#define CONTENT_BROWSER_ANDROID_IME_UTILS_H_

#include <jni.h>

class AndroidKeyEvent;

namespace content {

struct NativeWebKeyboardEvent;

// Returns a java KeyEvent from a NativeWebKeyboardEvent, NULL if it fails.
jobject KeyEventFromNative(const NativeWebKeyboardEvent& event);

// Maps a java KeyEvent into a NativeWebKeyboardEvent.
// |java_key_event| is used to maintain a globalref for KeyEvent.
// |action| will help determine the WebInputEvent type.
// type, |modifiers|, |time_ms|, |key_code|, |unicode_char| is used to create
// WebKeyboardEvent. |key_code| is also needed ad need to treat the enter key
// as a key press of character \r.
NativeWebKeyboardEvent NativeWebKeyboardEventFromKeyEvent(
    JNIEnv* env, jobject java_key_event, int action, int modifiers,
    long time_ms, int key_code, bool is_system_key, int unicode_char);

}  // namespace content

#endif  // CONTENT_BROWSER_ANDROID_IME_UTILS_H_