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

Side by Side Diff: chrome/browser/ui/webui/options2/certificate_manager_handler2.cc

Issue 9940001: Fix imported server certs being distrusted in NSS 3.13. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
OLDNEW
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/options2/certificate_manager_handler2.h" 5 #include "chrome/browser/ui/webui/options2/certificate_manager_handler2.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" // for FileAccessProvider 9 #include "base/file_util.h" // for FileAccessProvider
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 ImportExportCleanup(); 811 ImportExportCleanup();
812 ShowError( 812 ShowError(
813 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE), 813 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE),
814 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_CERT_PARSE_ERROR)); 814 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_CERT_PARSE_ERROR));
815 return; 815 return;
816 } 816 }
817 817
818 net::CertDatabase::ImportCertFailureList not_imported; 818 net::CertDatabase::ImportCertFailureList not_imported;
819 bool result = certificate_manager_model_->ImportServerCert( 819 bool result = certificate_manager_model_->ImportServerCert(
820 selected_cert_list_, 820 selected_cert_list_,
821 net::CertDatabase::UNTRUSTED, // TODO(mattm): Add UI for trust.
821 &not_imported); 822 &not_imported);
822 if (!result) { 823 if (!result) {
823 ShowError( 824 ShowError(
824 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE), 825 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE),
825 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_UNKNOWN_ERROR)); 826 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_UNKNOWN_ERROR));
826 } else if (!not_imported.empty()) { 827 } else if (!not_imported.empty()) {
827 ShowImportErrors( 828 ShowImportErrors(
828 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE), 829 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE),
829 not_imported); 830 not_imported);
830 } 831 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 fail |= !CallbackArgsToBool(args, 0, &trust_ssl); 890 fail |= !CallbackArgsToBool(args, 0, &trust_ssl);
890 fail |= !CallbackArgsToBool(args, 1, &trust_email); 891 fail |= !CallbackArgsToBool(args, 1, &trust_email);
891 fail |= !CallbackArgsToBool(args, 2, &trust_obj_sign); 892 fail |= !CallbackArgsToBool(args, 2, &trust_obj_sign);
892 if (fail) { 893 if (fail) {
893 LOG(ERROR) << "ImportCATrustSelected args fail"; 894 LOG(ERROR) << "ImportCATrustSelected args fail";
894 ImportExportCleanup(); 895 ImportExportCleanup();
895 web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss"); 896 web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
896 return; 897 return;
897 } 898 }
898 899
900 // TODO(mattm): add UI for setting explicit distrust, too.
899 net::CertDatabase::ImportCertFailureList not_imported; 901 net::CertDatabase::ImportCertFailureList not_imported;
900 bool result = certificate_manager_model_->ImportCACerts( 902 bool result = certificate_manager_model_->ImportCACerts(
901 selected_cert_list_, 903 selected_cert_list_,
902 trust_ssl * net::CertDatabase::TRUSTED_SSL + 904 trust_ssl * net::CertDatabase::TRUSTED_SSL +
903 trust_email * net::CertDatabase::TRUSTED_EMAIL + 905 trust_email * net::CertDatabase::TRUSTED_EMAIL +
904 trust_obj_sign * net::CertDatabase::TRUSTED_OBJ_SIGN, 906 trust_obj_sign * net::CertDatabase::TRUSTED_OBJ_SIGN,
905 &not_imported); 907 &not_imported);
906 web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss"); 908 web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss");
907 if (!result) { 909 if (!result) {
908 ShowError( 910 ShowError(
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 web_ui()->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", 1059 web_ui()->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady",
1058 ready); 1060 ready);
1059 } 1061 }
1060 #endif 1062 #endif
1061 1063
1062 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { 1064 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const {
1063 return web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(); 1065 return web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow();
1064 } 1066 }
1065 1067
1066 } // namespace options2 1068 } // namespace options2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698