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/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 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 ImportExportCleanup(); | 801 ImportExportCleanup(); |
802 ShowError( | 802 ShowError( |
803 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE), | 803 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE), |
804 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_CERT_PARSE_ERROR)); | 804 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_CERT_PARSE_ERROR)); |
805 return; | 805 return; |
806 } | 806 } |
807 | 807 |
808 net::CertDatabase::ImportCertFailureList not_imported; | 808 net::CertDatabase::ImportCertFailureList not_imported; |
809 bool result = certificate_manager_model_->ImportServerCert( | 809 bool result = certificate_manager_model_->ImportServerCert( |
810 selected_cert_list_, | 810 selected_cert_list_, |
| 811 net::CertDatabase::UNTRUSTED, // TODO(mattm): Add UI for trust. |
811 ¬_imported); | 812 ¬_imported); |
812 if (!result) { | 813 if (!result) { |
813 ShowError( | 814 ShowError( |
814 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE), | 815 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE), |
815 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_UNKNOWN_ERROR)); | 816 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_UNKNOWN_ERROR)); |
816 } else if (!not_imported.empty()) { | 817 } else if (!not_imported.empty()) { |
817 ShowImportErrors( | 818 ShowImportErrors( |
818 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE), | 819 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE), |
819 not_imported); | 820 not_imported); |
820 } | 821 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 fail |= !CallbackArgsToBool(args, 0, &trust_ssl); | 880 fail |= !CallbackArgsToBool(args, 0, &trust_ssl); |
880 fail |= !CallbackArgsToBool(args, 1, &trust_email); | 881 fail |= !CallbackArgsToBool(args, 1, &trust_email); |
881 fail |= !CallbackArgsToBool(args, 2, &trust_obj_sign); | 882 fail |= !CallbackArgsToBool(args, 2, &trust_obj_sign); |
882 if (fail) { | 883 if (fail) { |
883 LOG(ERROR) << "ImportCATrustSelected args fail"; | 884 LOG(ERROR) << "ImportCATrustSelected args fail"; |
884 ImportExportCleanup(); | 885 ImportExportCleanup(); |
885 web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss"); | 886 web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss"); |
886 return; | 887 return; |
887 } | 888 } |
888 | 889 |
| 890 // TODO(mattm): add UI for setting explicit distrust, too. |
889 net::CertDatabase::ImportCertFailureList not_imported; | 891 net::CertDatabase::ImportCertFailureList not_imported; |
890 bool result = certificate_manager_model_->ImportCACerts( | 892 bool result = certificate_manager_model_->ImportCACerts( |
891 selected_cert_list_, | 893 selected_cert_list_, |
892 trust_ssl * net::CertDatabase::TRUSTED_SSL + | 894 trust_ssl * net::CertDatabase::TRUSTED_SSL + |
893 trust_email * net::CertDatabase::TRUSTED_EMAIL + | 895 trust_email * net::CertDatabase::TRUSTED_EMAIL + |
894 trust_obj_sign * net::CertDatabase::TRUSTED_OBJ_SIGN, | 896 trust_obj_sign * net::CertDatabase::TRUSTED_OBJ_SIGN, |
895 ¬_imported); | 897 ¬_imported); |
896 web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss"); | 898 web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss"); |
897 if (!result) { | 899 if (!result) { |
898 ShowError( | 900 ShowError( |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 web_ui()->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", | 1049 web_ui()->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", |
1048 ready); | 1050 ready); |
1049 } | 1051 } |
1050 #endif | 1052 #endif |
1051 | 1053 |
1052 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { | 1054 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { |
1053 return web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(); | 1055 return web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(); |
1054 } | 1056 } |
1055 | 1057 |
1056 } // namespace options2 | 1058 } // namespace options2 |
OLD | NEW |