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 <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 localized_strings->SetString("serverCertsTabDeleteConfirm", | 319 localized_strings->SetString("serverCertsTabDeleteConfirm", |
320 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_DELETE_SERVER_FORMAT)); | 320 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_DELETE_SERVER_FORMAT)); |
321 localized_strings->SetString("serverCertsTabDeleteImpact", | 321 localized_strings->SetString("serverCertsTabDeleteImpact", |
322 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_DELETE_SERVER_DESCRIPTION)); | 322 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_DELETE_SERVER_DESCRIPTION)); |
323 localized_strings->SetString("caCertsTabDeleteConfirm", | 323 localized_strings->SetString("caCertsTabDeleteConfirm", |
324 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_DELETE_CA_FORMAT)); | 324 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_DELETE_CA_FORMAT)); |
325 localized_strings->SetString("caCertsTabDeleteImpact", | 325 localized_strings->SetString("caCertsTabDeleteImpact", |
326 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_DELETE_CA_DESCRIPTION)); | 326 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_DELETE_CA_DESCRIPTION)); |
327 localized_strings->SetString("unknownCertsTabDeleteConfirm", | 327 localized_strings->SetString("unknownCertsTabDeleteConfirm", |
328 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_DELETE_UNKNOWN_FORMAT)); | 328 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_DELETE_UNKNOWN_FORMAT)); |
329 localized_strings->SetString("unknownCertsTabDeleteImpact", ""); | 329 localized_strings->SetString("unknownCertsTabDeleteImpact", std::string()); |
330 | 330 |
331 // Certificate Restore overlay strings. | 331 // Certificate Restore overlay strings. |
332 localized_strings->SetString("certificateRestorePasswordDescription", | 332 localized_strings->SetString("certificateRestorePasswordDescription", |
333 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_RESTORE_PASSWORD_DESC)); | 333 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_RESTORE_PASSWORD_DESC)); |
334 localized_strings->SetString("certificatePasswordLabel", | 334 localized_strings->SetString("certificatePasswordLabel", |
335 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_PASSWORD_LABEL)); | 335 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_PASSWORD_LABEL)); |
336 | 336 |
337 // Personal Certificate Export overlay strings. | 337 // Personal Certificate Export overlay strings. |
338 localized_strings->SetString("certificateExportPasswordDescription", | 338 localized_strings->SetString("certificateExportPasswordDescription", |
339 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_EXPORT_PASSWORD_DESC)); | 339 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_EXPORT_PASSWORD_DESC)); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 | 607 |
608 // Currently, we don't support exporting more than one at a time. If we do, | 608 // Currently, we don't support exporting more than one at a time. If we do, |
609 // this would need to either change this to use UnlockSlotsIfNecessary or | 609 // this would need to either change this to use UnlockSlotsIfNecessary or |
610 // change UnlockCertSlotIfNecessary to take a CertificateList. | 610 // change UnlockCertSlotIfNecessary to take a CertificateList. |
611 DCHECK_EQ(selected_cert_list_.size(), 1U); | 611 DCHECK_EQ(selected_cert_list_.size(), 1U); |
612 | 612 |
613 // TODO(mattm): do something smarter about non-extractable keys | 613 // TODO(mattm): do something smarter about non-extractable keys |
614 chrome::UnlockCertSlotIfNecessary( | 614 chrome::UnlockCertSlotIfNecessary( |
615 selected_cert_list_[0].get(), | 615 selected_cert_list_[0].get(), |
616 chrome::kCryptoModulePasswordCertExport, | 616 chrome::kCryptoModulePasswordCertExport, |
617 "", // unused. | 617 std::string(), // unused. |
618 base::Bind(&CertificateManagerHandler::ExportPersonalSlotsUnlocked, | 618 base::Bind(&CertificateManagerHandler::ExportPersonalSlotsUnlocked, |
619 base::Unretained(this))); | 619 base::Unretained(this))); |
620 } | 620 } |
621 | 621 |
622 void CertificateManagerHandler::ExportPersonalSlotsUnlocked() { | 622 void CertificateManagerHandler::ExportPersonalSlotsUnlocked() { |
623 std::string output; | 623 std::string output; |
624 int num_exported = certificate_manager_model_->cert_db()->ExportToPKCS12( | 624 int num_exported = certificate_manager_model_->cert_db()->ExportToPKCS12( |
625 selected_cert_list_, | 625 selected_cert_list_, |
626 password_, | 626 password_, |
627 &output); | 627 &output); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 module_ = certificate_manager_model_->cert_db()->GetPrivateModule(); | 716 module_ = certificate_manager_model_->cert_db()->GetPrivateModule(); |
717 } else { | 717 } else { |
718 module_ = certificate_manager_model_->cert_db()->GetPublicModule(); | 718 module_ = certificate_manager_model_->cert_db()->GetPublicModule(); |
719 } | 719 } |
720 | 720 |
721 net::CryptoModuleList modules; | 721 net::CryptoModuleList modules; |
722 modules.push_back(module_); | 722 modules.push_back(module_); |
723 chrome::UnlockSlotsIfNecessary( | 723 chrome::UnlockSlotsIfNecessary( |
724 modules, | 724 modules, |
725 chrome::kCryptoModulePasswordCertImport, | 725 chrome::kCryptoModulePasswordCertImport, |
726 "", // unused. | 726 std::string(), // unused. |
727 base::Bind(&CertificateManagerHandler::ImportPersonalSlotUnlocked, | 727 base::Bind(&CertificateManagerHandler::ImportPersonalSlotUnlocked, |
728 base::Unretained(this))); | 728 base::Unretained(this))); |
729 } | 729 } |
730 | 730 |
731 void CertificateManagerHandler::ImportPersonalSlotUnlocked() { | 731 void CertificateManagerHandler::ImportPersonalSlotUnlocked() { |
732 // Determine if the private key should be unextractable after the import. | 732 // Determine if the private key should be unextractable after the import. |
733 // We do this by checking the value of |use_hardware_backed_| which is set | 733 // We do this by checking the value of |use_hardware_backed_| which is set |
734 // to true if importing into a hardware module. Currently, this only happens | 734 // to true if importing into a hardware module. Currently, this only happens |
735 // for Chrome OS when the "Import and Bind" option is chosen. | 735 // for Chrome OS when the "Import and Bind" option is chosen. |
736 bool is_extractable = !use_hardware_backed_; | 736 bool is_extractable = !use_hardware_backed_; |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 web_ui()->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", | 1081 web_ui()->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", |
1082 ready); | 1082 ready); |
1083 } | 1083 } |
1084 #endif | 1084 #endif |
1085 | 1085 |
1086 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { | 1086 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { |
1087 return web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(); | 1087 return web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(); |
1088 } | 1088 } |
1089 | 1089 |
1090 } // namespace options | 1090 } // namespace options |
OLD | NEW |