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

Unified Diff: android_webview/native/aw_contents.cc

Issue 12091111: Implement Webviewclient.onReceivedSslError (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated copyrights Created 7 years, 11 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/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

Powered by Google App Engine
This is Rietveld 408576698