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_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 "mojo/android/javatests/mojo_test_case.h" | 9 #include "mojo/android/javatests/mojo_test_case.h" |
10 #include "mojo/android/javatests/validation_test_util.h" | 10 #include "mojo/android/javatests/validation_test_util.h" |
11 #include "mojo/android/system/core_impl.h" | 11 #include "mojo/android/system/core_impl.h" |
| 12 #include "mojo/embedder/embedder.h" |
| 13 #include "mojo/embedder/simple_platform_support.h" |
12 | 14 |
13 namespace { | 15 namespace { |
14 | 16 |
15 base::android::RegistrationMethod kMojoRegisteredMethods[] = { | 17 base::android::RegistrationMethod kMojoRegisteredMethods[] = { |
16 { "CoreImpl", mojo::android::RegisterCoreImpl }, | 18 { "CoreImpl", mojo::android::RegisterCoreImpl }, |
17 { "MojoTestCase", mojo::android::RegisterMojoTestCase }, | 19 { "MojoTestCase", mojo::android::RegisterMojoTestCase }, |
18 { "ValidationTestUtil", mojo::android::RegisterValidationTestUtil }, | 20 { "ValidationTestUtil", mojo::android::RegisterValidationTestUtil }, |
19 }; | 21 }; |
20 | 22 |
21 bool RegisterMojoJni(JNIEnv* env) { | 23 bool RegisterMojoJni(JNIEnv* env) { |
22 return RegisterNativeMethods(env, kMojoRegisteredMethods, | 24 return RegisterNativeMethods(env, kMojoRegisteredMethods, |
23 arraysize(kMojoRegisteredMethods)); | 25 arraysize(kMojoRegisteredMethods)); |
24 } | 26 } |
25 | 27 |
26 } // namespace | 28 } // namespace |
27 | 29 |
28 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | 30 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
29 base::android::InitVM(vm); | 31 base::android::InitVM(vm); |
30 JNIEnv* env = base::android::AttachCurrentThread(); | 32 JNIEnv* env = base::android::AttachCurrentThread(); |
31 | 33 |
32 if (!base::android::RegisterLibraryLoaderEntryHook(env)) | 34 if (!base::android::RegisterLibraryLoaderEntryHook(env)) |
33 return -1; | 35 return -1; |
34 | 36 |
35 if (!base::android::RegisterJni(env)) | 37 if (!base::android::RegisterJni(env)) |
36 return -1; | 38 return -1; |
37 | 39 |
38 if (!RegisterMojoJni(env)) | 40 if (!RegisterMojoJni(env)) |
39 return -1; | 41 return -1; |
40 | 42 |
| 43 mojo::embedder::Init(scoped_ptr<mojo::embedder::PlatformSupport>( |
| 44 new mojo::embedder::SimplePlatformSupport())); |
| 45 |
41 return JNI_VERSION_1_4; | 46 return JNI_VERSION_1_4; |
42 } | 47 } |
OLD | NEW |