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

Side by Side Diff: chrome/browser/ui/webui/options/certificate_manager_handler.cc

Issue 7338011: Linux Cert manager: improve PKCS #12 import error messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 5 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
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | net/base/cert_database_nss_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/file_util.h" // for FileAccessProvider 7 #include "base/file_util.h" // for FileAccessProvider
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/safe_strerror_posix.h" 9 #include "base/safe_strerror_posix.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 void CertificateManagerHandler::ImportPersonalSlotUnlocked() { 671 void CertificateManagerHandler::ImportPersonalSlotUnlocked() {
672 // Determine if the private key should be unextractable after the import. 672 // Determine if the private key should be unextractable after the import.
673 // We do this by checking the value of |use_hardware_backed_| which is set 673 // We do this by checking the value of |use_hardware_backed_| which is set
674 // to true if importing into a hardware module. Currently, this only happens 674 // to true if importing into a hardware module. Currently, this only happens
675 // for Chrome OS when the "Import and Bind" option is chosen. 675 // for Chrome OS when the "Import and Bind" option is chosen.
676 bool is_extractable = !use_hardware_backed_; 676 bool is_extractable = !use_hardware_backed_;
677 int result = certificate_manager_model_->ImportFromPKCS12( 677 int result = certificate_manager_model_->ImportFromPKCS12(
678 module_, file_data_, password_, is_extractable); 678 module_, file_data_, password_, is_extractable);
679 ImportExportCleanup(); 679 ImportExportCleanup();
680 web_ui_->CallJavascriptFunction("CertificateRestoreOverlay.dismiss"); 680 web_ui_->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
681 int string_id;
681 switch (result) { 682 switch (result) {
682 case net::OK: 683 case net::OK:
683 break; 684 return;
684 case net::ERR_PKCS12_IMPORT_BAD_PASSWORD: 685 case net::ERR_PKCS12_IMPORT_BAD_PASSWORD:
685 ShowError(
686 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_PKCS12_IMPORT_ERROR_TITLE),
687 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_BAD_PASSWORD));
688 // TODO(mattm): if the error was a bad password, we should reshow the 686 // TODO(mattm): if the error was a bad password, we should reshow the
689 // password dialog after the user dismisses the error dialog. 687 // password dialog after the user dismisses the error dialog.
688 string_id = IDS_CERT_MANAGER_BAD_PASSWORD;
689 break;
690 case net::ERR_PKCS12_IMPORT_INVALID_MAC:
691 string_id = IDS_CERT_MANAGER_PKCS12_IMPORT_INVALID_MAC;
692 break;
693 case net::ERR_PKCS12_IMPORT_INVALID_FILE:
694 string_id = IDS_CERT_MANAGER_PKCS12_IMPORT_INVALID_FILE;
695 break;
696 case net::ERR_PKCS12_IMPORT_UNSUPPORTED:
697 string_id = IDS_CERT_MANAGER_PKCS12_IMPORT_UNSUPPORTED;
690 break; 698 break;
691 default: 699 default:
692 ShowError( 700 string_id = IDS_CERT_MANAGER_UNKNOWN_ERROR;
693 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_PKCS12_IMPORT_ERROR_TITLE),
694 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_UNKNOWN_ERROR));
695 break; 701 break;
696 } 702 }
703 ShowError(
704 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_PKCS12_IMPORT_ERROR_TITLE),
705 l10n_util::GetStringUTF8(string_id));
697 } 706 }
698 707
699 void CertificateManagerHandler::CancelImportExportProcess( 708 void CertificateManagerHandler::CancelImportExportProcess(
700 const ListValue* args) { 709 const ListValue* args) {
701 ImportExportCleanup(); 710 ImportExportCleanup();
702 } 711 }
703 712
704 void CertificateManagerHandler::ImportExportCleanup() { 713 void CertificateManagerHandler::ImportExportCleanup() {
705 file_path_.clear(); 714 file_path_.clear();
706 password_.clear(); 715 password_.clear();
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 // TODO(xiyuan): Use async way when underlying supports it. 995 // TODO(xiyuan): Use async way when underlying supports it.
987 FundamentalValue ready(cryptohome->Pkcs11IsTpmTokenReady()); 996 FundamentalValue ready(cryptohome->Pkcs11IsTpmTokenReady());
988 web_ui_->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", 997 web_ui_->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady",
989 ready); 998 ready);
990 } 999 }
991 #endif 1000 #endif
992 1001
993 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { 1002 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const {
994 return web_ui_->tab_contents()->view()->GetTopLevelNativeWindow(); 1003 return web_ui_->tab_contents()->view()->GetTopLevelNativeWindow();
995 } 1004 }
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | net/base/cert_database_nss_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698