Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1717)

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 12091111: Implement Webviewclient.onReceivedSslError (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wasting time... Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: android_webview/java/src/org/chromium/android_webview/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index bbd07b407a628eb04a42acfaedc8b2be335062c3..50fafe66291fd8108bee5ed24786463241519138 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -36,17 +36,12 @@ import org.chromium.content.common.CleanupReference;
import org.chromium.components.navigation_interception.InterceptNavigationDelegate;
import org.chromium.components.navigation_interception.NavigationParams;
import org.chromium.net.GURLUtils;
-import org.chromium.net.X509Util;
import org.chromium.ui.gfx.DeviceDisplayInfo;
import org.chromium.ui.gfx.NativeWindow;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
/**
* Exposes the native AwContents class, and together these classes wrap the ContentViewCore
@@ -94,6 +89,7 @@ public class AwContents {
private ViewGroup mContainerView;
private ContentViewCore mContentViewCore;
private AwContentsClient mContentsClient;
+ private AwContentsClientBridge mContentsClientBridge;
private AwContentsIoThreadClient mIoThreadClient;
private InterceptNavigationDelegateImpl mInterceptNavigationDelegate;
private InternalAccessDelegate mInternalAccessAdapter;
@@ -241,7 +237,9 @@ public class AwContents {
// setup performs process initialisation work needed by AwContents.
mContentViewCore = new ContentViewCore(containerView.getContext(),
ContentViewCore.PERSONALITY_VIEW);
- mNativeAwContents = nativeInit(contentsClient.getWebContentsDelegate());
+ mContentsClientBridge = new AwContentsClientBridge(contentsClient);
+ mNativeAwContents = nativeInit(contentsClient.getWebContentsDelegate(),
+ mContentsClientBridge);
mContentsClient = contentsClient;
mCleanupReference = new CleanupReference(this, new DestroyRunnable(mNativeAwContents));
@@ -608,29 +606,7 @@ public class AwContents {
*/
public SslCertificate getCertificate() {
if (mNativeAwContents == 0) return null;
- byte[] derBytes = nativeGetCertificate(mNativeAwContents);
- if (derBytes == null) {
- return null;
- }
-
- try {
- X509Certificate x509Certificate =
- X509Util.createCertificateFromBytes(derBytes);
- return new SslCertificate(x509Certificate);
- } catch (CertificateException e) {
- // Intentional fall through
- // A SSL related exception must have occured. This shouldn't happen.
- Log.w(TAG, "Could not read certificate: " + e);
- } catch (KeyStoreException e) {
- // Intentional fall through
- // A SSL related exception must have occured. This shouldn't happen.
- Log.w(TAG, "Could not read certificate: " + e);
- } catch (NoSuchAlgorithmException e) {
- // Intentional fall through
- // A SSL related exception must have occured. This shouldn't happen.
- Log.w(TAG, "Could not read certificate: " + e);
- }
- return null;
+ return SslUtil.getCertificateFromDerBytes(nativeGetCertificate(mNativeAwContents));
}
/**
@@ -1021,7 +997,8 @@ public class AwContents {
// Native methods
//--------------------------------------------------------------------------------------------
- private native int nativeInit(AwWebContentsDelegate webViewWebContentsDelegate);
+ private native int nativeInit(AwWebContentsDelegate webViewWebContentsDelegate,
+ AwContentsClientBridge contentsClientBridge);
private static native void nativeDestroy(int nativeAwContents);
private static native void nativeSetAwDrawSWFunctionTable(int functionTablePointer);
private static native int nativeGetAwDrawGLFunction();

Powered by Google App Engine
This is Rietveld 408576698