| 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.os.Handler; |
| 10 import android.util.Log; | 11 import android.util.Log; |
| 11 import android.webkit.ValueCallback; | 12 import android.webkit.ValueCallback; |
| 12 | 13 |
| 13 import org.chromium.base.ThreadUtils; | 14 import org.chromium.base.ThreadUtils; |
| 14 import org.chromium.base.annotations.CalledByNative; | 15 import org.chromium.base.annotations.CalledByNative; |
| 15 import org.chromium.base.annotations.CalledByNativeUnchecked; | 16 import org.chromium.base.annotations.CalledByNativeUnchecked; |
| 16 import org.chromium.base.annotations.JNINamespace; | 17 import org.chromium.base.annotations.JNINamespace; |
| 17 import org.chromium.net.NetError; | 18 import org.chromium.net.NetError; |
| 18 | 19 |
| 19 import java.security.Principal; | 20 import java.security.Principal; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 225 } |
| 225 | 226 |
| 226 } | 227 } |
| 227 | 228 |
| 228 final ClientCertificateRequestCallback callback = | 229 final ClientCertificateRequestCallback callback = |
| 229 new ClientCertificateRequestCallback(id, host, port); | 230 new ClientCertificateRequestCallback(id, host, port); |
| 230 mClient.onReceivedClientCertRequest(callback, keyTypes, principals, host
, port); | 231 mClient.onReceivedClientCertRequest(callback, keyTypes, principals, host
, port); |
| 231 } | 232 } |
| 232 | 233 |
| 233 @CalledByNative | 234 @CalledByNative |
| 234 private void handleJsAlert(String url, String message, int id) { | 235 private void handleJsAlert(final String url, final String message, final int
id) { |
| 235 JsResultHandler handler = new JsResultHandler(this, id); | 236 // Post the application callback back to the current thread to ensure th
e application |
| 236 mClient.handleJsAlert(url, message, handler); | 237 // callback is executed without any native code on the stack. This so th
at any exception |
| 238 // thrown by the application callback won't have to be propagated throug
h a native call |
| 239 // stack. |
| 240 new Handler().post(new Runnable() { |
| 241 @Override |
| 242 public void run() { |
| 243 JsResultHandler handler = new JsResultHandler(AwContentsClientBr
idge.this, id); |
| 244 mClient.handleJsAlert(url, message, handler); |
| 245 } |
| 246 }); |
| 237 } | 247 } |
| 238 | 248 |
| 239 @CalledByNative | 249 @CalledByNative |
| 240 private void handleJsConfirm(String url, String message, int id) { | 250 private void handleJsConfirm(final String url, final String message, final i
nt id) { |
| 241 JsResultHandler handler = new JsResultHandler(this, id); | 251 // Post the application callback back to the current thread to ensure th
e application |
| 242 mClient.handleJsConfirm(url, message, handler); | 252 // callback is executed without any native code on the stack. This so th
at any exception |
| 253 // thrown by the application callback won't have to be propagated throug
h a native call |
| 254 // stack. |
| 255 new Handler().post(new Runnable() { |
| 256 @Override |
| 257 public void run() { |
| 258 JsResultHandler handler = new JsResultHandler(AwContentsClientBr
idge.this, id); |
| 259 mClient.handleJsConfirm(url, message, handler); |
| 260 } |
| 261 }); |
| 243 } | 262 } |
| 244 | 263 |
| 245 @CalledByNative | 264 @CalledByNative |
| 246 private void handleJsPrompt(String url, String message, String defaultValue,
int id) { | 265 private void handleJsPrompt( |
| 247 JsResultHandler handler = new JsResultHandler(this, id); | 266 final String url, final String message, final String defaultValue, f
inal int id) { |
| 248 mClient.handleJsPrompt(url, message, defaultValue, handler); | 267 // Post the application callback back to the current thread to ensure th
e application |
| 268 // callback is executed without any native code on the stack. This so th
at any exception |
| 269 // thrown by the application callback won't have to be propagated throug
h a native call |
| 270 // stack. |
| 271 new Handler().post(new Runnable() { |
| 272 @Override |
| 273 public void run() { |
| 274 JsResultHandler handler = new JsResultHandler(AwContentsClientBr
idge.this, id); |
| 275 mClient.handleJsPrompt(url, message, defaultValue, handler); |
| 276 } |
| 277 }); |
| 249 } | 278 } |
| 250 | 279 |
| 251 @CalledByNative | 280 @CalledByNative |
| 252 private void handleJsBeforeUnload(String url, String message, int id) { | 281 private void handleJsBeforeUnload(String url, String message, int id) { |
| 253 JsResultHandler handler = new JsResultHandler(this, id); | 282 JsResultHandler handler = new JsResultHandler(this, id); |
| 254 mClient.handleJsBeforeUnload(url, message, handler); | 283 mClient.handleJsBeforeUnload(url, message, handler); |
| 255 } | 284 } |
| 256 | 285 |
| 257 @CalledByNative | 286 @CalledByNative |
| 258 private void newDownload(String url, String userAgent, String contentDisposi
tion, | 287 private void newDownload(String url, String userAgent, String contentDisposi
tion, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 //--------------------------------------------------------------------------
------------------ | 397 //--------------------------------------------------------------------------
------------------ |
| 369 private native void nativeProceedSslError(long nativeAwContentsClientBridge,
boolean proceed, | 398 private native void nativeProceedSslError(long nativeAwContentsClientBridge,
boolean proceed, |
| 370 int id); | 399 int id); |
| 371 private native void nativeProvideClientCertificateResponse(long nativeAwCont
entsClientBridge, | 400 private native void nativeProvideClientCertificateResponse(long nativeAwCont
entsClientBridge, |
| 372 int id, byte[][] certChain, PrivateKey androidKey); | 401 int id, byte[][] certChain, PrivateKey androidKey); |
| 373 | 402 |
| 374 private native void nativeConfirmJsResult(long nativeAwContentsClientBridge,
int id, | 403 private native void nativeConfirmJsResult(long nativeAwContentsClientBridge,
int id, |
| 375 String prompt); | 404 String prompt); |
| 376 private native void nativeCancelJsResult(long nativeAwContentsClientBridge,
int id); | 405 private native void nativeCancelJsResult(long nativeAwContentsClientBridge,
int id); |
| 377 } | 406 } |
| OLD | NEW |