Chromium Code Reviews| 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..8af9c03dc7c21631384846a28734c639002fbdc6 100644 |
| --- a/android_webview/native/aw_contents.cc |
| +++ b/android_webview/native/aw_contents.cc |
| @@ -917,4 +917,32 @@ 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; |
|
Kristian Monsen
2013/02/01 20:51:12
Can there be more than one of these at the same ti
sgurun-gerrit only
2013/02/01 22:08:00
No, it seems AllowCertificateError is called only
boliu
2013/02/01 23:07:13
Actually I just noticed this, can I get in the loo
Kristian Monsen
2013/02/01 23:20:37
Right, I think this can happen. And if we add:
->
|
| + *cancel_request = (bool)Java_AwContents_allowCertificateError(env, |
|
boliu
2013/02/01 20:03:23
This shouldn't require a cast (also if it does, us
sgurun-gerrit only
2013/02/01 22:08:00
Done.
|
| + 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)); |
| + ssl_error_callback_.Run(proceed); |
|
Kristian Monsen
2013/02/01 20:51:12
Should probably check this is a valid callback poi
sgurun-gerrit only
2013/02/01 22:08:00
good idea.
On 2013/02/01 20:51:12, Kristian Monsen
|
| + ssl_error_callback_.Reset(); |
| +} |
| + |
| + |
| } // namespace android_webview |