| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/ui/android/ssl_client_certificate_request.h" | 5 #include "chrome/browser/ui/android/ssl_client_certificate_request.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| 11 #include "base/android/jni_string.h" | 11 #include "base/android/jni_string.h" |
| 12 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" | 17 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" |
| 18 #include "chrome/browser/ui/android/view_android_helper.h" | 18 #include "chrome/browser/ui/android/view_android_helper.h" |
| 19 #include "chrome/browser/vr/vr_tab_helper.h" |
| 19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/browser/client_certificate_delegate.h" | 21 #include "content/public/browser/client_certificate_delegate.h" |
| 21 #include "device/vr/features/features.h" | 22 #include "device/vr/features/features.h" |
| 22 #include "jni/SSLClientCertificateRequest_jni.h" | 23 #include "jni/SSLClientCertificateRequest_jni.h" |
| 23 #include "net/base/host_port_pair.h" | 24 #include "net/base/host_port_pair.h" |
| 24 #include "net/cert/cert_database.h" | 25 #include "net/cert/cert_database.h" |
| 25 #include "net/cert/x509_certificate.h" | 26 #include "net/cert/x509_certificate.h" |
| 26 #include "net/ssl/ssl_cert_request_info.h" | 27 #include "net/ssl/ssl_cert_request_info.h" |
| 27 #include "net/ssl/ssl_client_cert_type.h" | 28 #include "net/ssl/ssl_client_cert_type.h" |
| 28 #include "net/ssl/ssl_platform_key_android.h" | 29 #include "net/ssl/ssl_platform_key_android.h" |
| 29 #include "net/ssl/ssl_private_key.h" | 30 #include "net/ssl/ssl_private_key.h" |
| 30 #include "ui/android/view_android.h" | 31 #include "ui/android/view_android.h" |
| 31 #include "ui/android/window_android.h" | 32 #include "ui/android/window_android.h" |
| 32 | 33 |
| 33 #if BUILDFLAG(ENABLE_VR) | |
| 34 #include "chrome/browser/android/vr_shell/vr_tab_helper.h" | |
| 35 #endif // BUILDFLAG(ENABLE_VR) | |
| 36 | |
| 37 using base::android::JavaParamRef; | 34 using base::android::JavaParamRef; |
| 38 using base::android::ScopedJavaLocalRef; | 35 using base::android::ScopedJavaLocalRef; |
| 39 | 36 |
| 40 namespace chrome { | 37 namespace chrome { |
| 41 | 38 |
| 42 namespace { | 39 namespace { |
| 43 | 40 |
| 44 void StartClientCertificateRequest( | 41 void StartClientCertificateRequest( |
| 45 const net::SSLCertRequestInfo* cert_request_info, | 42 const net::SSLCertRequestInfo* cert_request_info, |
| 46 ui::WindowAndroid* window, | 43 ui::WindowAndroid* window, |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 return RegisterNativesImpl(env); | 183 return RegisterNativesImpl(env); |
| 187 } | 184 } |
| 188 | 185 |
| 189 } // namespace android | 186 } // namespace android |
| 190 | 187 |
| 191 void ShowSSLClientCertificateSelector( | 188 void ShowSSLClientCertificateSelector( |
| 192 content::WebContents* contents, | 189 content::WebContents* contents, |
| 193 net::SSLCertRequestInfo* cert_request_info, | 190 net::SSLCertRequestInfo* cert_request_info, |
| 194 net::ClientCertIdentityList unused_client_certs, | 191 net::ClientCertIdentityList unused_client_certs, |
| 195 std::unique_ptr<content::ClientCertificateDelegate> delegate) { | 192 std::unique_ptr<content::ClientCertificateDelegate> delegate) { |
| 196 #if BUILDFLAG(ENABLE_VR) | 193 if (vr::VrTabHelper::IsInVr(contents)) { |
| 197 if (vr_shell::VrTabHelper::IsInVr(contents)) { | |
| 198 delegate->ContinueWithCertificate(nullptr, nullptr); | 194 delegate->ContinueWithCertificate(nullptr, nullptr); |
| 199 return; | 195 return; |
| 200 } | 196 } |
| 201 #endif // BUILDFLAG(ENABLE_VR) | 197 |
| 202 ui::WindowAndroid* window = ViewAndroidHelper::FromWebContents(contents) | 198 ui::WindowAndroid* window = ViewAndroidHelper::FromWebContents(contents) |
| 203 ->GetViewAndroid()->GetWindowAndroid(); | 199 ->GetViewAndroid()->GetWindowAndroid(); |
| 204 DCHECK(window); | 200 DCHECK(window); |
| 205 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 201 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 206 StartClientCertificateRequest(cert_request_info, window, std::move(delegate)); | 202 StartClientCertificateRequest(cert_request_info, window, std::move(delegate)); |
| 207 } | 203 } |
| 208 | 204 |
| 209 } // namespace chrome | 205 } // namespace chrome |
| OLD | NEW |