OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ui/webui/settings/certificates_handler.h" | 5 #include "chrome/browser/ui/webui/settings/certificates_handler.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 CHECK_EQ(2U, args->GetSize()); | 716 CHECK_EQ(2U, args->GetSize()); |
717 AssignWebUICallbackId(args); | 717 AssignWebUICallbackId(args); |
718 CHECK(args->GetString(1, &password_)); | 718 CHECK(args->GetString(1, &password_)); |
719 | 719 |
720 if (use_hardware_backed_) { | 720 if (use_hardware_backed_) { |
721 slot_ = certificate_manager_model_->cert_db()->GetPrivateSlot(); | 721 slot_ = certificate_manager_model_->cert_db()->GetPrivateSlot(); |
722 } else { | 722 } else { |
723 slot_ = certificate_manager_model_->cert_db()->GetPublicSlot(); | 723 slot_ = certificate_manager_model_->cert_db()->GetPublicSlot(); |
724 } | 724 } |
725 | 725 |
726 net::CryptoModuleList modules; | 726 std::vector<crypto::ScopedPK11Slot> modules; |
727 modules.push_back(net::CryptoModule::CreateFromHandle(slot_.get())); | 727 modules.push_back(crypto::ScopedPK11Slot(PK11_ReferenceSlot(slot_.get()))); |
728 chrome::UnlockSlotsIfNecessary( | 728 chrome::UnlockSlotsIfNecessary( |
729 modules, chrome::kCryptoModulePasswordCertImport, | 729 std::move(modules), chrome::kCryptoModulePasswordCertImport, |
730 net::HostPortPair(), // unused. | 730 net::HostPortPair(), // unused. |
731 GetParentWindow(), | 731 GetParentWindow(), |
732 base::Bind(&CertificatesHandler::ImportPersonalSlotUnlocked, | 732 base::Bind(&CertificatesHandler::ImportPersonalSlotUnlocked, |
733 base::Unretained(this))); | 733 base::Unretained(this))); |
734 } | 734 } |
735 | 735 |
736 void CertificatesHandler::ImportPersonalSlotUnlocked() { | 736 void CertificatesHandler::ImportPersonalSlotUnlocked() { |
737 // Determine if the private key should be unextractable after the import. | 737 // Determine if the private key should be unextractable after the import. |
738 // We do this by checking the value of |use_hardware_backed_| which is set | 738 // We do this by checking the value of |use_hardware_backed_| which is set |
739 // to true if importing into a hardware module. Currently, this only happens | 739 // to true if importing into a hardware module. Currently, this only happens |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 error_info->Set(kCertificateErrors, | 1140 error_info->Set(kCertificateErrors, |
1141 base::WrapUnique(cert_error_list.release())); | 1141 base::WrapUnique(cert_error_list.release())); |
1142 RejectCallback(*error_info); | 1142 RejectCallback(*error_info); |
1143 } | 1143 } |
1144 | 1144 |
1145 gfx::NativeWindow CertificatesHandler::GetParentWindow() const { | 1145 gfx::NativeWindow CertificatesHandler::GetParentWindow() const { |
1146 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); | 1146 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); |
1147 } | 1147 } |
1148 | 1148 |
1149 } // namespace settings | 1149 } // namespace settings |
OLD | NEW |