| 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 "shell/android/android_handler.h" | 5 #include "shell/android/android_handler.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // This function loads the application library, sets the application context and | 37 // This function loads the application library, sets the application context and |
| 38 // thunks and calls into the application MojoMain. To ensure that the thunks are | 38 // thunks and calls into the application MojoMain. To ensure that the thunks are |
| 39 // set correctly we keep it in the Mojo shell .so and pass the function pointer | 39 // set correctly we keep it in the Mojo shell .so and pass the function pointer |
| 40 // to the helper libbootstrap.so. | 40 // to the helper libbootstrap.so. |
| 41 void RunAndroidApplication(JNIEnv* env, | 41 void RunAndroidApplication(JNIEnv* env, |
| 42 jobject j_context, | 42 jobject j_context, |
| 43 uintptr_t tracing_id, | 43 uintptr_t tracing_id, |
| 44 const base::FilePath& app_path, | 44 const base::FilePath& app_path, |
| 45 jint j_handle) { | 45 jint j_handle) { |
| 46 mojo::InterfaceRequest<mojo::Application> application_request = | 46 mojo::InterfaceRequest<mojo::Application> application_request = |
| 47 mojo::MakeRequest<mojo::Application>( | 47 mojo::InterfaceRequest<mojo::Application>( |
| 48 mojo::MakeScopedHandle(mojo::MessagePipeHandle(j_handle))); | 48 mojo::MakeScopedHandle(mojo::MessagePipeHandle(j_handle))); |
| 49 | 49 |
| 50 // Load the library, so that we can set the application context there if | 50 // Load the library, so that we can set the application context there if |
| 51 // needed. | 51 // needed. |
| 52 // TODO(vtl): We'd use a ScopedNativeLibrary, but it doesn't have .get()! | 52 // TODO(vtl): We'd use a ScopedNativeLibrary, but it doesn't have .get()! |
| 53 base::NativeLibrary app_library = LoadNativeApplication(app_path); | 53 base::NativeLibrary app_library = LoadNativeApplication(app_path); |
| 54 if (!app_library) | 54 if (!app_library) |
| 55 return; | 55 return; |
| 56 | 56 |
| 57 // Set the application context if needed. Most applications will need to | 57 // Set the application context if needed. Most applications will need to |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 return ConvertUTF8ToJavaString(env, temporary_file.value()).Release(); | 178 return ConvertUTF8ToJavaString(env, temporary_file.value()).Release(); |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 bool RegisterAndroidHandlerJni(JNIEnv* env) { | 183 bool RegisterAndroidHandlerJni(JNIEnv* env) { |
| 184 return RegisterNativesImpl(env); | 184 return RegisterNativesImpl(env); |
| 185 } | 185 } |
| 186 | 186 |
| 187 } // namespace shell | 187 } // namespace shell |
| OLD | NEW |