OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/javatests/mojo_test_case.h" | 10 #include "mojo/android/javatests/mojo_test_case.h" |
11 #include "mojo/android/javatests/validation_test_util.h" | 11 #include "mojo/android/javatests/validation_test_util.h" |
12 #include "mojo/android/system/core_impl.h" | 12 #include "mojo/android/system/core_impl.h" |
13 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" | 13 #include "mojo/edk/embedder/embedder.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 base::android::RegistrationMethod kMojoRegisteredMethods[] = { | 17 base::android::RegistrationMethod kMojoRegisteredMethods[] = { |
18 { "CoreImpl", mojo::android::RegisterCoreImpl }, | 18 { "CoreImpl", mojo::android::RegisterCoreImpl }, |
19 { "MojoTestCase", mojo::android::RegisterMojoTestCase }, | 19 { "MojoTestCase", mojo::android::RegisterMojoTestCase }, |
20 { "ValidationTestUtil", mojo::android::RegisterValidationTestUtil }, | 20 { "ValidationTestUtil", mojo::android::RegisterValidationTestUtil }, |
21 }; | 21 }; |
22 | 22 |
23 bool RegisterJNI(JNIEnv* env) { | 23 bool RegisterJNI(JNIEnv* env) { |
24 return base::android::RegisterJni(env) && | 24 return base::android::RegisterJni(env) && |
25 RegisterNativeMethods(env, kMojoRegisteredMethods, | 25 RegisterNativeMethods(env, kMojoRegisteredMethods, |
26 arraysize(kMojoRegisteredMethods)); | 26 arraysize(kMojoRegisteredMethods)); |
27 } | 27 } |
28 | 28 |
29 bool Init() { | 29 bool Init() { |
30 mojo::embedder::Init(); | 30 mojo::edk::Init(); |
31 return true; | 31 return true; |
32 } | 32 } |
33 | 33 |
34 } // namespace | 34 } // namespace |
35 | 35 |
36 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | 36 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
37 std::vector<base::android::RegisterCallback> register_callbacks; | 37 std::vector<base::android::RegisterCallback> register_callbacks; |
38 register_callbacks.push_back(base::Bind(&RegisterJNI)); | 38 register_callbacks.push_back(base::Bind(&RegisterJNI)); |
39 std::vector<base::android::InitCallback> init_callbacks; | 39 std::vector<base::android::InitCallback> init_callbacks; |
40 init_callbacks.push_back(base::Bind(&Init)); | 40 init_callbacks.push_back(base::Bind(&Init)); |
41 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || | 41 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || |
42 !base::android::OnJNIOnLoadInit(init_callbacks)) | 42 !base::android::OnJNIOnLoadInit(init_callbacks)) |
43 return -1; | 43 return -1; |
44 | 44 |
45 return JNI_VERSION_1_4; | 45 return JNI_VERSION_1_4; |
46 } | 46 } |
OLD | NEW |