| 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 "components/cronet/android/cronet_library_loader.h" | 5 #include "components/cronet/android/cronet_library_loader.h" |
| 6 | 6 |
| 7 #include <jni.h> | 7 #include <jni.h> |
| 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" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 return -1; | 80 return -1; |
| 81 } | 81 } |
| 82 return JNI_VERSION_1_6; | 82 return JNI_VERSION_1_6; |
| 83 } | 83 } |
| 84 | 84 |
| 85 void CronetOnUnLoad(JavaVM* jvm, void* reserved) { | 85 void CronetOnUnLoad(JavaVM* jvm, void* reserved) { |
| 86 base::android::LibraryLoaderExitHook(); | 86 base::android::LibraryLoaderExitHook(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void CronetInitApplicationContext(JNIEnv* env, | 89 void CronetInitApplicationContext(JNIEnv* env, |
| 90 jclass jcaller, | 90 const JavaParamRef<jclass>& jcaller, |
| 91 jobject japp_context) { | 91 const JavaParamRef<jobject>& japp_context) { |
| 92 // Set application context. | 92 // Set application context. |
| 93 base::android::ScopedJavaLocalRef<jobject> scoped_app_context(env, | 93 base::android::ScopedJavaLocalRef<jobject> scoped_app_context(env, |
| 94 japp_context); | 94 japp_context); |
| 95 base::android::InitApplicationContext(env, scoped_app_context); | 95 base::android::InitApplicationContext(env, scoped_app_context); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void CronetInitOnMainThread(JNIEnv* env, jclass jcaller) { | 98 void CronetInitOnMainThread(JNIEnv* env, const JavaParamRef<jclass>& jcaller) { |
| 99 #if !defined(USE_ICU_ALTERNATIVES_ON_ANDROID) | 99 #if !defined(USE_ICU_ALTERNATIVES_ON_ANDROID) |
| 100 base::i18n::InitializeICU(); | 100 base::i18n::InitializeICU(); |
| 101 #endif | 101 #endif |
| 102 | 102 |
| 103 // TODO(bengr): Remove once Data Reduction Proxy no longer needs this for | 103 // TODO(bengr): Remove once Data Reduction Proxy no longer needs this for |
| 104 // configuration information. | 104 // configuration information. |
| 105 base::CommandLine::Init(0, nullptr); | 105 base::CommandLine::Init(0, nullptr); |
| 106 DCHECK(!base::MessageLoop::current()); | 106 DCHECK(!base::MessageLoop::current()); |
| 107 DCHECK(!g_main_message_loop); | 107 DCHECK(!g_main_message_loop); |
| 108 g_main_message_loop = new base::MessageLoopForUI(); | 108 g_main_message_loop = new base::MessageLoopForUI(); |
| 109 base::MessageLoopForUI::current()->Start(); | 109 base::MessageLoopForUI::current()->Start(); |
| 110 DCHECK(!g_network_change_notifier); | 110 DCHECK(!g_network_change_notifier); |
| 111 net::NetworkChangeNotifier::SetFactory( | 111 net::NetworkChangeNotifier::SetFactory( |
| 112 new net::NetworkChangeNotifierFactoryAndroid()); | 112 new net::NetworkChangeNotifierFactoryAndroid()); |
| 113 g_network_change_notifier = net::NetworkChangeNotifier::Create(); | 113 g_network_change_notifier = net::NetworkChangeNotifier::Create(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 ScopedJavaLocalRef<jstring> GetCronetVersion(JNIEnv* env, jclass jcaller) { | 116 ScopedJavaLocalRef<jstring> GetCronetVersion( |
| 117 JNIEnv* env, |
| 118 const JavaParamRef<jclass>& jcaller) { |
| 117 return base::android::ConvertUTF8ToJavaString(env, CRONET_VERSION); | 119 return base::android::ConvertUTF8ToJavaString(env, CRONET_VERSION); |
| 118 } | 120 } |
| 119 | 121 |
| 120 } // namespace cronet | 122 } // namespace cronet |
| OLD | NEW |