diff options
author | Huahui Wu <hwu@google.com> | 2011-01-26 21:55:20 -0800 |
---|---|---|
committer | Huahui Wu <hwu@google.com> | 2011-01-27 12:54:16 -0800 |
commit | 8576680967155ccad63175f913367b0682c8d43e (patch) | |
tree | baba7905a41f75b48d9dfbae39f30afdf2767d2c /WebKit/android/jni/WebCoreFrameBridge.cpp | |
parent | cc343f9f8fbf14091cc10ebf1df44bb47ada5882 (diff) | |
download | external_webkit-8576680967155ccad63175f913367b0682c8d43e.zip external_webkit-8576680967155ccad63175f913367b0682c8d43e.tar.gz external_webkit-8576680967155ccad63175f913367b0682c8d43e.tar.bz2 |
b/3347670 Support installing online certs to the system keystore.
Requires another CL in framework.
https://android-git.corp.google.com/g/#change,93329
Change-Id: Ie623b55b6580d9761cc7de6b1b1708fbb2f0c633
Diffstat (limited to 'WebKit/android/jni/WebCoreFrameBridge.cpp')
-rw-r--r-- | WebKit/android/jni/WebCoreFrameBridge.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp index 476f017..9780d2d 100644 --- a/WebKit/android/jni/WebCoreFrameBridge.cpp +++ b/WebKit/android/jni/WebCoreFrameBridge.cpp @@ -217,6 +217,8 @@ struct WebFrame::JavaBrowserFrame jmethodID mDidReceiveAuthenticationChallenge; jmethodID mReportSslCertError; jmethodID mDownloadStart; + jmethodID mDidReceiveData; + jmethodID mDidFinishLoading; jmethodID mSetCertificate; AutoJObject frame(JNIEnv* env) { return getRealObject(env, mObj); @@ -286,6 +288,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->mDidReceiveData = env->GetMethodID(clazz, "didReceiveData", "([BI)V"); + mJavaFrame->mDidFinishLoading = env->GetMethodID(clazz, "didFinishLoading", "()V"); mJavaFrame->mSetCertificate = env->GetMethodID(clazz, "setCertificate", "(Ljava/lang/String;Ljava/lang/String;JJ)V"); env->DeleteLocalRef(clazz); @@ -315,6 +319,8 @@ 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->mDidReceiveData, "Could not find method didReceiveData"); + LOG_ASSERT(mJavaFrame->mDidFinishLoading, "Could not find method didFinishLoading"); LOG_ASSERT(mJavaFrame->mSetCertificate, "Could not find method setCertificate"); mUserAgent = WTF::String(); @@ -912,6 +918,35 @@ WebFrame::downloadStart(const std::string& url, const std::string& userAgent, co env->DeleteLocalRef(jMimetype); checkException(env); } + +void +WebFrame::didReceiveData(const char* data, int size) { +#ifdef ANDROID_INSTRUMENT + TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); +#endif + JNIEnv* env = getJNIEnv(); + + jbyteArray jData = env->NewByteArray(size); + jbyte* bytes = env->GetByteArrayElements(jData, NULL); + memcpy(reinterpret_cast<char*>(bytes), data, size); + + env->CallVoidMethod(mJavaFrame->frame(env).get(), + mJavaFrame->mDidReceiveData, jData, size); + env->DeleteLocalRef(jData); + checkException(env); +} + +void +WebFrame::didFinishLoading() { +#ifdef ANDROID_INSTRUMENT + TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); +#endif + JNIEnv* env = getJNIEnv(); + + env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mDidFinishLoading); + checkException(env); +} + #endif #if USE(CHROME_NETWORK_STACK) |