11e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 21e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 31e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// found in the LICENSE file. 41e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 51e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "net/cert/x509_util_android.h" 61e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/android/build_info.h" 81e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "base/android/jni_android.h" 95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/metrics/histogram.h" 101e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "jni/X509Util_jni.h" 111e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "net/cert/cert_database.h" 121e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 131e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)namespace net { 141e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 151e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)void NotifyKeyChainChanged(JNIEnv* env, jclass clazz) { 161e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) CertDatabase::GetInstance()->OnAndroidKeyChainChanged(); 171e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)} 181e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)void RecordCertVerifyCapabilitiesHistogram(JNIEnv* env, 205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) jclass clazz, 215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) jboolean found_system_trust_roots) { 225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Only record the histogram for 4.2 and up. Before 4.2, the platform doesn't 235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // return the certificate chain anyway. 245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) if (base::android::BuildInfo::GetInstance()->sdk_int() >= 17) { 255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) UMA_HISTOGRAM_BOOLEAN("Net.FoundSystemTrustRootsAndroid", 265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) found_system_trust_roots); 275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) } 285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 301e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)jobject GetApplicationContext(JNIEnv* env, jclass clazz) { 311e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) return base::android::GetApplicationContext(); 321e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)} 331e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 341e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)bool RegisterX509Util(JNIEnv* env) { 351e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) return RegisterNativesImpl(env); 361e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)} 371e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 381e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)} // net namespace 39