| 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 ////////////////////////////////////////////////////////////////////////////// | 441 ////////////////////////////////////////////////////////////////////////////// |
| 442 | 442 |
| 443 class CertLibraryImplStub : public CertLibrary { | 443 class CertLibraryImplStub : public CertLibrary { |
| 444 public: | 444 public: |
| 445 CertLibraryImplStub() | 445 CertLibraryImplStub() |
| 446 : token_name_("StubToken"), | 446 : token_name_("StubToken"), |
| 447 cert_list_(this) { | 447 cert_list_(this) { |
| 448 } | 448 } |
| 449 virtual ~CertLibraryImplStub() {} | 449 virtual ~CertLibraryImplStub() {} |
| 450 | 450 |
| 451 virtual void AddObserver(Observer* observer) {} | 451 virtual void AddObserver(Observer* observer) OVERRIDE {} |
| 452 virtual void RemoveObserver(Observer* observer) {} | 452 virtual void RemoveObserver(Observer* observer) OVERRIDE {} |
| 453 virtual void LoadKeyStore() {} | 453 virtual void LoadKeyStore() OVERRIDE {} |
| 454 virtual bool CertificatesLoading() const { | 454 virtual bool CertificatesLoading() const OVERRIDE { |
| 455 return false; | 455 return false; |
| 456 } | 456 } |
| 457 virtual bool CertificatesLoaded() const { | 457 virtual bool CertificatesLoaded() const OVERRIDE { |
| 458 return true; | 458 return true; |
| 459 } | 459 } |
| 460 virtual bool IsHardwareBacked() const { | 460 virtual bool IsHardwareBacked() const OVERRIDE { |
| 461 return false; | 461 return false; |
| 462 } | 462 } |
| 463 virtual const std::string& GetTpmTokenName() const { | 463 virtual const std::string& GetTpmTokenName() const OVERRIDE { |
| 464 return token_name_; | 464 return token_name_; |
| 465 } | 465 } |
| 466 virtual const CertList& GetCertificates() const { | 466 virtual const CertList& GetCertificates() const OVERRIDE { |
| 467 return cert_list_; | 467 return cert_list_; |
| 468 } | 468 } |
| 469 virtual const CertList& GetUserCertificates() const { | 469 virtual const CertList& GetUserCertificates() const OVERRIDE { |
| 470 return cert_list_; | 470 return cert_list_; |
| 471 } | 471 } |
| 472 virtual const CertList& GetServerCertificates() const { | 472 virtual const CertList& GetServerCertificates() const OVERRIDE { |
| 473 return cert_list_; | 473 return cert_list_; |
| 474 } | 474 } |
| 475 virtual const CertList& GetCACertificates() const { | 475 virtual const CertList& GetCACertificates() const OVERRIDE { |
| 476 return cert_list_; | 476 return cert_list_; |
| 477 } | 477 } |
| 478 | 478 |
| 479 private: | 479 private: |
| 480 std::string token_name_; | 480 std::string token_name_; |
| 481 CertList cert_list_; | 481 CertList cert_list_; |
| 482 | 482 |
| 483 DISALLOW_COPY_AND_ASSIGN(CertLibraryImplStub); | 483 DISALLOW_COPY_AND_ASSIGN(CertLibraryImplStub); |
| 484 }; | 484 }; |
| 485 | 485 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 net::X509Certificate* cert = GetCertificateAt(index); | 554 net::X509Certificate* cert = GetCertificateAt(index); |
| 555 net::X509Certificate::OSCertHandle cert_handle = cert->os_cert_handle(); | 555 net::X509Certificate::OSCertHandle cert_handle = cert->os_cert_handle(); |
| 556 std::string id = x509_certificate_model::GetPkcs11Id(cert_handle); | 556 std::string id = x509_certificate_model::GetPkcs11Id(cert_handle); |
| 557 if (id == pkcs11_id) | 557 if (id == pkcs11_id) |
| 558 return index; | 558 return index; |
| 559 } | 559 } |
| 560 return -1; // Not found. | 560 return -1; // Not found. |
| 561 } | 561 } |
| 562 | 562 |
| 563 } // chromeos | 563 } // chromeos |
| OLD | NEW |