| 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.content.Context; | 7 import android.content.Context; |
| 8 import android.net.http.SslCertificate; | 8 import android.net.http.SslCertificate; |
| 9 import android.net.http.SslError; | 9 import android.net.http.SslError; |
| 10 import android.util.Log; | 10 import android.util.Log; |
| 11 import android.webkit.ValueCallback; | 11 import android.webkit.ValueCallback; |
| 12 | 12 |
| 13 import org.chromium.base.ThreadUtils; | 13 import org.chromium.base.ThreadUtils; |
| 14 import org.chromium.base.annotations.CalledByNative; | 14 import org.chromium.base.annotations.CalledByNative; |
| 15 import org.chromium.base.annotations.CalledByNativeUnchecked; |
| 15 import org.chromium.base.annotations.JNINamespace; | 16 import org.chromium.base.annotations.JNINamespace; |
| 16 | 17 |
| 17 import java.security.Principal; | 18 import java.security.Principal; |
| 18 import java.security.PrivateKey; | 19 import java.security.PrivateKey; |
| 19 import java.security.cert.CertificateEncodingException; | 20 import java.security.cert.CertificateEncodingException; |
| 20 import java.security.cert.X509Certificate; | 21 import java.security.cert.X509Certificate; |
| 21 | 22 |
| 22 import javax.security.auth.x500.X500Principal; | 23 import javax.security.auth.x500.X500Principal; |
| 23 | 24 |
| 24 /** | 25 /** |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 JsResultHandler handler = new JsResultHandler(this, id); | 244 JsResultHandler handler = new JsResultHandler(this, id); |
| 244 mClient.handleJsPrompt(url, message, defaultValue, handler); | 245 mClient.handleJsPrompt(url, message, defaultValue, handler); |
| 245 } | 246 } |
| 246 | 247 |
| 247 @CalledByNative | 248 @CalledByNative |
| 248 private void handleJsBeforeUnload(String url, String message, int id) { | 249 private void handleJsBeforeUnload(String url, String message, int id) { |
| 249 JsResultHandler handler = new JsResultHandler(this, id); | 250 JsResultHandler handler = new JsResultHandler(this, id); |
| 250 mClient.handleJsBeforeUnload(url, message, handler); | 251 mClient.handleJsBeforeUnload(url, message, handler); |
| 251 } | 252 } |
| 252 | 253 |
| 253 @CalledByNative | 254 @CalledByNativeUnchecked |
| 254 private boolean shouldOverrideUrlLoading( | 255 private boolean shouldOverrideUrlLoading( |
| 255 String url, boolean hasUserGesture, boolean isRedirect, boolean isMa
inFrame) { | 256 String url, boolean hasUserGesture, boolean isRedirect, boolean isMa
inFrame) { |
| 256 return mClient.shouldIgnoreNavigation( | 257 return mClient.shouldIgnoreNavigation( |
| 257 mContext, url, isMainFrame, hasUserGesture, isRedirect); | 258 mContext, url, isMainFrame, hasUserGesture, isRedirect); |
| 258 } | 259 } |
| 259 | 260 |
| 260 void confirmJsResult(int id, String prompt) { | 261 void confirmJsResult(int id, String prompt) { |
| 261 if (mNativeContentsClientBridge == 0) return; | 262 if (mNativeContentsClientBridge == 0) return; |
| 262 nativeConfirmJsResult(mNativeContentsClientBridge, id, prompt); | 263 nativeConfirmJsResult(mNativeContentsClientBridge, id, prompt); |
| 263 } | 264 } |
| 264 | 265 |
| 265 void cancelJsResult(int id) { | 266 void cancelJsResult(int id) { |
| 266 if (mNativeContentsClientBridge == 0) return; | 267 if (mNativeContentsClientBridge == 0) return; |
| 267 nativeCancelJsResult(mNativeContentsClientBridge, id); | 268 nativeCancelJsResult(mNativeContentsClientBridge, id); |
| 268 } | 269 } |
| 269 | 270 |
| 270 //--------------------------------------------------------------------------
------------------ | 271 //--------------------------------------------------------------------------
------------------ |
| 271 // Native methods | 272 // Native methods |
| 272 //--------------------------------------------------------------------------
------------------ | 273 //--------------------------------------------------------------------------
------------------ |
| 273 private native void nativeProceedSslError(long nativeAwContentsClientBridge,
boolean proceed, | 274 private native void nativeProceedSslError(long nativeAwContentsClientBridge,
boolean proceed, |
| 274 int id); | 275 int id); |
| 275 private native void nativeProvideClientCertificateResponse(long nativeAwCont
entsClientBridge, | 276 private native void nativeProvideClientCertificateResponse(long nativeAwCont
entsClientBridge, |
| 276 int id, byte[][] certChain, PrivateKey androidKey); | 277 int id, byte[][] certChain, PrivateKey androidKey); |
| 277 | 278 |
| 278 private native void nativeConfirmJsResult(long nativeAwContentsClientBridge,
int id, | 279 private native void nativeConfirmJsResult(long nativeAwContentsClientBridge,
int id, |
| 279 String prompt); | 280 String prompt); |
| 280 private native void nativeCancelJsResult(long nativeAwContentsClientBridge,
int id); | 281 private native void nativeCancelJsResult(long nativeAwContentsClientBridge,
int id); |
| 281 } | 282 } |
| OLD | NEW |