Commit e0d22b99 authored by Eric Stevenson's avatar Eric Stevenson Committed by Commit Bot

Revert "Revert JNI refactor for AwContentsClientBridge.java"

This reverts commit 91053066.

Reason for revert: Failures fixed by
a0040e3d.

Original change's description:
> Revert JNI refactor for AwContentsClientBridge.java
>
> Reverting whole CL has merge conflicts, so quickly reverting this one
> more known bad file.
>
> NOTRY=true
> NOPRESUBMIT=true
> TBR=estevenson
>
> Bug: 1000471
> Change-Id: Ica8158d081cb4e7c833787e8196e2cbf792093bc
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1786671
> Reviewed-by: Andrew Grieve <agrieve@chromium.org>
> Commit-Queue: Andrew Grieve <agrieve@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#693733}

TBR=agrieve@chromium.org

Bug: 1000471, 1000820
Change-Id: I3a79f8af5236eb411458f85923297a8f5720bcfd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1789684
Commit-Queue: Eric Stevenson <estevenson@chromium.org>
Reviewed-by: default avatarEric Stevenson <estevenson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694253}
parent 531d9bf8
......@@ -14,6 +14,7 @@ import org.chromium.base.Callback;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.CalledByNativeUnchecked;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.base.annotations.NativeMethods;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.task.PostTask;
import org.chromium.content_public.browser.UiThreadTaskTraits;
......@@ -134,8 +135,9 @@ public class AwContentsClientBridge {
private void provideResponse(PrivateKey privateKey, byte[][] certChain) {
if (mNativeContentsClientBridge == 0) return;
nativeProvideClientCertificateResponse(mNativeContentsClientBridge, mId,
certChain, privateKey);
AwContentsClientBridgeJni.get().provideClientCertificateResponse(
mNativeContentsClientBridge, AwContentsClientBridge.this, mId, certChain,
privateKey);
}
}
......@@ -178,7 +180,8 @@ public class AwContentsClientBridge {
private void proceedSslError(boolean proceed, int id) {
if (mNativeContentsClientBridge == 0) return;
nativeProceedSslError(mNativeContentsClientBridge, proceed, id);
AwContentsClientBridgeJni.get().proceedSslError(
mNativeContentsClientBridge, AwContentsClientBridge.this, proceed, id);
}
// Intentionally not private for testing the native peer of this class.
......@@ -188,13 +191,14 @@ public class AwContentsClientBridge {
assert mNativeContentsClientBridge != 0;
ClientCertLookupTable.Cert cert = mLookupTable.getCertData(host, port);
if (mLookupTable.isDenied(host, port)) {
nativeProvideClientCertificateResponse(mNativeContentsClientBridge, id,
null, null);
AwContentsClientBridgeJni.get().provideClientCertificateResponse(
mNativeContentsClientBridge, AwContentsClientBridge.this, id, null, null);
return;
}
if (cert != null) {
nativeProvideClientCertificateResponse(mNativeContentsClientBridge, id,
cert.mCertChain, cert.mPrivateKey);
AwContentsClientBridgeJni.get().provideClientCertificateResponse(
mNativeContentsClientBridge, AwContentsClientBridge.this, id, cert.mCertChain,
cert.mPrivateKey);
return;
}
// Build the list of principals from encoded versions.
......@@ -206,8 +210,9 @@ public class AwContentsClientBridge {
principals[n] = new X500Principal(encodedPrincipals[n]);
} catch (IllegalArgumentException e) {
Log.w(TAG, "Exception while decoding issuers list: " + e);
nativeProvideClientCertificateResponse(mNativeContentsClientBridge, id,
null, null);
AwContentsClientBridgeJni.get().provideClientCertificateResponse(
mNativeContentsClientBridge, AwContentsClientBridge.this, id, null,
null);
return;
}
}
......@@ -349,7 +354,8 @@ public class AwContentsClientBridge {
// clang-format off
Callback<AwSafeBrowsingResponse> callback =
response -> PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT,
() -> nativeTakeSafeBrowsingAction(mNativeContentsClientBridge,
() -> AwContentsClientBridgeJni.get().takeSafeBrowsingAction(
mNativeContentsClientBridge, AwContentsClientBridge.this,
response.action(), response.reporting(), requestId));
// clang-format on
......@@ -404,25 +410,28 @@ public class AwContentsClientBridge {
void confirmJsResult(int id, String prompt) {
if (mNativeContentsClientBridge == 0) return;
nativeConfirmJsResult(mNativeContentsClientBridge, id, prompt);
AwContentsClientBridgeJni.get().confirmJsResult(
mNativeContentsClientBridge, AwContentsClientBridge.this, id, prompt);
}
void cancelJsResult(int id) {
if (mNativeContentsClientBridge == 0) return;
nativeCancelJsResult(mNativeContentsClientBridge, id);
AwContentsClientBridgeJni.get().cancelJsResult(
mNativeContentsClientBridge, AwContentsClientBridge.this, id);
}
//--------------------------------------------------------------------------------------------
// Native methods
//--------------------------------------------------------------------------------------------
private native void nativeTakeSafeBrowsingAction(
long nativeAwContentsClientBridge, int action, boolean reporting, int requestId);
private native void nativeProceedSslError(long nativeAwContentsClientBridge, boolean proceed,
int id);
private native void nativeProvideClientCertificateResponse(long nativeAwContentsClientBridge,
int id, byte[][] certChain, PrivateKey androidKey);
private native void nativeConfirmJsResult(long nativeAwContentsClientBridge, int id,
String prompt);
private native void nativeCancelJsResult(long nativeAwContentsClientBridge, int id);
@NativeMethods
interface Natives {
void takeSafeBrowsingAction(long nativeAwContentsClientBridge,
AwContentsClientBridge caller, int action, boolean reporting, int requestId);
void proceedSslError(long nativeAwContentsClientBridge, AwContentsClientBridge caller,
boolean proceed, int id);
void provideClientCertificateResponse(long nativeAwContentsClientBridge,
AwContentsClientBridge caller, int id, byte[][] certChain, PrivateKey androidKey);
void confirmJsResult(long nativeAwContentsClientBridge, AwContentsClientBridge caller,
int id, String prompt);
void cancelJsResult(
long nativeAwContentsClientBridge, AwContentsClientBridge caller, int id);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment