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