| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/platform_keys/platform_keys.h" | 5 #include "chrome/browser/chromeos/platform_keys/platform_keys.h" |
| 6 | 6 |
| 7 #include <cryptohi.h> | 7 #include <cryptohi.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 // ImportCertificate(). | 469 // ImportCertificate(). |
| 470 void ImportCertificateWithDB(scoped_ptr<ImportCertificateState> state, | 470 void ImportCertificateWithDB(scoped_ptr<ImportCertificateState> state, |
| 471 net::NSSCertDatabase* cert_db) { | 471 net::NSSCertDatabase* cert_db) { |
| 472 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 472 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 473 // TODO(pneubeck): Use |state->slot_| to verify that we're really importing to | 473 // TODO(pneubeck): Use |state->slot_| to verify that we're really importing to |
| 474 // the correct token. | 474 // the correct token. |
| 475 // |cert_db| is not required, ignore it. | 475 // |cert_db| is not required, ignore it. |
| 476 net::CertDatabase* db = net::CertDatabase::GetInstance(); | 476 net::CertDatabase* db = net::CertDatabase::GetInstance(); |
| 477 | 477 |
| 478 const net::Error cert_status = | 478 const net::Error cert_status = |
| 479 static_cast<net::Error>(db->CheckUserCert(state->certificate_)); | 479 static_cast<net::Error>(db->CheckUserCert(state->certificate_.get())); |
| 480 if (cert_status == net::ERR_NO_PRIVATE_KEY_FOR_CERT) { | 480 if (cert_status == net::ERR_NO_PRIVATE_KEY_FOR_CERT) { |
| 481 state->OnError(FROM_HERE, kErrorKeyNotFound); | 481 state->OnError(FROM_HERE, kErrorKeyNotFound); |
| 482 return; | 482 return; |
| 483 } else if (cert_status != net::OK) { | 483 } else if (cert_status != net::OK) { |
| 484 state->OnError(FROM_HERE, net::ErrorToString(cert_status)); | 484 state->OnError(FROM_HERE, net::ErrorToString(cert_status)); |
| 485 return; | 485 return; |
| 486 } | 486 } |
| 487 | 487 |
| 488 // Check that the private key is in the correct slot. | 488 // Check that the private key is in the correct slot. |
| 489 PK11SlotInfo* slot = | 489 PK11SlotInfo* slot = |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 NSSOperationState* state_ptr = state.get(); | 656 NSSOperationState* state_ptr = state.get(); |
| 657 GetCertDatabase(std::string() /* don't get any specific slot */, | 657 GetCertDatabase(std::string() /* don't get any specific slot */, |
| 658 base::Bind(&GetTokensWithDB, base::Passed(&state)), | 658 base::Bind(&GetTokensWithDB, base::Passed(&state)), |
| 659 browser_context, | 659 browser_context, |
| 660 state_ptr); | 660 state_ptr); |
| 661 } | 661 } |
| 662 | 662 |
| 663 } // namespace platform_keys | 663 } // namespace platform_keys |
| 664 | 664 |
| 665 } // namespace chromeos | 665 } // namespace chromeos |
| OLD | NEW |