OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/android/base_jni_registrar.h" | 5 #include "base/android/base_jni_registrar.h" |
6 #include "base/android/jni_android.h" | 6 #include "base/android/jni_android.h" |
7 #include "base/android/jni_registrar.h" | 7 #include "base/android/jni_registrar.h" |
8 #include "base/android/library_loader/library_loader_hooks.h" | 8 #include "base/android/library_loader/library_loader_hooks.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "services/native_viewport/platform_viewport_android.h" | 10 #include "services/native_viewport/platform_viewport_android.h" |
11 #include "shell/android/android_handler.h" | 11 #include "shell/android/android_handler.h" |
| 12 #include "shell/android/keyboard_impl.h" |
12 #include "shell/android/mojo_main.h" | 13 #include "shell/android/mojo_main.h" |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 base::android::RegistrationMethod kMojoRegisteredMethods[] = { | 17 base::android::RegistrationMethod kMojoRegisteredMethods[] = { |
17 {"AndroidHandler", mojo::RegisterAndroidHandlerJni}, | 18 {"AndroidHandler", mojo::RegisterAndroidHandlerJni}, |
| 19 {"Keyboard", mojo::shell::RegisterKeyboardJni}, |
18 {"MojoMain", mojo::shell::RegisterMojoMain}, | 20 {"MojoMain", mojo::shell::RegisterMojoMain}, |
19 {"PlatformViewportAndroid", | 21 {"PlatformViewportAndroid", |
20 native_viewport::PlatformViewportAndroid::Register}, | 22 native_viewport::PlatformViewportAndroid::Register}, |
21 }; | 23 }; |
22 | 24 |
23 bool RegisterMojoJni(JNIEnv* env) { | 25 bool RegisterMojoJni(JNIEnv* env) { |
24 return RegisterNativeMethods(env, kMojoRegisteredMethods, | 26 return RegisterNativeMethods(env, kMojoRegisteredMethods, |
25 arraysize(kMojoRegisteredMethods)); | 27 arraysize(kMojoRegisteredMethods)); |
26 } | 28 } |
27 | 29 |
28 } // namespace | 30 } // namespace |
29 | 31 |
30 // This is called by the VM when the shared library is first loaded. | 32 // This is called by the VM when the shared library is first loaded. |
31 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | 33 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
32 base::android::InitVM(vm); | 34 base::android::InitVM(vm); |
33 JNIEnv* env = base::android::AttachCurrentThread(); | 35 JNIEnv* env = base::android::AttachCurrentThread(); |
34 | 36 |
35 if (!base::android::RegisterLibraryLoaderEntryHook(env)) | 37 if (!base::android::RegisterLibraryLoaderEntryHook(env)) |
36 return -1; | 38 return -1; |
37 | 39 |
38 if (!base::android::RegisterJni(env)) | 40 if (!base::android::RegisterJni(env)) |
39 return -1; | 41 return -1; |
40 | 42 |
41 if (!RegisterMojoJni(env)) | 43 if (!RegisterMojoJni(env)) |
42 return -1; | 44 return -1; |
43 | 45 |
44 return JNI_VERSION_1_4; | 46 return JNI_VERSION_1_4; |
45 } | 47 } |
OLD | NEW |