OLD | NEW |
---|---|
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 Loading... | |
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 |
OLD | NEW |