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

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: updated copyrights 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;
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: ->
936 *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.
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 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
944 ssl_error_callback_.Reset();
945 }
946
947
920 } // namespace android_webview 948 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698