Ignore title parameter for navigator.registerProtocolHandler
[chromium-blink-merge.git] / components / cronet / android / cronet_jni.cc
blob6a370a3ef0fda8694b9baf22027ca5a15cfca749
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.
5 #include "base/android/base_jni_registrar.h"
6 #include "base/android/jni_android.h"
7 #include "base/android/jni_registrar.h"
8 #include "base/at_exit.h"
9 #include "base/i18n/icu_util.h"
10 #include "components/cronet/android/org_chromium_net_UrlRequest.h"
11 #include "components/cronet/android/org_chromium_net_UrlRequestContext.h"
12 #include "net/android/net_jni_registrar.h"
13 #include "url/android/url_jni_registrar.h"
15 namespace {
17 const base::android::RegistrationMethod kCronetRegisteredMethods[] = {
18 {"BaseAndroid", base::android::RegisterJni},
19 {"NetAndroid", net::android::RegisterJni},
20 {"UrlAndroid", url::android::RegisterJni},
21 {"UrlRequest", cronet::UrlRequestRegisterJni},
22 {"UrlRequestContext", cronet::UrlRequestContextRegisterJni},
25 base::AtExitManager* g_at_exit_manager = NULL;
27 } // namespace
29 // Checks the available version of JNI. Also, caches Java reflection artifacts.
30 extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved) {
31 JNIEnv* env;
32 if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
33 return -1;
36 base::android::InitVM(vm);
38 if (!base::android::RegisterNativeMethods(
39 env, kCronetRegisteredMethods, arraysize(kCronetRegisteredMethods))) {
40 return -1;
43 g_at_exit_manager = new base::AtExitManager();
45 base::i18n::InitializeICU();
47 return JNI_VERSION_1_6;
50 extern "C" void JNIEXPORT JNICALL JNI_OnUnLoad(JavaVM* jvm, void* reserved) {
51 if (g_at_exit_manager) {
52 delete g_at_exit_manager;
53 g_at_exit_manager = NULL;