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 "chrome/browser/ssl/ssl_add_certificate.h" | 5 #include "chrome/browser/ssl/ssl_add_certificate.h" |
6 | 6 |
7 #include "net/android/network_library.h" | 7 #include "net/android/network_library.h" |
8 | 8 |
9 namespace chrome { | 9 namespace chrome { |
10 | 10 |
11 // Special case for Android here for several reasons: | 11 // Special case for Android here for several reasons: |
12 // | 12 // |
13 // - The SSLAddCertHandler implementation currently only supports | 13 // - The SSLAddCertHandler implementation currently only supports |
14 // CERTIFICATE_TYPE_X509_USER_CERT, but not other types, like | 14 // CERTIFICATE_TYPE_X509_USER_CERT, but not other types, like |
15 // CERTIFICATE_TYPE_PKCS12_ARCHIVE which are required on this | 15 // CERTIFICATE_TYPE_PKCS12_ARCHIVE which are required on this |
16 // platform. | 16 // platform. |
17 // | 17 // |
18 // - Besides, SSLAddCertHandler tries to parse the certificate | 18 // - Besides, SSLAddCertHandler tries to parse the certificate |
19 // by calling net::CertDatabase::CheckUserCert() which is not | 19 // by calling net::CertDatabase::CheckUserCert() which is not |
20 // implemented on Android, mainly because there is no API | 20 // implemented on Android, mainly because there is no API |
21 // provided by the system to do that properly. | 21 // provided by the system to do that properly. |
22 // | 22 // |
23 // - The Android CertInstaller activity will check the certificate file | 23 // - The Android CertInstaller activity will check the certificate file |
24 // and display a toast (small fading dialog) to the user if it is | 24 // and display a toast (small fading dialog) to the user if it is |
25 // not valid, so the UI performed by SSLAddCertHandler would | 25 // not valid, so the UI performed by SSLAddCertHandler would |
26 // be redundant. | 26 // be redundant. |
27 void SSLAddCertificate( | 27 void SSLAddCertificate( |
28 net::URLRequest* /* request */, | |
29 net::CertificateMimeType cert_type, | 28 net::CertificateMimeType cert_type, |
30 const void* cert_data, | 29 const void* cert_data, |
31 size_t cert_size, | 30 size_t cert_size, |
32 int /* render_process_id */, | 31 int /* render_process_id */, |
33 int /* render_view_id */) { | 32 int /* render_view_id */) { |
34 if (cert_size > 0) { | 33 if (cert_size > 0) { |
35 // This launches a new activity which will run in a different process. | 34 // This launches a new activity which will run in a different process. |
36 // It handles all user interaction, so no need to do anything in the | 35 // It handles all user interaction, so no need to do anything in the |
37 // browser UI thread here. | 36 // browser UI thread here. |
38 net::android::StoreCertificate(cert_type, cert_data, cert_size); | 37 net::android::StoreCertificate(cert_type, cert_data, cert_size); |
39 } | 38 } |
40 } | 39 } |
41 | 40 |
42 } // namespace chrome | 41 } // namespace chrome |
OLD | NEW |