diff options
-rw-r--r-- | android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java | 40 | ||||
-rw-r--r-- | android_webview/native/aw_contents_client_bridge.cc | 9 |
2 files changed, 38 insertions, 11 deletions
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java b/android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java index 6ebfe8a..2cb30d1 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java @@ -75,8 +75,35 @@ public class AwContentsClientBridge { mPort = port; } - public void proceed(PrivateKey privateKey, X509Certificate[] chain) { - ThreadUtils.assertOnUiThread(); + public void proceed(final PrivateKey privateKey, final X509Certificate[] chain) { + ThreadUtils.runOnUiThread(new Runnable() { + @Override + public void run() { + proceedOnUiThread(privateKey, chain); + } + }); + } + + public void ignore() { + ThreadUtils.runOnUiThread(new Runnable() { + @Override + public void run() { + ignoreOnUiThread(); + } + }); + } + + public void cancel() { + ThreadUtils.runOnUiThread(new Runnable() { + @Override + public void run() { + cancelOnUiThread(); + } + + }); + } + + private void proceedOnUiThread(PrivateKey privateKey, X509Certificate[] chain) { checkIfCalled(); AndroidPrivateKey key = mLocalKeyStore.createKey(privateKey); @@ -101,19 +128,18 @@ public class AwContentsClientBridge { provideResponse(key, encodedChain); } - public void ignore() { - ThreadUtils.assertOnUiThread(); + private void ignoreOnUiThread() { checkIfCalled(); provideResponse(null, null); } - public void cancel() { - ThreadUtils.assertOnUiThread(); + private void cancelOnUiThread() { + checkIfCalled(); mLookupTable.deny(mHost, mPort); provideResponse(null, null); } - public void checkIfCalled() { + private void checkIfCalled() { if (mIsCalled) { throw new IllegalStateException("The callback was already called."); } diff --git a/android_webview/native/aw_contents_client_bridge.cc b/android_webview/native/aw_contents_client_bridge.cc index 0703c81..efb5a85 100644 --- a/android_webview/native/aw_contents_client_bridge.cc +++ b/android_webview/native/aw_contents_client_bridge.cc @@ -31,6 +31,7 @@ namespace android_webview { typedef net::OpenSSLClientKeyStore::ScopedEVP_PKEY ScopedEVP_PKEY; namespace { + // Must be called on the I/O thread to record a client certificate // and its private key in the OpenSSLClientKeyStore. void RecordClientCertificateKey( @@ -130,8 +131,8 @@ void AwContentsClientBridge::SelectClientCertificate( // Build the |key_types| JNI parameter, as a String[] std::vector<std::string> key_types; - for (size_t n = 0; n < cert_request_info->cert_key_types.size(); ++n) { - switch (cert_request_info->cert_key_types[n]) { + for (size_t i = 0; i < cert_request_info->cert_key_types.size(); ++i) { + switch (cert_request_info->cert_key_types[i]) { case net::CLIENT_CERT_RSA_SIGN: key_types.push_back("RSA"); break; @@ -213,8 +214,8 @@ void AwContentsClientBridge::ProvideClientCertificateResponse( } std::vector<base::StringPiece> encoded_chain; - for (size_t n = 0; n < encoded_chain_strings.size(); ++n) - encoded_chain.push_back(encoded_chain_strings[n]); + for (size_t i = 0; i < encoded_chain_strings.size(); ++i) + encoded_chain.push_back(encoded_chain_strings[i]); // Create the X509Certificate object from the encoded chain. scoped_refptr<net::X509Certificate> client_cert( |