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

Commit d8b505d5 authored by Steve Block's avatar Steve Block Committed by Android (Google) Code Review
Browse files

Merge "Add WebViewClient.onProceededAfterSslError()"

parents 59797e6b fe33a75c
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -471,6 +471,7 @@ class BrowserFrame extends Handler {

    /**
     * We have received an SSL certificate for the main top-level page.
     * Used by the Android HTTP stack only.
     */
    void certificate(SslCertificate certificate) {
        if (mIsMainFrame) {
@@ -1178,6 +1179,7 @@ class BrowserFrame extends Handler {

        if (SslCertLookupTable.getInstance().isAllowed(sslError)) {
            nativeSslCertErrorProceed(handle);
            mCallbackProxy.onProceededAfterSslError(sslError);
            return;
        }

@@ -1267,7 +1269,8 @@ class BrowserFrame extends Handler {
    }

    /**
     * Called by JNI when we load a page over SSL.
     * Called by JNI when we recieve a certificate for the page's main resource.
     * Used by the Chromium HTTP stack only.
     */
    private void setCertificate(byte cert_der[]) {
        try {
+62 −45
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ class CallbackProxy extends Handler {
    // Used to call startActivity during url override.
    private final Context mContext;

    // Message Ids
    // Message IDs
    private static final int PAGE_STARTED                         = 100;
    private static final int RECEIVED_ICON                        = 101;
    private static final int RECEIVED_TITLE                       = 102;
@@ -121,6 +121,7 @@ class CallbackProxy extends Handler {
    private static final int CLIENT_CERT_REQUEST                  = 141;
    private static final int SEARCHBOX_IS_SUPPORTED_CALLBACK      = 142;
    private static final int SEARCHBOX_DISPATCH_COMPLETE_CALLBACK = 143;
    private static final int PROCEEDED_AFTER_SSL_ERROR            = 144;

    // Message triggered by the client to resume execution
    private static final int NOTIFY                               = 200;
@@ -349,6 +350,13 @@ class CallbackProxy extends Handler {
                }
                break;

            case PROCEEDED_AFTER_SSL_ERROR:
                if (mWebViewClient != null) {
                    mWebViewClient.onProceededAfterSslError(mWebView,
                            (SslError) msg.obj);
                }
                break;

            case CLIENT_CERT_REQUEST:
                if (mWebViewClient != null) {
                    HashMap<String, Object> map =
@@ -1024,6 +1032,15 @@ class CallbackProxy extends Handler {
        sendMessage(msg);
    }

    public void onProceededAfterSslError(SslError error) {
        if (mWebViewClient == null) {
            return;
        }
        Message msg = obtainMessage(PROCEEDED_AFTER_SSL_ERROR);
        msg.obj = error;
        sendMessage(msg);
    }

    public void onReceivedClientCertRequest(ClientCertRequestHandler handler, String host_and_port) {
        // Do an unsynchronized quick check to avoid posting if no callback has
        // been set.
+14 −5
Original line number Diff line number Diff line
@@ -186,11 +186,11 @@ public class WebViewClient {
    }

    /**
     * Notify the host application to handle a SSL certificate error request
     * (display the error to the user and ask whether to proceed or not). The
     * host application has to call either handler.cancel() or handler.proceed()
     * as the connection is suspended and waiting for the response. The default
     * behavior is to cancel the load.
     * Notify the host application that an SSL error occurred while loading a
     * resource. The host application must call either handler.cancel() or
     * handler.proceed(). Note that the decision may be retained for use in
     * response to future SSL errors. The default behavior is to cancel the
     * load.
     *
     * @param view The WebView that is initiating the callback.
     * @param handler An SslErrorHandler object that will handle the user's
@@ -202,6 +202,15 @@ public class WebViewClient {
        handler.cancel();
    }

    /**
     * Notify the host application that an SSL error occurred while loading a
     * resource, but the WebView but chose to proceed anyway based on a
     * decision retained from a previous response to onReceivedSslError().
     * @hide
     */
    public void onProceededAfterSslError(WebView view, SslError error) {
    }

    /**
     * Notify the host application to handle a SSL client certificate
     * request (display the request to the user and ask whether to