Index: chrome/browser/ssl/ssl_add_certificate.cc |
diff --git a/chrome/browser/ssl/ssl_add_certificate.cc b/chrome/browser/ssl/ssl_add_certificate.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..655c7f4cf6250fd923e7cbec5332d26b4ffac4b8 |
--- /dev/null |
+++ b/chrome/browser/ssl/ssl_add_certificate.cc |
@@ -0,0 +1,32 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/ssl/ssl_add_certificate.h" |
+ |
+#include "chrome/browser/ssl/ssl_add_cert_handler.h" |
+#include "net/base/x509_certificate.h" |
+ |
+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.
|
+ net::URLRequest* request, |
+ net::CertificateType cert_type, |
+ const void* cert_data, |
+ size_t cert_size, |
+ int render_process_id, |
+ int render_view_id) { |
+ // Chromium only supports X.509 User certificates on non-Android |
+ // platforms. Note that this method should not be called for other |
+ // certificate types. See net::GetCertificateTypeFromMimeType(). |
+ 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.
|
+ scoped_refptr<net::X509Certificate> cert; |
+ if (cert_data != NULL) { |
+ 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.
|
+ reinterpret_cast<const char*>(cert_data), cert_size); |
+ } |
+ // NOTE: Passing a NULL cert pointer if |cert_data| was NULL is |
+ // intentional here. |
+ |
+ // The handler will run the UI and delete itself when it's finished. |
+ new SSLAddCertHandler(request, cert, render_process_id, render_view_id); |
+ } |
+} |