summaryrefslogtreecommitdiffstats
path: root/ui/events/android/key_event_utils.cc
blob: af2f2c5b176a965dca45e2e438b56ac30e02c6c6 (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
32
// Copyright 2016 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.

#include "ui/events/android/key_event_utils.h"

#include "jni/KeyEvent_jni.h"

namespace ui {
namespace events {
namespace android {

bool RegisterKeyEvent(JNIEnv* env) {
  return JNI_KeyEvent::RegisterNativesImpl(env);
}

base::android::ScopedJavaLocalRef<jobject> CreateKeyEvent(JNIEnv* env,
                                                          int action,
                                                          int key_code) {
  return JNI_KeyEvent::Java_KeyEvent_ConstructorAVKE_I_I(env, action, key_code);
}

int GetKeyEventUnicodeChar(JNIEnv* env,
                           const base::android::JavaRef<jobject>& event,
                           int meta_state) {
  return static_cast<int>(JNI_KeyEvent::Java_KeyEvent_getUnicodeCharI_I(
      env, event.obj(), meta_state));
}

}  // namespace android
}  // namespace events
}  // namespace ui