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/ui/webui/options/certificate_manager_handler.h" | 5 #include "chrome/browser/ui/webui/options/certificate_manager_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 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 ImportExportCleanup(); | 832 ImportExportCleanup(); |
833 return; | 833 return; |
834 } | 834 } |
835 | 835 |
836 if (use_hardware_backed_) { | 836 if (use_hardware_backed_) { |
837 slot_ = certificate_manager_model_->cert_db()->GetPrivateSlot(); | 837 slot_ = certificate_manager_model_->cert_db()->GetPrivateSlot(); |
838 } else { | 838 } else { |
839 slot_ = certificate_manager_model_->cert_db()->GetPublicSlot(); | 839 slot_ = certificate_manager_model_->cert_db()->GetPublicSlot(); |
840 } | 840 } |
841 | 841 |
842 net::CryptoModuleList modules; | 842 std::vector<crypto::ScopedPK11Slot> modules; |
843 modules.push_back(net::CryptoModule::CreateFromHandle(slot_.get())); | 843 modules.push_back(crypto::ScopedPK11Slot(PK11_ReferenceSlot(slot_.get()))); |
844 chrome::UnlockSlotsIfNecessary( | 844 chrome::UnlockSlotsIfNecessary( |
845 modules, | 845 std::move(modules), chrome::kCryptoModulePasswordCertImport, |
846 chrome::kCryptoModulePasswordCertImport, | |
847 net::HostPortPair(), // unused. | 846 net::HostPortPair(), // unused. |
848 GetParentWindow(), | 847 GetParentWindow(), |
849 base::Bind(&CertificateManagerHandler::ImportPersonalSlotUnlocked, | 848 base::Bind(&CertificateManagerHandler::ImportPersonalSlotUnlocked, |
850 base::Unretained(this))); | 849 base::Unretained(this))); |
851 } | 850 } |
852 | 851 |
853 void CertificateManagerHandler::ImportPersonalSlotUnlocked() { | 852 void CertificateManagerHandler::ImportPersonalSlotUnlocked() { |
854 // Determine if the private key should be unextractable after the import. | 853 // Determine if the private key should be unextractable after the import. |
855 // We do this by checking the value of |use_hardware_backed_| which is set | 854 // We do this by checking the value of |use_hardware_backed_| which is set |
856 // to true if importing into a hardware module. Currently, this only happens | 855 // to true if importing into a hardware module. Currently, this only happens |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 web_ui()->CallJavascriptFunctionUnsafe("CertificateImportErrorOverlay.show", | 1232 web_ui()->CallJavascriptFunctionUnsafe("CertificateImportErrorOverlay.show", |
1234 title_value, error_value, | 1233 title_value, error_value, |
1235 cert_error_list); | 1234 cert_error_list); |
1236 } | 1235 } |
1237 | 1236 |
1238 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { | 1237 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { |
1239 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); | 1238 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); |
1240 } | 1239 } |
1241 | 1240 |
1242 } // namespace options | 1241 } // namespace options |
OLD | NEW |