Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 51938e26 authored by Selim Gurun's avatar Selim Gurun Committed by Android (Google) Code Review
Browse files

Merge "Do Not Merge. Move ssl callbacks to webcore thread." into ics-mr1

parents c15cf3d2 972b1a50
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -1187,12 +1187,20 @@ class BrowserFrame extends Handler {
            @Override
            public void proceed() {
                SslCertLookupTable.getInstance().setIsAllowed(sslError);
                post(new Runnable() {
                        public void run() {
                            nativeSslCertErrorProceed(handle);
                        }
                    });
            }
            @Override
            public void cancel() {
                post(new Runnable() {
                        public void run() {
                            nativeSslCertErrorCancel(handle, certError);
                        }
                    });
            }
        };
        mCallbackProxy.onReceivedSslError(handler, sslError);
    }
+26 −9
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.webkit;

import android.os.Handler;
import java.security.PrivateKey;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
@@ -29,7 +30,7 @@ import org.apache.harmony.xnet.provider.jsse.NativeCrypto;
 *
 * @hide
 */
public final class ClientCertRequestHandler {
public final class ClientCertRequestHandler extends Handler {

    private final BrowserFrame mBrowserFrame;
    private final int mHandle;
@@ -49,30 +50,46 @@ public final class ClientCertRequestHandler {
     * Proceed with the specified private key and client certificate chain.
     */
    public void proceed(PrivateKey privateKey, X509Certificate[] chain) {
        byte[] privateKeyBytes = privateKey.getEncoded();
        byte[][] chainBytes;
        final byte[] privateKeyBytes = privateKey.getEncoded();
        final byte[][] chainBytes;
        try {
            chainBytes = NativeCrypto.encodeCertificates(chain);
            mTable.Allow(mHostAndPort, privateKeyBytes, chainBytes);
            post(new Runnable() {
                    public void run() {
                        mBrowserFrame.nativeSslClientCert(mHandle, privateKeyBytes, chainBytes);
                    }
                });
        } catch (CertificateEncodingException e) {
            post(new Runnable() {
                    public void run() {
                        mBrowserFrame.nativeSslClientCert(mHandle, null, null);
                        return;
                    }
        mTable.Allow(mHostAndPort, privateKeyBytes, chainBytes);
        mBrowserFrame.nativeSslClientCert(mHandle, privateKeyBytes, chainBytes);
                });
        }
    }

    /**
     * Igore the request for now, the user may be prompted again.
     */
    public void ignore() {
        post(new Runnable() {
                public void run() {
                    mBrowserFrame.nativeSslClientCert(mHandle, null, null);
                }
            });
    }

    /**
     * Cancel this request, remember the users negative choice.
     */
    public void cancel() {
        mTable.Deny(mHostAndPort);
        post(new Runnable() {
                public void run() {
                    mBrowserFrame.nativeSslClientCert(mHandle, null, null);
                }
            });
    }
}
+2 −2

File changed.

Contains only whitespace changes.