OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/android/base_jni_onload.h" | |
6 #include "base/android/base_jni_registrar.h" | |
7 #include "base/android/jni_android.h" | |
8 #include "base/bind.h" | |
9 #include "components/devtools_bridge/android/apiary_client_factory.h" | |
10 #include "components/devtools_bridge/android/session_dependency_factory_android.
h" | |
11 | |
12 namespace { | |
13 | |
14 using namespace devtools_bridge::android; | |
15 | |
16 bool RegisterJNI(JNIEnv* env) { | |
17 return base::android::RegisterJni(env) && | |
18 SessionDependencyFactoryAndroid::RegisterNatives(env) && | |
19 ApiaryClientFactory::RegisterNatives(env); | |
20 } | |
21 | |
22 bool Init() { | |
23 return devtools_bridge::SessionDependencyFactory::InitializeSSL(); | |
24 } | |
25 | |
26 } // namespace | |
27 | |
28 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | |
29 std::vector<base::android::RegisterCallback> register_callbacks; | |
30 register_callbacks.push_back(base::Bind(&RegisterJNI)); | |
31 std::vector<base::android::InitCallback> init_callbacks; | |
32 init_callbacks.push_back(base::Bind(&Init)); | |
33 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || | |
34 !base::android::OnJNIOnLoadInit(init_callbacks)) { | |
35 return -1; | |
36 } | |
37 return JNI_VERSION_1_4; | |
38 } | |
OLD | NEW |