OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/observer_list_threadsafe.h" | 9 #include "base/observer_list_threadsafe.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 CertLibraryImpl() : | 77 CertLibraryImpl() : |
78 observer_list_(new CertLibraryObserverList), | 78 observer_list_(new CertLibraryObserverList), |
79 user_logged_in_(false), | 79 user_logged_in_(false), |
80 certificates_loaded_(false), | 80 certificates_loaded_(false), |
81 ALLOW_THIS_IN_INITIALIZER_LIST(certs_(this)), | 81 ALLOW_THIS_IN_INITIALIZER_LIST(certs_(this)), |
82 ALLOW_THIS_IN_INITIALIZER_LIST(user_certs_(this)), | 82 ALLOW_THIS_IN_INITIALIZER_LIST(user_certs_(this)), |
83 ALLOW_THIS_IN_INITIALIZER_LIST(server_certs_(this)), | 83 ALLOW_THIS_IN_INITIALIZER_LIST(server_certs_(this)), |
84 ALLOW_THIS_IN_INITIALIZER_LIST(server_ca_certs_(this)) { | 84 ALLOW_THIS_IN_INITIALIZER_LIST(server_ca_certs_(this)) { |
85 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 85 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
86 net::CertDatabase::AddObserver(this); | 86 net::CertDatabase::AddObserver(this); |
87 // For now, if we are not logged in, set certificates_loaded_ to true | |
88 // since RequestCertificates() may never get called. | |
89 // TODO(stevenjb, zel): Handle loading of not hardware backed certificates | |
90 // when not logged in. | |
91 if (!UserManager::Get()->user_is_logged_in()) | |
92 certificates_loaded_ = true; | |
zel
2011/12/02 01:45:26
that's not going to work since this same instance
stevenjb
2011/12/02 02:20:59
That's already handled in RequestCertificates() -
| |
87 } | 93 } |
88 | 94 |
89 ~CertLibraryImpl() { | 95 ~CertLibraryImpl() { |
90 DCHECK(request_task_.is_null()); | 96 DCHECK(request_task_.is_null()); |
91 net::CertDatabase::RemoveObserver(this); | 97 net::CertDatabase::RemoveObserver(this); |
92 } | 98 } |
93 | 99 |
94 // CertLibrary implementation. | 100 // CertLibrary implementation. |
95 virtual void RequestCertificates() OVERRIDE { | 101 virtual void RequestCertificates() OVERRIDE { |
96 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 102 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
403 net::X509Certificate* cert = GetCertificateAt(index); | 409 net::X509Certificate* cert = GetCertificateAt(index); |
404 net::X509Certificate::OSCertHandle cert_handle = cert->os_cert_handle(); | 410 net::X509Certificate::OSCertHandle cert_handle = cert->os_cert_handle(); |
405 std::string id = x509_certificate_model::GetPkcs11Id(cert_handle); | 411 std::string id = x509_certificate_model::GetPkcs11Id(cert_handle); |
406 if (id == pkcs11_id) | 412 if (id == pkcs11_id) |
407 return index; | 413 return index; |
408 } | 414 } |
409 return -1; // Not found. | 415 return -1; // Not found. |
410 } | 416 } |
411 | 417 |
412 } // chromeos | 418 } // chromeos |
OLD | NEW |