Index: android_webview/native/aw_contents.cc |
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc |
index f170e4927ac7041ee9ce4006daaf45e2d441da1d..c46118299e19b16ad2bebdf4e70add2990700772 100644 |
--- a/android_webview/native/aw_contents.cc |
+++ b/android_webview/native/aw_contents.cc |
@@ -917,4 +917,36 @@ void AwContents::OnPictureUpdated(int process_id, int render_view_id) { |
Invalidate(); |
} |
+void AwContents::AllowCertificateError( |
+ int cert_error, |
+ net::X509Certificate* cert, |
+ const GURL& request_url, |
+ const base::Callback<void(bool)>& callback, |
+ bool* cancel_request) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ JNIEnv* env = AttachCurrentThread(); |
+ |
+ std::string der_string; |
+ net::X509Certificate::GetDEREncoded(cert->os_cert_handle(),&der_string); |
+ ScopedJavaLocalRef<jbyteArray> jcert = base::android::ToJavaByteArray(env, |
+ reinterpret_cast<const uint8*>(der_string.data()), der_string.length()); |
+ ScopedJavaLocalRef<jstring> jurl(ConvertUTF8ToJavaString( |
+ env, request_url.spec())); |
+ ssl_error_callback_ = callback; |
+ *cancel_request = Java_AwContents_cancelCertificateError(env, |
boliu
2013/02/01 23:07:13
Would the old name but with a negation here be bet
sgurun-gerrit only
2013/02/02 01:01:10
I think the name is very clear. Why make it compli
boliu
2013/02/02 01:10:42
There is a convention to match the method name all
|
+ java_ref_.get(env).obj(), reinterpret_cast<jint>(cert_error), jcert.obj(), |
+ jurl.obj()); |
+} |
+ |
+void AwContents::ProceedSslError(JNIEnv* env, jobject obj, jboolean proceed) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ if (ssl_error_callback_.is_null()) { |
+ LOG(WARNING) << "Ignoring unexpected ssl error proceed callback"; |
+ return; |
+ } |
+ ssl_error_callback_.Run(proceed); |
+ ssl_error_callback_.Reset(); |
+} |
+ |
+ |
} // namespace android_webview |