Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / remoting / client / jni / remoting_jni_onload.cc
blobb5397475849417334e501176a1ca9fa9b16c6f31
1 // Copyright 2013 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.
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/android/jni_registrar.h"
9 #include "base/android/jni_utils.h"
10 #include "base/bind.h"
11 #include "net/android/net_jni_registrar.h"
12 #include "remoting/client/jni/remoting_jni_registrar.h"
13 #include "ui/gfx/android/gfx_jni_registrar.h"
15 namespace {
17 base::android::RegistrationMethod kRemotingRegisteredMethods[] = {
18 {"base", base::android::RegisterJni},
19 {"gfx", gfx::android::RegisterJni},
20 {"net", net::android::RegisterJni},
21 {"remoting", remoting::RegisterJni},
24 bool RegisterJNI(JNIEnv* env) {
25 return base::android::RegisterNativeMethods(env,
26 kRemotingRegisteredMethods, arraysize(kRemotingRegisteredMethods));
29 } // namespace
31 JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
32 std::vector<base::android::RegisterCallback> register_callbacks;
33 register_callbacks.push_back(base::Bind(&RegisterJNI));
34 std::vector<base::android::InitCallback> init_callbacks;
35 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) ||
36 !base::android::OnJNIOnLoadInit(init_callbacks)) {
37 return -1;
39 return JNI_VERSION_1_4;