| 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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 data.data(), data.size(), net::X509Certificate::FORMAT_AUTO); | 803 data.data(), data.size(), net::X509Certificate::FORMAT_AUTO); |
| 804 if (selected_cert_list_.empty()) { | 804 if (selected_cert_list_.empty()) { |
| 805 ImportExportCleanup(); | 805 ImportExportCleanup(); |
| 806 ShowError( | 806 ShowError( |
| 807 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE), | 807 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE), |
| 808 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_CERT_PARSE_ERROR)); | 808 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_CERT_PARSE_ERROR)); |
| 809 return; | 809 return; |
| 810 } | 810 } |
| 811 | 811 |
| 812 net::CertDatabase::ImportCertFailureList not_imported; | 812 net::CertDatabase::ImportCertFailureList not_imported; |
| 813 // TODO(mattm): Add UI for trust. http://crbug.com/76274 |
| 813 bool result = certificate_manager_model_->ImportServerCert( | 814 bool result = certificate_manager_model_->ImportServerCert( |
| 814 selected_cert_list_, | 815 selected_cert_list_, |
| 816 net::CertDatabase::TRUST_DEFAULT, |
| 815 ¬_imported); | 817 ¬_imported); |
| 816 if (!result) { | 818 if (!result) { |
| 817 ShowError( | 819 ShowError( |
| 818 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE), | 820 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE), |
| 819 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_UNKNOWN_ERROR)); | 821 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_UNKNOWN_ERROR)); |
| 820 } else if (!not_imported.empty()) { | 822 } else if (!not_imported.empty()) { |
| 821 ShowImportErrors( | 823 ShowImportErrors( |
| 822 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE), | 824 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE), |
| 823 not_imported); | 825 not_imported); |
| 824 } | 826 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 fail |= !CallbackArgsToBool(args, 0, &trust_ssl); | 885 fail |= !CallbackArgsToBool(args, 0, &trust_ssl); |
| 884 fail |= !CallbackArgsToBool(args, 1, &trust_email); | 886 fail |= !CallbackArgsToBool(args, 1, &trust_email); |
| 885 fail |= !CallbackArgsToBool(args, 2, &trust_obj_sign); | 887 fail |= !CallbackArgsToBool(args, 2, &trust_obj_sign); |
| 886 if (fail) { | 888 if (fail) { |
| 887 LOG(ERROR) << "ImportCATrustSelected args fail"; | 889 LOG(ERROR) << "ImportCATrustSelected args fail"; |
| 888 ImportExportCleanup(); | 890 ImportExportCleanup(); |
| 889 web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss"); | 891 web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss"); |
| 890 return; | 892 return; |
| 891 } | 893 } |
| 892 | 894 |
| 895 // TODO(mattm): add UI for setting explicit distrust, too. |
| 896 // http://crbug.com/128411 |
| 893 net::CertDatabase::ImportCertFailureList not_imported; | 897 net::CertDatabase::ImportCertFailureList not_imported; |
| 894 bool result = certificate_manager_model_->ImportCACerts( | 898 bool result = certificate_manager_model_->ImportCACerts( |
| 895 selected_cert_list_, | 899 selected_cert_list_, |
| 896 trust_ssl * net::CertDatabase::TRUSTED_SSL + | 900 trust_ssl * net::CertDatabase::TRUSTED_SSL + |
| 897 trust_email * net::CertDatabase::TRUSTED_EMAIL + | 901 trust_email * net::CertDatabase::TRUSTED_EMAIL + |
| 898 trust_obj_sign * net::CertDatabase::TRUSTED_OBJ_SIGN, | 902 trust_obj_sign * net::CertDatabase::TRUSTED_OBJ_SIGN, |
| 899 ¬_imported); | 903 ¬_imported); |
| 900 web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss"); | 904 web_ui()->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss"); |
| 901 if (!result) { | 905 if (!result) { |
| 902 ShowError( | 906 ShowError( |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 web_ui()->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", | 1061 web_ui()->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", |
| 1058 ready); | 1062 ready); |
| 1059 } | 1063 } |
| 1060 #endif | 1064 #endif |
| 1061 | 1065 |
| 1062 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { | 1066 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { |
| 1063 return web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(); | 1067 return web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(); |
| 1064 } | 1068 } |
| 1065 | 1069 |
| 1066 } // namespace options2 | 1070 } // namespace options2 |
| OLD | NEW |