OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/client/app/android/blimp_library_loader.h" | 5 #include "blimp/client/app/android/blimp_library_loader.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/android/base_jni_onload.h" | 9 #include "base/android/base_jni_onload.h" |
10 #include "base/android/base_jni_registrar.h" | 10 #include "base/android/base_jni_registrar.h" |
11 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
12 #include "base/android/library_loader/library_loader_hooks.h" | 12 #include "base/android/library_loader/library_loader_hooks.h" |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "blimp/client/app/android/blimp_jni_registrar.h" | 15 #include "blimp/client/app/android/blimp_app_jni_registrar.h" |
16 #include "blimp/client/app/blimp_startup.h" | 16 #include "blimp/client/app/blimp_startup.h" |
| 17 #include "blimp/client/public/android/blimp_jni_registrar.h" |
17 #include "jni/BlimpLibraryLoader_jni.h" | 18 #include "jni/BlimpLibraryLoader_jni.h" |
18 #include "net/android/net_jni_registrar.h" | 19 #include "net/android/net_jni_registrar.h" |
19 #include "ui/gl/gl_surface.h" | 20 #include "ui/gl/gl_surface.h" |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 bool OnLibrariesLoaded(JNIEnv* env, jclass clazz) { | 24 bool OnLibrariesLoaded(JNIEnv* env, jclass clazz) { |
24 blimp::client::InitializeLogging(); | 25 blimp::client::InitializeLogging(); |
25 return true; | 26 return true; |
26 } | 27 } |
27 | 28 |
28 bool OnJniInitializationComplete() { | 29 bool OnJniInitializationComplete() { |
29 base::android::SetLibraryLoadedHook(&OnLibrariesLoaded); | 30 base::android::SetLibraryLoadedHook(&OnLibrariesLoaded); |
30 return true; | 31 return true; |
31 } | 32 } |
32 | 33 |
33 bool RegisterJni(JNIEnv* env) { | 34 bool RegisterJni(JNIEnv* env) { |
34 if (!base::android::RegisterJni(env)) | 35 if (!base::android::RegisterJni(env)) |
35 return false; | 36 return false; |
36 | 37 |
37 if (!net::android::RegisterJni(env)) | 38 if (!net::android::RegisterJni(env)) |
38 return false; | 39 return false; |
39 | 40 |
40 if (!blimp::client::RegisterBlimpJni(env)) | 41 if (!blimp::client::RegisterBlimpJni(env)) |
41 return false; | 42 return false; |
42 | 43 |
| 44 if (!blimp::client::RegisterBlimpAppJni(env)) |
| 45 return false; |
| 46 |
43 return true; | 47 return true; |
44 } | 48 } |
45 | 49 |
46 } // namespace | 50 } // namespace |
47 | 51 |
48 namespace blimp { | 52 namespace blimp { |
49 namespace client { | 53 namespace client { |
50 | 54 |
51 static jboolean StartBlimp(JNIEnv* env, const JavaParamRef<jclass>& clazz) { | 55 static jboolean StartBlimp(JNIEnv* env, const JavaParamRef<jclass>& clazz) { |
52 if (!InitializeMainMessageLoop()) | 56 if (!InitializeMainMessageLoop()) |
(...skipping 21 matching lines...) Expand all Loading... |
74 // Although we only need to register JNI for base/ and blimp/, this follows | 78 // Although we only need to register JNI for base/ and blimp/, this follows |
75 // the general Chrome for Android pattern, to be future-proof against future | 79 // the general Chrome for Android pattern, to be future-proof against future |
76 // changes to JNI. | 80 // changes to JNI. |
77 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || | 81 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || |
78 !base::android::OnJNIOnLoadInit(init_callbacks)) { | 82 !base::android::OnJNIOnLoadInit(init_callbacks)) { |
79 return -1; | 83 return -1; |
80 } | 84 } |
81 | 85 |
82 return JNI_VERSION_1_4; | 86 return JNI_VERSION_1_4; |
83 } | 87 } |
OLD | NEW |