OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <limits> | 7 #include <limits> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "android_webview/browser/aw_browser_context.h" | 10 #include "android_webview/browser/aw_browser_context.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 #include "base/strings/string16.h" | 53 #include "base/strings/string16.h" |
54 #include "base/supports_user_data.h" | 54 #include "base/supports_user_data.h" |
55 #include "base/threading/thread_task_runner_handle.h" | 55 #include "base/threading/thread_task_runner_handle.h" |
56 #include "components/autofill/content/browser/content_autofill_driver_factory.h" | 56 #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
57 #include "components/autofill/core/browser/autofill_manager.h" | 57 #include "components/autofill/core/browser/autofill_manager.h" |
58 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 58 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
59 #include "components/navigation_interception/intercept_navigation_delegate.h" | 59 #include "components/navigation_interception/intercept_navigation_delegate.h" |
60 #include "content/public/browser/android/content_view_core.h" | 60 #include "content/public/browser/android/content_view_core.h" |
61 #include "content/public/browser/android/synchronous_compositor.h" | 61 #include "content/public/browser/android/synchronous_compositor.h" |
62 #include "content/public/browser/browser_thread.h" | 62 #include "content/public/browser/browser_thread.h" |
63 #include "content/public/browser/cert_store.h" | |
64 #include "content/public/browser/child_process_security_policy.h" | 63 #include "content/public/browser/child_process_security_policy.h" |
65 #include "content/public/browser/favicon_status.h" | 64 #include "content/public/browser/favicon_status.h" |
66 #include "content/public/browser/message_port_provider.h" | 65 #include "content/public/browser/message_port_provider.h" |
67 #include "content/public/browser/navigation_entry.h" | 66 #include "content/public/browser/navigation_entry.h" |
68 #include "content/public/browser/render_frame_host.h" | 67 #include "content/public/browser/render_frame_host.h" |
69 #include "content/public/browser/render_process_host.h" | 68 #include "content/public/browser/render_process_host.h" |
70 #include "content/public/browser/render_view_host.h" | 69 #include "content/public/browser/render_view_host.h" |
71 #include "content/public/browser/web_contents.h" | 70 #include "content/public/browser/web_contents.h" |
72 #include "content/public/common/mhtml_generation_params.h" | 71 #include "content/public/common/mhtml_generation_params.h" |
73 #include "content/public/common/renderer_preferences.h" | 72 #include "content/public/common/renderer_preferences.h" |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 Java_AwContents_onNewPicture(env, obj); | 761 Java_AwContents_onNewPicture(env, obj); |
763 } | 762 } |
764 } | 763 } |
765 | 764 |
766 base::android::ScopedJavaLocalRef<jbyteArray> AwContents::GetCertificate( | 765 base::android::ScopedJavaLocalRef<jbyteArray> AwContents::GetCertificate( |
767 JNIEnv* env, | 766 JNIEnv* env, |
768 const JavaParamRef<jobject>& obj) { | 767 const JavaParamRef<jobject>& obj) { |
769 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 768 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
770 content::NavigationEntry* entry = | 769 content::NavigationEntry* entry = |
771 web_contents_->GetController().GetLastCommittedEntry(); | 770 web_contents_->GetController().GetLastCommittedEntry(); |
772 if (!entry) | 771 if (!entry || !entry->GetSSL().certificate) |
773 return ScopedJavaLocalRef<jbyteArray>(); | |
774 // Get the certificate | |
775 int cert_id = entry->GetSSL().cert_id; | |
776 scoped_refptr<net::X509Certificate> cert; | |
777 bool ok = content::CertStore::GetInstance()->RetrieveCert(cert_id, &cert); | |
778 if (!ok) | |
779 return ScopedJavaLocalRef<jbyteArray>(); | 772 return ScopedJavaLocalRef<jbyteArray>(); |
780 | 773 |
781 // Convert the certificate and return it | 774 // Convert the certificate and return it |
782 std::string der_string; | 775 std::string der_string; |
783 net::X509Certificate::GetDEREncoded(cert->os_cert_handle(), &der_string); | 776 net::X509Certificate::GetDEREncoded( |
| 777 entry->GetSSL().certificate->os_cert_handle(), &der_string); |
784 return base::android::ToJavaByteArray( | 778 return base::android::ToJavaByteArray( |
785 env, reinterpret_cast<const uint8_t*>(der_string.data()), | 779 env, reinterpret_cast<const uint8_t*>(der_string.data()), |
786 der_string.length()); | 780 der_string.length()); |
787 } | 781 } |
788 | 782 |
789 void AwContents::RequestNewHitTestDataAt(JNIEnv* env, | 783 void AwContents::RequestNewHitTestDataAt(JNIEnv* env, |
790 const JavaParamRef<jobject>& obj, | 784 const JavaParamRef<jobject>& obj, |
791 jfloat x, | 785 jfloat x, |
792 jfloat y, | 786 jfloat y, |
793 jfloat touch_major) { | 787 jfloat touch_major) { |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 int routing_id = new_host->GetRoutingID(); | 1286 int routing_id = new_host->GetRoutingID(); |
1293 // At this point, the current RVH may or may not contain a compositor. So | 1287 // At this point, the current RVH may or may not contain a compositor. So |
1294 // compositor_ may be nullptr, in which case | 1288 // compositor_ may be nullptr, in which case |
1295 // BrowserViewRenderer::DidInitializeCompositor() callback is time when the | 1289 // BrowserViewRenderer::DidInitializeCompositor() callback is time when the |
1296 // new compositor is constructed. | 1290 // new compositor is constructed. |
1297 browser_view_renderer_.SetActiveCompositorID( | 1291 browser_view_renderer_.SetActiveCompositorID( |
1298 CompositorID(process_id, routing_id)); | 1292 CompositorID(process_id, routing_id)); |
1299 } | 1293 } |
1300 | 1294 |
1301 } // namespace android_webview | 1295 } // namespace android_webview |
OLD | NEW |