OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/ssl/ssl_add_certificate.h" | |
6 | |
7 #include "chrome/browser/ssl/ssl_add_cert_handler.h" | |
8 #include "net/base/x509_certificate.h" | |
9 | |
10 void chrome::SSLAddCertificate( | |
darin (slow to review)
2012/11/26 19:53:43
nit: use "namespace chrome {" instead.
digit1
2012/11/26 21:41:35
Done.
| |
11 net::URLRequest* request, | |
12 net::CertificateType cert_type, | |
13 const void* cert_data, | |
14 size_t cert_size, | |
15 int render_process_id, | |
16 int render_view_id) { | |
17 // Chromium only supports X.509 User certificates on non-Android | |
18 // platforms. Note that this method should not be called for other | |
19 // certificate types. See net::GetCertificateTypeFromMimeType(). | |
20 if (cert_type == net::CERTIFICATE_TYPE_X509_USER_CERT) { | |
darin (slow to review)
2012/11/26 19:53:43
nit: how about returning early when cert_type is n
digit1
2012/11/26 21:41:35
Done.
| |
21 scoped_refptr<net::X509Certificate> cert; | |
22 if (cert_data != NULL) { | |
23 cert = net::X509Certificate::CreateFromBytes( | |
darin (slow to review)
2012/11/26 19:53:43
nit: indentation is wrong here
digit1
2012/11/26 21:41:35
Done.
| |
24 reinterpret_cast<const char*>(cert_data), cert_size); | |
25 } | |
26 // NOTE: Passing a NULL cert pointer if |cert_data| was NULL is | |
27 // intentional here. | |
28 | |
29 // The handler will run the UI and delete itself when it's finished. | |
30 new SSLAddCertHandler(request, cert, render_process_id, render_view_id); | |
31 } | |
32 } | |
OLD | NEW |