173eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon/* 273eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * Copyright (C) 2012 The Android Open Source Project 373eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * 473eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * Licensed under the Apache License, Version 2.0 (the "License"); 573eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * you may not use this file except in compliance with the License. 673eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * You may obtain a copy of the License at 773eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * 873eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * http://www.apache.org/licenses/LICENSE-2.0 973eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * 1073eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * Unless required by applicable law or agreed to in writing, software 1173eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * distributed under the License is distributed on an "AS IS" BASIS, 1273eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1373eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * See the License for the specific language governing permissions and 1473eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * limitations under the License. 1573eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon */ 1673eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon 1773eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixonpackage android.webkit; 1873eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon 1973eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixonimport android.net.http.SslError; 2073eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon 2173eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon/** 2273eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * Adds WebViewClassic specific extension methods to the WebViewClient callback class. 2373eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * These are not part of the public WebView API, so the class is hidden. 2473eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * @hide 2573eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon */ 2673eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixonpublic class WebViewClientClassicExt extends WebViewClient { 2773eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon 2873eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon /** 2973eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * Notify the host application that an SSL error occurred while loading a 3073eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * resource, but the WebView chose to proceed anyway based on a 3173eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * decision retained from a previous response to onReceivedSslError(). 3273eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon */ 3373eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon public void onProceededAfterSslError(WebView view, SslError error) { 3473eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon } 3573eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon 3673eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon /** 3773eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * Notify the host application to handle a SSL client certificate 3873eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * request (display the request to the user and ask whether to 3973eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * proceed with a client certificate or not). The host application 4073eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * has to call either handler.cancel() or handler.proceed() as the 4173eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * connection is suspended and waiting for the response. The 4273eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * default behavior is to cancel, returning no client certificate. 4373eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * 4473eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * @param view The WebView that is initiating the callback. 4573eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * @param handler A ClientCertRequestHandler object that will 4673eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * handle the user's response. 4773eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon * @param host_and_port The host and port of the requesting server. 4873eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon */ 4973eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon public void onReceivedClientCertRequest(WebView view, 5073eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon ClientCertRequestHandler handler, String host_and_port) { 5173eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon handler.cancel(); 5273eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon } 5373eeb7b5ed5f88750156b787c665f7d3769fc56aJonathan Dixon} 54