Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: chrome/browser/chromeos/cros/cert_library.cc

Issue 10626002: Reland "Remove chromeos::LibraryLoader" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove stub hack Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/command_line.h" 10 #include "base/command_line.h"
10 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
11 #include "base/observer_list_threadsafe.h" 12 #include "base/observer_list_threadsafe.h"
12 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
13 #include "base/string_util.h" 14 #include "base/string_util.h"
14 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/browser_process.h" // g_browser_process 16 #include "chrome/browser/browser_process.h" // g_browser_process
16 #include "chrome/browser/chromeos/cros/cros_library.h" 17 #include "chrome/browser/chromeos/cros/cros_library.h"
17 #include "chrome/browser/chromeos/cros/cryptohome_library.h" 18 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
18 #include "chrome/browser/chromeos/login/user_manager.h" 19 #include "chrome/browser/chromeos/login/user_manager.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // Ensure we've opened the real user's key/certificate database. 147 // Ensure we've opened the real user's key/certificate database.
147 crypto::OpenPersistentNSSDB(); 148 crypto::OpenPersistentNSSDB();
148 149
149 // Only load the Opencryptoki library into NSS if we have this switch. 150 // Only load the Opencryptoki library into NSS if we have this switch.
150 // TODO(gspencer): Remove this switch once cryptohomed work is finished: 151 // TODO(gspencer): Remove this switch once cryptohomed work is finished:
151 // http://crosbug.com/12295 and 12304 152 // http://crosbug.com/12295 and 12304
152 // Note: ChromeOS login with or without loginmanager will crash when 153 // Note: ChromeOS login with or without loginmanager will crash when
153 // the CertLibrary is not there (http://crosbug.com/121456). Before removing 154 // the CertLibrary is not there (http://crosbug.com/121456). Before removing
154 // make sure that that case still works. 155 // make sure that that case still works.
155 if (CommandLine::ForCurrentProcess()->HasSwitch( 156 if (CommandLine::ForCurrentProcess()->HasSwitch(
156 switches::kLoadOpencryptoki) || 157 switches::kLoadOpencryptoki)) {
157 CommandLine::ForCurrentProcess()->HasSwitch(switches::kStubCros)) {
hashimoto 2012/06/21 15:37:20 Steven, loading Opencryptoki on Linux resulted in
stevenjb 2012/06/21 16:29:54 I'm not sure why we were loading this for --stub-c
158 crypto::EnableTPMTokenForNSS(); 158 crypto::EnableTPMTokenForNSS();
159 // Note: this calls crypto::EnsureTPMTokenReady() 159 // Note: this calls crypto::EnsureTPMTokenReady()
160 RequestCertificates(); 160 RequestCertificates();
161 } 161 }
162 key_store_loaded_ = true; 162 key_store_loaded_ = true;
163 } 163 }
164 164
165 virtual bool CertificatesLoading() const OVERRIDE { 165 virtual bool CertificatesLoading() const OVERRIDE {
166 return certificates_requested_ && !certificates_loaded_; 166 return certificates_requested_ && !certificates_loaded_;
167 } 167 }
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 DISALLOW_COPY_AND_ASSIGN(CertLibraryImpl); 520 DISALLOW_COPY_AND_ASSIGN(CertLibraryImpl);
521 }; 521 };
522 522
523 ////////////////////////////////////////////////////////////////////////////// 523 //////////////////////////////////////////////////////////////////////////////
524 524
525 CertLibrary::~CertLibrary() { 525 CertLibrary::~CertLibrary() {
526 } 526 }
527 527
528 // static 528 // static
529 CertLibrary* CertLibrary::GetImpl(bool stub) { 529 CertLibrary* CertLibrary::GetImpl(bool stub) {
530 // No libcros dependencies, so always return CertLibraryImpl() (no stub). 530 // |stub| is ignored since we have no stub of CertLibrary.
531 // TODO(stevenjb): Disassociate CertLibrary from CrosLibrary entirely.
532 // crbug.com/133752
531 return new CertLibraryImpl(); 533 return new CertLibraryImpl();
532 } 534 }
533 535
534 ////////////////////////////////////////////////////////////////////////////// 536 //////////////////////////////////////////////////////////////////////////////
535 537
536 net::X509Certificate* CertLibrary::CertList::GetCertificateAt(int index) const { 538 net::X509Certificate* CertLibrary::CertList::GetCertificateAt(int index) const {
537 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 539 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
538 DCHECK_GE(index, 0); 540 DCHECK_GE(index, 0);
539 DCHECK_LT(index, static_cast<int>(list_.size())); 541 DCHECK_LT(index, static_cast<int>(list_.size()));
540 return list_[index].get(); 542 return list_[index].get();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 net::X509Certificate* cert = GetCertificateAt(index); 584 net::X509Certificate* cert = GetCertificateAt(index);
583 net::X509Certificate::OSCertHandle cert_handle = cert->os_cert_handle(); 585 net::X509Certificate::OSCertHandle cert_handle = cert->os_cert_handle();
584 std::string id = x509_certificate_model::GetPkcs11Id(cert_handle); 586 std::string id = x509_certificate_model::GetPkcs11Id(cert_handle);
585 if (id == pkcs11_id) 587 if (id == pkcs11_id)
586 return index; 588 return index;
587 } 589 }
588 return -1; // Not found. 590 return -1; // Not found.
589 } 591 }
590 592
591 } // chromeos 593 } // chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/chrome_browser_main_chromeos.cc ('k') | chrome/browser/chromeos/cros/cros_library.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698