summaryrefslogtreecommitdiffstats
path: root/WebKit/android/jni/WebCoreFrameBridge.cpp
diff options
context:
space:
mode:
authorIain Merrick <husky@google.com>2011-01-07 10:50:51 +0000
committerIain Merrick <husky@google.com>2011-01-20 16:47:02 +0000
commite777e7663bb6cecc72754dbf56e068f5b6ea30d5 (patch)
tree9c26dfd1a53a3628db2e556466e9b40e2a2fcbc8 /WebKit/android/jni/WebCoreFrameBridge.cpp
parentf8833329dde3a45999a9902459abed565896df14 (diff)
downloadexternal_webkit-e777e7663bb6cecc72754dbf56e068f5b6ea30d5.zip
external_webkit-e777e7663bb6cecc72754dbf56e068f5b6ea30d5.tar.gz
external_webkit-e777e7663bb6cecc72754dbf56e068f5b6ea30d5.tar.bz2
Report SSL certificates to WebView.
In the Apache HTTP stack, this is done by LoadListener. This CL plumbs in the same logic for the Chrome HTTP stack. This fixes the WebViewTest#testAccessCertificate CTS test. Bug:3242048 Change-Id: I69a4de46ded59bfdebdd391c4731c7c1a79744fb
Diffstat (limited to 'WebKit/android/jni/WebCoreFrameBridge.cpp')
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp
index c87fb47..5468a1e 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -217,6 +217,7 @@ struct WebFrame::JavaBrowserFrame
jmethodID mDidReceiveAuthenticationChallenge;
jmethodID mReportSslCertError;
jmethodID mDownloadStart;
+ jmethodID mSetCertificate;
AutoJObject frame(JNIEnv* env) {
return getRealObject(env, mObj);
}
@@ -285,6 +286,8 @@ WebFrame::WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page*
mJavaFrame->mReportSslCertError = env->GetMethodID(clazz, "reportSslCertError", "(II[B)V");
mJavaFrame->mDownloadStart = env->GetMethodID(clazz, "downloadStart",
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;J)V");
+ mJavaFrame->mSetCertificate = env->GetMethodID(clazz, "setCertificate",
+ "(Ljava/lang/String;Ljava/lang/String;JJ)V");
env->DeleteLocalRef(clazz);
LOG_ASSERT(mJavaFrame->mStartLoadingResource, "Could not find method startLoadingResource");
@@ -312,6 +315,7 @@ WebFrame::WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page*
LOG_ASSERT(mJavaFrame->mDidReceiveAuthenticationChallenge, "Could not find method didReceiveAuthenticationChallenge");
LOG_ASSERT(mJavaFrame->mReportSslCertError, "Could not find method reportSslCertError");
LOG_ASSERT(mJavaFrame->mDownloadStart, "Could not find method downloadStart");
+ LOG_ASSERT(mJavaFrame->mSetCertificate, "Could not find method setCertificate");
mUserAgent = WTF::String();
mUserInitiatedAction = false;
@@ -911,6 +915,25 @@ WebFrame::downloadStart(const std::string& url, const std::string& userAgent, co
}
#endif
+#if USE(CHROME_NETWORK_STACK)
+void WebFrame::setCertificate(const std::string& issuedTo, const std::string& issuedBy, long long validNotBeforeMillis, long long validNotAfterMillis)
+{
+#ifdef ANDROID_INSTRUMENT
+ TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
+#endif
+ JNIEnv* env = getJNIEnv();
+ jstring jIssuedTo = stdStringToJstring(env, issuedTo, true);
+ jstring jIssuedBy = stdStringToJstring(env, issuedBy, true);
+
+ env->CallVoidMethod(mJavaFrame->frame(env).get(),
+ mJavaFrame->mSetCertificate, jIssuedTo, jIssuedBy, validNotBeforeMillis, validNotAfterMillis);
+
+ env->DeleteLocalRef(jIssuedTo);
+ env->DeleteLocalRef(jIssuedBy);
+ checkException(env);
+}
+#endif
+
void WebFrame::maybeSavePassword(WebCore::Frame* frame, const WebCore::ResourceRequest& request)
{
if (request.httpMethod() != "POST")