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_onload.h" | 5 #include "base/android/base_jni_onload.h" |
6 #include "base/android/base_jni_registrar.h" | 6 #include "base/android/base_jni_registrar.h" |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_registrar.h" | 8 #include "base/android/jni_registrar.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "mojo/android/system/core_impl.h" |
10 #include "services/native_viewport/platform_viewport_android.h" | 11 #include "services/native_viewport/platform_viewport_android.h" |
11 #include "shell/android/android_handler.h" | 12 #include "shell/android/android_handler.h" |
12 #include "shell/android/intent_receiver_manager_impl.h" | 13 #include "shell/android/intent_receiver_manager_impl.h" |
13 #include "shell/android/keyboard_impl.h" | 14 #include "shell/android/keyboard_impl.h" |
14 #include "shell/android/main.h" | 15 #include "shell/android/main.h" |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 base::android::RegistrationMethod kMojoRegisteredMethods[] = { | 19 base::android::RegistrationMethod kMojoRegisteredMethods[] = { |
19 {"AndroidHandler", shell::RegisterAndroidHandlerJni}, | 20 {"AndroidHandler", shell::RegisterAndroidHandlerJni}, |
20 {"IntentReceiverRegistry", shell::RegisterIntentReceiverRegistry}, | 21 {"IntentReceiverRegistry", shell::RegisterIntentReceiverRegistry}, |
21 {"Keyboard", shell::RegisterKeyboardJni}, | 22 {"Keyboard", shell::RegisterKeyboardJni}, |
22 {"PlatformViewportAndroid", | 23 {"PlatformViewportAndroid", |
23 native_viewport::PlatformViewportAndroid::Register}, | 24 native_viewport::PlatformViewportAndroid::Register}, |
24 {"ShellMain", shell::RegisterShellMain}, | 25 {"ShellMain", shell::RegisterShellMain}, |
25 }; | 26 }; |
26 | 27 |
27 bool RegisterJNI(JNIEnv* env) { | 28 bool RegisterJNI(JNIEnv* env) { |
28 if (!base::android::RegisterJni(env)) | 29 if (!base::android::RegisterJni(env)) |
29 return false; | 30 return false; |
30 | 31 |
| 32 if (!mojo::android::RegisterCoreImpl(env)) |
| 33 return false; |
| 34 |
31 return RegisterNativeMethods(env, kMojoRegisteredMethods, | 35 return RegisterNativeMethods(env, kMojoRegisteredMethods, |
32 arraysize(kMojoRegisteredMethods)); | 36 arraysize(kMojoRegisteredMethods)); |
33 } | 37 } |
34 | 38 |
35 } // namespace | 39 } // namespace |
36 | 40 |
37 // This is called by the VM when the shared library is first loaded. | 41 // This is called by the VM when the shared library is first loaded. |
38 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | 42 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
39 std::vector<base::android::RegisterCallback> register_callbacks; | 43 std::vector<base::android::RegisterCallback> register_callbacks; |
40 register_callbacks.push_back(base::Bind(&RegisterJNI)); | 44 register_callbacks.push_back(base::Bind(&RegisterJNI)); |
41 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || | 45 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || |
42 !base::android::OnJNIOnLoadInit( | 46 !base::android::OnJNIOnLoadInit( |
43 std::vector<base::android::InitCallback>())) { | 47 std::vector<base::android::InitCallback>())) { |
44 return -1; | 48 return -1; |
45 } | 49 } |
46 | 50 |
47 return JNI_VERSION_1_4; | 51 return JNI_VERSION_1_4; |
48 } | 52 } |
OLD | NEW |