OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.android_webview; | 5 package org.chromium.android_webview; |
6 | 6 |
7 import android.net.http.SslCertificate; | 7 import android.net.http.SslCertificate; |
8 import android.net.http.SslError; | 8 import android.net.http.SslError; |
9 import android.webkit.ValueCallback; | 9 import android.webkit.ValueCallback; |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 final SslCertificate cert = SslUtil.getCertificateFromDerBytes(derBytes)
; | 48 final SslCertificate cert = SslUtil.getCertificateFromDerBytes(derBytes)
; |
49 if (cert == null) { | 49 if (cert == null) { |
50 // if the certificate or the client is null, cancel the request | 50 // if the certificate or the client is null, cancel the request |
51 return false; | 51 return false; |
52 } | 52 } |
53 final SslError sslError = SslUtil.sslErrorFromNetErrorCode(certError, ce
rt, url); | 53 final SslError sslError = SslUtil.sslErrorFromNetErrorCode(certError, ce
rt, url); |
54 ValueCallback<Boolean> callback = new ValueCallback<Boolean>() { | 54 ValueCallback<Boolean> callback = new ValueCallback<Boolean>() { |
55 @Override | 55 @Override |
56 public void onReceiveValue(Boolean value) { | 56 public void onReceiveValue(Boolean value) { |
57 proceedSslError(value.booleanValue(), id); | 57 proceedSslError(value.booleanValue(), id); |
| 58 if (!value) { |
| 59 // For backward compatibility with the classic |
| 60 // webview, call onPageFinished after canceling ssl error. |
| 61 AwContentsClientBridge.this.mClient.onPageFinished(url); |
| 62 } |
58 } | 63 } |
59 }; | 64 }; |
60 mClient.onReceivedSslError(callback, sslError); | 65 mClient.onReceivedSslError(callback, sslError); |
61 return true; | 66 return true; |
62 } | 67 } |
63 | 68 |
64 private void proceedSslError(boolean proceed, int id) { | 69 private void proceedSslError(boolean proceed, int id) { |
65 if (mNativeContentsClientBridge == 0) return; | 70 if (mNativeContentsClientBridge == 0) return; |
66 nativeProceedSslError(mNativeContentsClientBridge, proceed, id); | 71 nativeProceedSslError(mNativeContentsClientBridge, proceed, id); |
67 } | 72 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 //--------------------------------------------------------------------------
------------------ | 113 //--------------------------------------------------------------------------
------------------ |
109 // Native methods | 114 // Native methods |
110 //--------------------------------------------------------------------------
------------------ | 115 //--------------------------------------------------------------------------
------------------ |
111 private native void nativeProceedSslError(long nativeAwContentsClientBridge,
boolean proceed, | 116 private native void nativeProceedSslError(long nativeAwContentsClientBridge,
boolean proceed, |
112 int id); | 117 int id); |
113 | 118 |
114 private native void nativeConfirmJsResult(long nativeAwContentsClientBridge,
int id, | 119 private native void nativeConfirmJsResult(long nativeAwContentsClientBridge,
int id, |
115 String prompt); | 120 String prompt); |
116 private native void nativeCancelJsResult(long nativeAwContentsClientBridge,
int id); | 121 private native void nativeCancelJsResult(long nativeAwContentsClientBridge,
int id); |
117 } | 122 } |
OLD | NEW |