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

Commit 65ae8d87 authored by Jonathan Dixon's avatar Jonathan Dixon Committed by Android (Google) Code Review
Browse files

Merge "Extract WebView Classic details from API classes."

parents 57217f23 73eeb7b5
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -403,17 +403,18 @@ class CallbackProxy extends Handler {
                break;

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

            case CLIENT_CERT_REQUEST:
                if (mWebViewClient != null) {
                    HashMap<String, Object> map =
                        (HashMap<String, Object>) msg.obj;
                    mWebViewClient.onReceivedClientCertRequest(mWebView.getWebView(),
                if (mWebViewClient != null  && mWebViewClient instanceof WebViewClientClassicExt) {
                    HashMap<String, Object> map = (HashMap<String, Object>) msg.obj;
                    ((WebViewClientClassicExt) mWebViewClient).onReceivedClientCertRequest(
                            mWebView.getWebView(),
                            (ClientCertRequestHandler) map.get("handler"),
                            (String) map.get("host_and_port"));
                }
@@ -1081,7 +1082,7 @@ class CallbackProxy extends Handler {
    }

    public void onProceededAfterSslError(SslError error) {
        if (mWebViewClient == null) {
        if (mWebViewClient == null || !(mWebViewClient instanceof WebViewClientClassicExt)) {
            return;
        }
        Message msg = obtainMessage(PROCEEDED_AFTER_SSL_ERROR);
@@ -1092,7 +1093,7 @@ class CallbackProxy extends Handler {
    public void onReceivedClientCertRequest(ClientCertRequestHandler handler, String host_and_port) {
        // Do an unsynchronized quick check to avoid posting if no callback has
        // been set.
        if (mWebViewClient == null) {
        if (mWebViewClient == null || !(mWebViewClient instanceof WebViewClientClassicExt)) {
            handler.cancel();
            return;
        }
+1 −3
Original line number Diff line number Diff line
@@ -86,10 +86,8 @@ public final class CookieSyncManager extends WebSyncManager {
            throw new IllegalArgumentException("Invalid context argument");
        }

        JniUtil.setContext(context);
        Context appContext = context.getApplicationContext();
        if (sRef == null) {
            sRef = new CookieSyncManager(appContext);
            sRef = new CookieSyncManager(context);
        }
        return sRef;
    }
+0 −29
Original line number Diff line number Diff line
@@ -203,35 +203,6 @@ public class WebViewClient {
        handler.cancel();
    }

    /**
     * Notify the host application that an SSL error occurred while loading a
     * resource, but the WebView 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
     * proceed with a client certificate 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, returning no client certificate.
     *
     * @param view The WebView that is initiating the callback.
     * @param handler A ClientCertRequestHandler object that will
     *            handle the user's response.
     * @param host_and_port The host and port of the requesting server.
     *
     * @hide
     */
    public void onReceivedClientCertRequest(WebView view,
            ClientCertRequestHandler handler, String host_and_port) {
        handler.cancel();
    }

    /**
     * Notify the host application to handle an authentication request. The
     * default behavior is to cancel the request.
+53 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.webkit;

import android.net.http.SslError;

/**
 * Adds WebViewClassic specific extension methods to the WebViewClient callback class.
 * These are not part of the public WebView API, so the class is hidden.
 * @hide
 */
public class WebViewClientClassicExt extends WebViewClient {

    /**
     * Notify the host application that an SSL error occurred while loading a
     * resource, but the WebView chose to proceed anyway based on a
     * decision retained from a previous response to onReceivedSslError().
     */
    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
     * proceed with a client certificate 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, returning no client certificate.
     *
     * @param view The WebView that is initiating the callback.
     * @param handler A ClientCertRequestHandler object that will
     *            handle the user's response.
     * @param host_and_port The host and port of the requesting server.
     */
    public void onReceivedClientCertRequest(WebView view,
            ClientCertRequestHandler handler, String host_and_port) {
        handler.cancel();
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ final class WebViewDatabaseClassic extends WebViewDatabase {
    private boolean mInitialized = false;

    WebViewDatabaseClassic(final Context context) {
        JniUtil.setContext(context);
        new Thread() {
            @Override
            public void run() {