Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: net/android/network_library.cc

Issue 11198029: Android: remove check for JNI method id. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Joth's comments Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "jni/AndroidNetworkLibrary_jni.h" 12 #include "jni/AndroidNetworkLibrary_jni.h"
13 13
14 using base::android::AttachCurrentThread; 14 using base::android::AttachCurrentThread;
15 using base::android::ClearException; 15 using base::android::ClearException;
16 using base::android::ConvertJavaStringToUTF8; 16 using base::android::ConvertJavaStringToUTF8;
17 using base::android::ConvertUTF8ToJavaString; 17 using base::android::ConvertUTF8ToJavaString;
18 using base::android::GetApplicationContext; 18 using base::android::GetApplicationContext;
19 using base::android::ScopedJavaLocalRef; 19 using base::android::ScopedJavaLocalRef;
20 using base::android::ToJavaArrayOfByteArray; 20 using base::android::ToJavaArrayOfByteArray;
21 using base::android::ToJavaByteArray; 21 using base::android::ToJavaByteArray;
22 22
23 namespace net { 23 namespace net {
24 namespace android { 24 namespace android {
25 25
26 VerifyResult VerifyX509CertChain(const std::vector<std::string>& cert_chain, 26 VerifyResult VerifyX509CertChain(const std::vector<std::string>& cert_chain,
27 const std::string& auth_type) { 27 const std::string& auth_type) {
28 JNIEnv* env = AttachCurrentThread(); 28 JNIEnv* env = AttachCurrentThread();
29 if (!env || !g_AndroidNetworkLibrary_verifyServerCertificates) {
30 // TODO(bulach): Remove when we initialize the JVM in unit tests.
31 LOG(WARNING) << "JNI initialization failed";
32 return VERIFY_INVOCATION_ERROR;
33 }
34 29
35 ScopedJavaLocalRef<jobjectArray> chain_byte_array = 30 ScopedJavaLocalRef<jobjectArray> chain_byte_array =
36 ToJavaArrayOfByteArray(env, cert_chain); 31 ToJavaArrayOfByteArray(env, cert_chain);
37 DCHECK(!chain_byte_array.is_null()); 32 DCHECK(!chain_byte_array.is_null());
38 33
39 ScopedJavaLocalRef<jstring> auth_string = 34 ScopedJavaLocalRef<jstring> auth_string =
40 ConvertUTF8ToJavaString(env, auth_type); 35 ConvertUTF8ToJavaString(env, auth_type);
41 DCHECK(!auth_string.is_null()); 36 DCHECK(!auth_string.is_null());
42 37
43 jboolean trusted = Java_AndroidNetworkLibrary_verifyServerCertificates( 38 jboolean trusted = Java_AndroidNetworkLibrary_verifyServerCertificates(
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 *result = ConvertJavaStringToUTF8(ret); 89 *result = ConvertJavaStringToUTF8(ret);
95 return true; 90 return true;
96 } 91 }
97 92
98 bool RegisterNetworkLibrary(JNIEnv* env) { 93 bool RegisterNetworkLibrary(JNIEnv* env) {
99 return RegisterNativesImpl(env); 94 return RegisterNativesImpl(env);
100 } 95 }
101 96
102 } // namespace android 97 } // namespace android
103 } // namespace net 98 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698