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/chromeos/cros/cert_library.h" | 5 #include "chrome/browser/chromeos/cros/cert_library.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/chromeos/chromeos_version.h" | 9 #include "base/chromeos/chromeos_version.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 // static | 528 // static |
529 CertLibrary* CertLibrary::GetImpl(bool stub) { | 529 CertLibrary* CertLibrary::GetImpl(bool stub) { |
530 // |stub| is ignored since we have no stub of CertLibrary. | 530 // |stub| is ignored since we have no stub of CertLibrary. |
531 // TODO(stevenjb): Disassociate CertLibrary from CrosLibrary entirely. | 531 // TODO(stevenjb): Disassociate CertLibrary from CrosLibrary entirely. |
532 // crbug.com/133752 | 532 // crbug.com/133752 |
533 return new CertLibraryImpl(); | 533 return new CertLibraryImpl(); |
534 } | 534 } |
535 | 535 |
536 ////////////////////////////////////////////////////////////////////////////// | 536 ////////////////////////////////////////////////////////////////////////////// |
537 | 537 |
| 538 CertLibrary::CertList::CertList(CertLibrary* library) |
| 539 : cert_library_(library) { |
| 540 } |
| 541 |
| 542 CertLibrary::CertList::~CertList() {} |
| 543 |
538 net::X509Certificate* CertLibrary::CertList::GetCertificateAt(int index) const { | 544 net::X509Certificate* CertLibrary::CertList::GetCertificateAt(int index) const { |
539 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 545 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
540 DCHECK_GE(index, 0); | 546 DCHECK_GE(index, 0); |
541 DCHECK_LT(index, static_cast<int>(list_.size())); | 547 DCHECK_LT(index, static_cast<int>(list_.size())); |
542 return list_[index].get(); | 548 return list_[index].get(); |
543 } | 549 } |
544 | 550 |
545 string16 CertLibrary::CertList::GetDisplayStringAt(int index) const { | 551 string16 CertLibrary::CertList::GetDisplayStringAt(int index) const { |
546 net::X509Certificate* cert = GetCertificateAt(index); | 552 net::X509Certificate* cert = GetCertificateAt(index); |
547 bool hardware_backed = | 553 bool hardware_backed = |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 net::X509Certificate* cert = GetCertificateAt(index); | 590 net::X509Certificate* cert = GetCertificateAt(index); |
585 net::X509Certificate::OSCertHandle cert_handle = cert->os_cert_handle(); | 591 net::X509Certificate::OSCertHandle cert_handle = cert->os_cert_handle(); |
586 std::string id = x509_certificate_model::GetPkcs11Id(cert_handle); | 592 std::string id = x509_certificate_model::GetPkcs11Id(cert_handle); |
587 if (id == pkcs11_id) | 593 if (id == pkcs11_id) |
588 return index; | 594 return index; |
589 } | 595 } |
590 return -1; // Not found. | 596 return -1; // Not found. |
591 } | 597 } |
592 | 598 |
593 } // chromeos | 599 } // chromeos |
OLD | NEW |