| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 ScopedJavaLocalRef<jstring> ret = | 115 ScopedJavaLocalRef<jstring> ret = |
| 116 Java_AndroidNetworkLibrary_getMimeTypeFromExtension( | 116 Java_AndroidNetworkLibrary_getMimeTypeFromExtension( |
| 117 env, extension_string.obj()); | 117 env, extension_string.obj()); |
| 118 | 118 |
| 119 if (!ret.obj()) | 119 if (!ret.obj()) |
| 120 return false; | 120 return false; |
| 121 *result = ConvertJavaStringToUTF8(ret); | 121 *result = ConvertJavaStringToUTF8(ret); |
| 122 return true; | 122 return true; |
| 123 } | 123 } |
| 124 | 124 |
| 125 std::string GetTelephonyNetworkCountryIso() { |
| 126 return base::android::ConvertJavaStringToUTF8( |
| 127 Java_AndroidNetworkLibrary_getNetworkCountryIso( |
| 128 base::android::AttachCurrentThread(), |
| 129 base::android::GetApplicationContext())); |
| 130 } |
| 131 |
| 132 std::string GetTelephonyNetworkOperator() { |
| 133 return base::android::ConvertJavaStringToUTF8( |
| 134 Java_AndroidNetworkLibrary_getNetworkOperator( |
| 135 base::android::AttachCurrentThread(), |
| 136 base::android::GetApplicationContext())); |
| 137 } |
| 138 |
| 125 bool RegisterNetworkLibrary(JNIEnv* env) { | 139 bool RegisterNetworkLibrary(JNIEnv* env) { |
| 126 return RegisterNativesImpl(env); | 140 return RegisterNativesImpl(env); |
| 127 } | 141 } |
| 128 | 142 |
| 129 } // namespace android | 143 } // namespace android |
| 130 } // namespace net | 144 } // namespace net |
| OLD | NEW |