Chromium Code Reviews| Index: android_webview/native/aw_contents_client_bridge.cc |
| diff --git a/android_webview/native/aw_contents_client_bridge.cc b/android_webview/native/aw_contents_client_bridge.cc |
| index c428f2421855da288ff88fe0b88b98e6f908308b..c928a5e75580624ed7566e8f72c9aef18d73bfca 100644 |
| --- a/android_webview/native/aw_contents_client_bridge.cc |
| +++ b/android_webview/native/aw_contents_client_bridge.cc |
| @@ -4,6 +4,8 @@ |
| #include "android_webview/native/aw_contents_client_bridge.h" |
| +#include <utility> |
| + |
| #include "android_webview/common/devtools_instrumentation.h" |
| #include "android_webview/native/aw_contents.h" |
| #include "base/android/jni_android.h" |
| @@ -11,6 +13,7 @@ |
| #include "base/android/jni_string.h" |
| #include "base/callback_helpers.h" |
| #include "base/macros.h" |
| +#include "base/memory/ref_counted.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/client_certificate_delegate.h" |
| #include "content/public/browser/render_process_host.h" |
| @@ -19,11 +22,12 @@ |
| #include "crypto/scoped_openssl_types.h" |
| #include "grit/components_strings.h" |
| #include "jni/AwContentsClientBridge_jni.h" |
| -#include "net/android/keystore_openssl.h" |
| #include "net/cert/x509_certificate.h" |
| #include "net/ssl/openssl_client_key_store.h" |
| #include "net/ssl/ssl_cert_request_info.h" |
| #include "net/ssl/ssl_client_cert_type.h" |
| +#include "net/ssl/ssl_platform_key_android.h" |
| +#include "net/ssl/ssl_private_key.h" |
| #include "ui/base/l10n/l10n_util.h" |
| #include "url/gurl.h" |
| @@ -42,12 +46,11 @@ namespace { |
| // Must be called on the I/O thread to record a client certificate |
| // and its private key in the OpenSSLClientKeyStore. |
| -void RecordClientCertificateKey( |
| - const scoped_refptr<net::X509Certificate>& client_cert, |
| - crypto::ScopedEVP_PKEY private_key) { |
| +void RecordClientCertificateKey(net::X509Certificate* client_cert, |
| + scoped_refptr<net::SSLPrivateKey> private_key) { |
| DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| net::OpenSSLClientKeyStore::GetInstance()->RecordClientCertPrivateKey( |
| - client_cert.get(), private_key.get()); |
| + client_cert, std::move(private_key)); |
| } |
| } // namespace |
| @@ -238,9 +241,9 @@ void AwContentsClientBridge::ProvideClientCertificateResponse( |
| } |
| // Create an EVP_PKEY wrapper for the private key JNI reference. |
|
svaldez
2016/09/01 14:51:05
Update comment.
davidben
2016/09/01 19:40:56
Done.
|
| - crypto::ScopedEVP_PKEY private_key( |
| - net::android::GetOpenSSLPrivateKeyWrapper(private_key_ref.obj())); |
| - if (!private_key.get()) { |
| + scoped_refptr<net::SSLPrivateKey> private_key = |
| + net::WrapJavaPrivateKey(private_key_ref.obj()); |
| + if (!private_key) { |
| LOG(ERROR) << "Could not create OpenSSL wrapper for private key"; |
| return; |
| } |
| @@ -255,7 +258,7 @@ void AwContentsClientBridge::ProvideClientCertificateResponse( |
| // the UI thread. |
| content::BrowserThread::PostTaskAndReply( |
| content::BrowserThread::IO, FROM_HERE, |
| - base::Bind(&RecordClientCertificateKey, client_cert, |
| + base::Bind(&RecordClientCertificateKey, base::RetainedRef(client_cert), |
| base::Passed(&private_key)), |
| base::Bind(&content::ClientCertificateDelegate::ContinueWithCertificate, |
| base::Owned(delegate), base::RetainedRef(client_cert))); |