Commit 91053066 authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

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/+/1786671Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693733}
parent 4b7c4d01
...@@ -14,7 +14,6 @@ import org.chromium.base.Callback; ...@@ -14,7 +14,6 @@ import org.chromium.base.Callback;
import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.CalledByNativeUnchecked; import org.chromium.base.annotations.CalledByNativeUnchecked;
import org.chromium.base.annotations.JNINamespace; import org.chromium.base.annotations.JNINamespace;
import org.chromium.base.annotations.NativeMethods;
import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.task.PostTask; import org.chromium.base.task.PostTask;
import org.chromium.content_public.browser.UiThreadTaskTraits; import org.chromium.content_public.browser.UiThreadTaskTraits;
...@@ -135,9 +134,8 @@ public class AwContentsClientBridge { ...@@ -135,9 +134,8 @@ public class AwContentsClientBridge {
private void provideResponse(PrivateKey privateKey, byte[][] certChain) { private void provideResponse(PrivateKey privateKey, byte[][] certChain) {
if (mNativeContentsClientBridge == 0) return; if (mNativeContentsClientBridge == 0) return;
AwContentsClientBridgeJni.get().provideClientCertificateResponse( nativeProvideClientCertificateResponse(mNativeContentsClientBridge, mId,
mNativeContentsClientBridge, AwContentsClientBridge.this, mId, certChain, certChain, privateKey);
privateKey);
} }
} }
...@@ -180,8 +178,7 @@ public class AwContentsClientBridge { ...@@ -180,8 +178,7 @@ public class AwContentsClientBridge {
private void proceedSslError(boolean proceed, int id) { private void proceedSslError(boolean proceed, int id) {
if (mNativeContentsClientBridge == 0) return; if (mNativeContentsClientBridge == 0) return;
AwContentsClientBridgeJni.get().proceedSslError( nativeProceedSslError(mNativeContentsClientBridge, proceed, id);
mNativeContentsClientBridge, AwContentsClientBridge.this, proceed, id);
} }
// Intentionally not private for testing the native peer of this class. // Intentionally not private for testing the native peer of this class.
...@@ -191,14 +188,13 @@ public class AwContentsClientBridge { ...@@ -191,14 +188,13 @@ public class AwContentsClientBridge {
assert mNativeContentsClientBridge != 0; assert mNativeContentsClientBridge != 0;
ClientCertLookupTable.Cert cert = mLookupTable.getCertData(host, port); ClientCertLookupTable.Cert cert = mLookupTable.getCertData(host, port);
if (mLookupTable.isDenied(host, port)) { if (mLookupTable.isDenied(host, port)) {
AwContentsClientBridgeJni.get().provideClientCertificateResponse( nativeProvideClientCertificateResponse(mNativeContentsClientBridge, id,
mNativeContentsClientBridge, AwContentsClientBridge.this, id, null, null); null, null);
return; return;
} }
if (cert != null) { if (cert != null) {
AwContentsClientBridgeJni.get().provideClientCertificateResponse( nativeProvideClientCertificateResponse(mNativeContentsClientBridge, id,
mNativeContentsClientBridge, AwContentsClientBridge.this, id, cert.mCertChain, cert.mCertChain, cert.mPrivateKey);
cert.mPrivateKey);
return; return;
} }
// Build the list of principals from encoded versions. // Build the list of principals from encoded versions.
...@@ -210,9 +206,8 @@ public class AwContentsClientBridge { ...@@ -210,9 +206,8 @@ public class AwContentsClientBridge {
principals[n] = new X500Principal(encodedPrincipals[n]); principals[n] = new X500Principal(encodedPrincipals[n]);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
Log.w(TAG, "Exception while decoding issuers list: " + e); Log.w(TAG, "Exception while decoding issuers list: " + e);
AwContentsClientBridgeJni.get().provideClientCertificateResponse( nativeProvideClientCertificateResponse(mNativeContentsClientBridge, id,
mNativeContentsClientBridge, AwContentsClientBridge.this, id, null, null, null);
null);
return; return;
} }
} }
...@@ -354,8 +349,7 @@ public class AwContentsClientBridge { ...@@ -354,8 +349,7 @@ public class AwContentsClientBridge {
// clang-format off // clang-format off
Callback<AwSafeBrowsingResponse> callback = Callback<AwSafeBrowsingResponse> callback =
response -> PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT, response -> PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT,
() -> AwContentsClientBridgeJni.get().takeSafeBrowsingAction( () -> nativeTakeSafeBrowsingAction(mNativeContentsClientBridge,
mNativeContentsClientBridge, AwContentsClientBridge.this,
response.action(), response.reporting(), requestId)); response.action(), response.reporting(), requestId));
// clang-format on // clang-format on
...@@ -410,28 +404,25 @@ public class AwContentsClientBridge { ...@@ -410,28 +404,25 @@ public class AwContentsClientBridge {
void confirmJsResult(int id, String prompt) { void confirmJsResult(int id, String prompt) {
if (mNativeContentsClientBridge == 0) return; if (mNativeContentsClientBridge == 0) return;
AwContentsClientBridgeJni.get().confirmJsResult( nativeConfirmJsResult(mNativeContentsClientBridge, id, prompt);
mNativeContentsClientBridge, AwContentsClientBridge.this, id, prompt);
} }
void cancelJsResult(int id) { void cancelJsResult(int id) {
if (mNativeContentsClientBridge == 0) return; if (mNativeContentsClientBridge == 0) return;
AwContentsClientBridgeJni.get().cancelJsResult( nativeCancelJsResult(mNativeContentsClientBridge, id);
mNativeContentsClientBridge, AwContentsClientBridge.this, id);
} }
@NativeMethods //--------------------------------------------------------------------------------------------
interface Natives { // Native methods
void takeSafeBrowsingAction(long nativeAwContentsClientBridge, //--------------------------------------------------------------------------------------------
AwContentsClientBridge caller, int action, boolean reporting, int requestId); private native void nativeTakeSafeBrowsingAction(
long nativeAwContentsClientBridge, int action, boolean reporting, int requestId);
void proceedSslError(long nativeAwContentsClientBridge, AwContentsClientBridge caller, private native void nativeProceedSslError(long nativeAwContentsClientBridge, boolean proceed,
boolean proceed, int id); int id);
void provideClientCertificateResponse(long nativeAwContentsClientBridge, private native void nativeProvideClientCertificateResponse(long nativeAwContentsClientBridge,
AwContentsClientBridge caller, int id, byte[][] certChain, PrivateKey androidKey); int id, byte[][] certChain, PrivateKey androidKey);
void confirmJsResult(long nativeAwContentsClientBridge, AwContentsClientBridge caller,
int id, String prompt); private native void nativeConfirmJsResult(long nativeAwContentsClientBridge, int id,
void cancelJsResult( String prompt);
long nativeAwContentsClientBridge, AwContentsClientBridge caller, int id); private native void nativeCancelJsResult(long nativeAwContentsClientBridge, 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