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 } | |
63 } | 58 } |
64 }; | 59 }; |
65 mClient.onReceivedSslError(callback, sslError); | 60 mClient.onReceivedSslError(callback, sslError); |
66 return true; | 61 return true; |
67 } | 62 } |
68 | 63 |
69 private void proceedSslError(boolean proceed, int id) { | 64 private void proceedSslError(boolean proceed, int id) { |
70 if (mNativeContentsClientBridge == 0) return; | 65 if (mNativeContentsClientBridge == 0) return; |
71 nativeProceedSslError(mNativeContentsClientBridge, proceed, id); | 66 nativeProceedSslError(mNativeContentsClientBridge, proceed, id); |
72 } | 67 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 //--------------------------------------------------------------------------
------------------ | 108 //--------------------------------------------------------------------------
------------------ |
114 // Native methods | 109 // Native methods |
115 //--------------------------------------------------------------------------
------------------ | 110 //--------------------------------------------------------------------------
------------------ |
116 private native void nativeProceedSslError(long nativeAwContentsClientBridge,
boolean proceed, | 111 private native void nativeProceedSslError(long nativeAwContentsClientBridge,
boolean proceed, |
117 int id); | 112 int id); |
118 | 113 |
119 private native void nativeConfirmJsResult(long nativeAwContentsClientBridge,
int id, | 114 private native void nativeConfirmJsResult(long nativeAwContentsClientBridge,
int id, |
120 String prompt); | 115 String prompt); |
121 private native void nativeCancelJsResult(long nativeAwContentsClientBridge,
int id); | 116 private native void nativeCancelJsResult(long nativeAwContentsClientBridge,
int id); |
122 } | 117 } |
OLD | NEW |