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

Side by Side 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: address code review Created 7 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "android_webview/native/aw_contents.h" 5 #include "android_webview/native/aw_contents.h"
6 6
7 #include <sys/system_properties.h> 7 #include <sys/system_properties.h>
8 8
9 #include "android_webview/browser/aw_browser_context.h" 9 #include "android_webview/browser/aw_browser_context.h"
10 #include "android_webview/browser/aw_browser_main_parts.h" 10 #include "android_webview/browser/aw_browser_main_parts.h"
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 void AwContents::OnPictureUpdated(int process_id, int render_view_id) { 910 void AwContents::OnPictureUpdated(int process_id, int render_view_id) {
911 CHECK_EQ(web_contents_->GetRenderProcessHost()->GetID(), process_id); 911 CHECK_EQ(web_contents_->GetRenderProcessHost()->GetID(), process_id);
912 if (render_view_id != web_contents_->GetRoutingID()) 912 if (render_view_id != web_contents_->GetRoutingID())
913 return; 913 return;
914 914
915 // TODO(leandrogracia): delete when sw rendering uses Ubercompositor. 915 // TODO(leandrogracia): delete when sw rendering uses Ubercompositor.
916 // Invalidation should be provided by the compositor only. 916 // Invalidation should be provided by the compositor only.
917 Invalidate(); 917 Invalidate();
918 } 918 }
919 919
920 void AwContents::AllowCertificateError(
921 int cert_error,
922 net::X509Certificate* cert,
923 const GURL& request_url,
924 const base::Callback<void(bool)>& callback,
925 bool* cancel_request) {
926 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
927 JNIEnv* env = AttachCurrentThread();
928
929 std::string der_string;
930 net::X509Certificate::GetDEREncoded(cert->os_cert_handle(),&der_string);
931 ScopedJavaLocalRef<jbyteArray> jcert = base::android::ToJavaByteArray(env,
932 reinterpret_cast<const uint8*>(der_string.data()), der_string.length());
933 ScopedJavaLocalRef<jstring> jurl(ConvertUTF8ToJavaString(
934 env, request_url.spec()));
935 ssl_error_callback_ = callback;
936 *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
937 java_ref_.get(env).obj(), reinterpret_cast<jint>(cert_error), jcert.obj(),
938 jurl.obj());
939 }
940
941 void AwContents::ProceedSslError(JNIEnv* env, jobject obj, jboolean proceed) {
942 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
943 if (ssl_error_callback_.is_null()) {
944 LOG(WARNING) << "Ignoring unexpected ssl error proceed callback";
945 return;
946 }
947 ssl_error_callback_.Run(proceed);
948 ssl_error_callback_.Reset();
949 }
950
951
920 } // namespace android_webview 952 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698