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/jni_android.h" | 5 #include "base/android/jni_android.h" |
6 #include "base/android/jni_string.h" | 6 #include "base/android/jni_string.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "jni/Bootstrap_jni.h" | 9 #include "jni/Bootstrap_jni.h" |
10 #include "mojo/runner/android/run_android_application_function.h" | 10 #include "mojo/runner/android/run_android_application_function.h" |
11 | 11 |
12 namespace mojo { | 12 namespace mojo { |
13 namespace runner { | 13 namespace runner { |
14 | 14 |
15 void Bootstrap(JNIEnv* env, | 15 void Bootstrap(JNIEnv* env, |
16 jobject, | 16 const JavaParamRef<jobject>&, |
17 jobject j_context, | 17 const JavaParamRef<jobject>& j_context, |
18 jstring j_native_library_path, | 18 const JavaParamRef<jstring>& j_native_library_path, |
19 jint j_handle, | 19 jint j_handle, |
20 jlong j_run_application_ptr, | 20 jlong j_run_application_ptr, |
21 jboolean is_cached_app) { | 21 jboolean is_cached_app) { |
22 base::FilePath app_path( | 22 base::FilePath app_path( |
23 base::android::ConvertJavaStringToUTF8(env, j_native_library_path)); | 23 base::android::ConvertJavaStringToUTF8(env, j_native_library_path)); |
24 RunAndroidApplicationFn run_android_application_fn = | 24 RunAndroidApplicationFn run_android_application_fn = |
25 reinterpret_cast<RunAndroidApplicationFn>(j_run_application_ptr); | 25 reinterpret_cast<RunAndroidApplicationFn>(j_run_application_ptr); |
26 run_android_application_fn(env, j_context, app_path, j_handle, is_cached_app); | 26 run_android_application_fn(env, j_context, app_path, j_handle, is_cached_app); |
27 } | 27 } |
28 | 28 |
29 bool RegisterBootstrapJni(JNIEnv* env) { | 29 bool RegisterBootstrapJni(JNIEnv* env) { |
30 return RegisterNativesImpl(env); | 30 return RegisterNativesImpl(env); |
31 } | 31 } |
32 | 32 |
33 } // namespace runner | 33 } // namespace runner |
34 } // namespace mojo | 34 } // namespace mojo |
35 | 35 |
36 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | 36 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
37 base::android::InitVM(vm); | 37 base::android::InitVM(vm); |
38 JNIEnv* env = base::android::AttachCurrentThread(); | 38 JNIEnv* env = base::android::AttachCurrentThread(); |
39 | 39 |
40 if (!mojo::runner::RegisterBootstrapJni(env)) | 40 if (!mojo::runner::RegisterBootstrapJni(env)) |
41 return -1; | 41 return -1; |
42 | 42 |
43 return JNI_VERSION_1_4; | 43 return JNI_VERSION_1_4; |
44 } | 44 } |
OLD | NEW |