forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkey_event_android.h
36 lines (26 loc) · 1020 Bytes
/
key_event_android.h
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
33
34
35
36
// Copyright 2018 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 UI_EVENTS_ANDROID_KEY_EVENT_ANDROID_H_
#define UI_EVENTS_ANDROID_KEY_EVENT_ANDROID_H_
#include <jni.h>
#include "base/android/scoped_java_ref.h"
#include "base/macros.h"
#include "ui/events/events_export.h"
namespace ui {
// Event class used to carry the info from Java KeyEvent through native.
// This is used mainly as a conveyor of Java event object.
class EVENTS_EXPORT KeyEventAndroid {
public:
KeyEventAndroid(JNIEnv* env, jobject event, int key_code);
~KeyEventAndroid();
base::android::ScopedJavaLocalRef<jobject> GetJavaObject() const;
int key_code() const { return key_code_; }
private:
// The Java reference to the key event.
base::android::ScopedJavaGlobalRef<jobject> event_;
int key_code_;
DISALLOW_COPY_AND_ASSIGN(KeyEventAndroid);
};
} // namespace ui
#endif // UI_EVENTS_ANDROID_KEY_EVENT_ANDROID_H_