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