| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/android/network_library.h" | 5 #include "net/android/network_library.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // Intentionally do not return 'ret', there is little the caller can | 92 // Intentionally do not return 'ret', there is little the caller can |
| 93 // do in case of failure (the CertInstaller itself will deal with | 93 // do in case of failure (the CertInstaller itself will deal with |
| 94 // incorrect data and display the appropriate toast). | 94 // incorrect data and display the appropriate toast). |
| 95 } | 95 } |
| 96 | 96 |
| 97 bool HaveOnlyLoopbackAddresses() { | 97 bool HaveOnlyLoopbackAddresses() { |
| 98 JNIEnv* env = AttachCurrentThread(); | 98 JNIEnv* env = AttachCurrentThread(); |
| 99 return Java_AndroidNetworkLibrary_haveOnlyLoopbackAddresses(env); | 99 return Java_AndroidNetworkLibrary_haveOnlyLoopbackAddresses(env); |
| 100 } | 100 } |
| 101 | 101 |
| 102 std::string GetNetworkList() { | |
| 103 JNIEnv* env = AttachCurrentThread(); | |
| 104 ScopedJavaLocalRef<jstring> ret = | |
| 105 Java_AndroidNetworkLibrary_getNetworkList(env); | |
| 106 return ConvertJavaStringToUTF8(ret); | |
| 107 } | |
| 108 | |
| 109 bool GetMimeTypeFromExtension(const std::string& extension, | 102 bool GetMimeTypeFromExtension(const std::string& extension, |
| 110 std::string* result) { | 103 std::string* result) { |
| 111 JNIEnv* env = AttachCurrentThread(); | 104 JNIEnv* env = AttachCurrentThread(); |
| 112 | 105 |
| 113 ScopedJavaLocalRef<jstring> extension_string = | 106 ScopedJavaLocalRef<jstring> extension_string = |
| 114 ConvertUTF8ToJavaString(env, extension); | 107 ConvertUTF8ToJavaString(env, extension); |
| 115 ScopedJavaLocalRef<jstring> ret = | 108 ScopedJavaLocalRef<jstring> ret = |
| 116 Java_AndroidNetworkLibrary_getMimeTypeFromExtension( | 109 Java_AndroidNetworkLibrary_getMimeTypeFromExtension( |
| 117 env, extension_string.obj()); | 110 env, extension_string.obj()); |
| 118 | 111 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 135 base::android::AttachCurrentThread(), | 128 base::android::AttachCurrentThread(), |
| 136 base::android::GetApplicationContext())); | 129 base::android::GetApplicationContext())); |
| 137 } | 130 } |
| 138 | 131 |
| 139 bool RegisterNetworkLibrary(JNIEnv* env) { | 132 bool RegisterNetworkLibrary(JNIEnv* env) { |
| 140 return RegisterNativesImpl(env); | 133 return RegisterNativesImpl(env); |
| 141 } | 134 } |
| 142 | 135 |
| 143 } // namespace android | 136 } // namespace android |
| 144 } // namespace net | 137 } // namespace net |
| OLD | NEW |