| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/settings/certificates_handler.h" | 5 #include "chrome/browser/ui/webui/settings/certificates_handler.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 icu::Locale(g_browser_process->GetApplicationLocale().c_str()), error)); | 1031 icu::Locale(g_browser_process->GetApplicationLocale().c_str()), error)); |
| 1032 if (U_FAILURE(error)) | 1032 if (U_FAILURE(error)) |
| 1033 collator.reset(NULL); | 1033 collator.reset(NULL); |
| 1034 DictionaryIdComparator comparator(collator.get()); | 1034 DictionaryIdComparator comparator(collator.get()); |
| 1035 CertificateManagerModel::OrgGroupingMap map; | 1035 CertificateManagerModel::OrgGroupingMap map; |
| 1036 | 1036 |
| 1037 certificate_manager_model_->FilterAndBuildOrgGroupingMap(type, &map); | 1037 certificate_manager_model_->FilterAndBuildOrgGroupingMap(type, &map); |
| 1038 | 1038 |
| 1039 { | 1039 { |
| 1040 std::unique_ptr<base::ListValue> nodes = | 1040 std::unique_ptr<base::ListValue> nodes = |
| 1041 base::WrapUnique(new base::ListValue()); | 1041 base::MakeUnique<base::ListValue>(); |
| 1042 for (CertificateManagerModel::OrgGroupingMap::iterator i = map.begin(); | 1042 for (CertificateManagerModel::OrgGroupingMap::iterator i = map.begin(); |
| 1043 i != map.end(); ++i) { | 1043 i != map.end(); ++i) { |
| 1044 // Populate first level (org name). | 1044 // Populate first level (org name). |
| 1045 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue); | 1045 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue); |
| 1046 dict->SetString(kKeyField, OrgNameToId(i->first)); | 1046 dict->SetString(kKeyField, OrgNameToId(i->first)); |
| 1047 dict->SetString(kNameField, i->first); | 1047 dict->SetString(kNameField, i->first); |
| 1048 | 1048 |
| 1049 // Populate second level (certs). | 1049 // Populate second level (certs). |
| 1050 base::ListValue* subnodes = new base::ListValue; | 1050 base::ListValue* subnodes = new base::ListValue; |
| 1051 for (net::CertificateList::const_iterator org_cert_it = i->second.begin(); | 1051 for (net::CertificateList::const_iterator org_cert_it = i->second.begin(); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 error = l10n_util::GetStringUTF8( | 1118 error = l10n_util::GetStringUTF8( |
| 1119 IDS_SETTINGS_CERTIFICATE_MANAGER_IMPORT_SINGLE_NOT_IMPORTED); | 1119 IDS_SETTINGS_CERTIFICATE_MANAGER_IMPORT_SINGLE_NOT_IMPORTED); |
| 1120 else if (not_imported.size() == selected_cert_list_.size()) | 1120 else if (not_imported.size() == selected_cert_list_.size()) |
| 1121 error = l10n_util::GetStringUTF8( | 1121 error = l10n_util::GetStringUTF8( |
| 1122 IDS_SETTINGS_CERTIFICATE_MANAGER_IMPORT_ALL_NOT_IMPORTED); | 1122 IDS_SETTINGS_CERTIFICATE_MANAGER_IMPORT_ALL_NOT_IMPORTED); |
| 1123 else | 1123 else |
| 1124 error = l10n_util::GetStringUTF8( | 1124 error = l10n_util::GetStringUTF8( |
| 1125 IDS_SETTINGS_CERTIFICATE_MANAGER_IMPORT_SOME_NOT_IMPORTED); | 1125 IDS_SETTINGS_CERTIFICATE_MANAGER_IMPORT_SOME_NOT_IMPORTED); |
| 1126 | 1126 |
| 1127 std::unique_ptr<base::ListValue> cert_error_list = | 1127 std::unique_ptr<base::ListValue> cert_error_list = |
| 1128 base::WrapUnique(new base::ListValue()); | 1128 base::MakeUnique<base::ListValue>(); |
| 1129 for (size_t i = 0; i < not_imported.size(); ++i) { | 1129 for (size_t i = 0; i < not_imported.size(); ++i) { |
| 1130 const net::NSSCertDatabase::ImportCertFailure& failure = not_imported[i]; | 1130 const net::NSSCertDatabase::ImportCertFailure& failure = not_imported[i]; |
| 1131 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue); | 1131 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue); |
| 1132 dict->SetString(kNameField, | 1132 dict->SetString(kNameField, |
| 1133 failure.certificate->subject().GetDisplayName()); | 1133 failure.certificate->subject().GetDisplayName()); |
| 1134 dict->SetString(kErrorField, NetErrorToString(failure.net_error)); | 1134 dict->SetString(kErrorField, NetErrorToString(failure.net_error)); |
| 1135 cert_error_list->Append(std::move(dict)); | 1135 cert_error_list->Append(std::move(dict)); |
| 1136 } | 1136 } |
| 1137 | 1137 |
| 1138 std::unique_ptr<base::DictionaryValue> error_info(new base::DictionaryValue); | 1138 std::unique_ptr<base::DictionaryValue> error_info(new base::DictionaryValue); |
| 1139 error_info->SetString(kErrorTitle, title); | 1139 error_info->SetString(kErrorTitle, title); |
| 1140 error_info->SetString(kErrorDescription, error); | 1140 error_info->SetString(kErrorDescription, error); |
| 1141 error_info->Set(kCertificateErrors, | 1141 error_info->Set(kCertificateErrors, |
| 1142 base::WrapUnique(cert_error_list.release())); | 1142 base::WrapUnique(cert_error_list.release())); |
| 1143 RejectCallback(*error_info); | 1143 RejectCallback(*error_info); |
| 1144 } | 1144 } |
| 1145 | 1145 |
| 1146 gfx::NativeWindow CertificatesHandler::GetParentWindow() const { | 1146 gfx::NativeWindow CertificatesHandler::GetParentWindow() const { |
| 1147 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); | 1147 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); |
| 1148 } | 1148 } |
| 1149 | 1149 |
| 1150 } // namespace settings | 1150 } // namespace settings |
| OLD | NEW |