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

Side by Side Diff: chrome/browser/ui/webui/settings/certificates_handler.cc

Issue 2812953002: Stop passing raw pointers to base::Value API in c/b/ui (Closed)
Patch Set: Created 3 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
OLDNEW
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 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 std::unique_ptr<base::ListValue> nodes = 1037 std::unique_ptr<base::ListValue> nodes =
1038 base::MakeUnique<base::ListValue>(); 1038 base::MakeUnique<base::ListValue>();
1039 for (CertificateManagerModel::OrgGroupingMap::iterator i = map.begin(); 1039 for (CertificateManagerModel::OrgGroupingMap::iterator i = map.begin();
1040 i != map.end(); ++i) { 1040 i != map.end(); ++i) {
1041 // Populate first level (org name). 1041 // Populate first level (org name).
1042 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue); 1042 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
1043 dict->SetString(kKeyField, OrgNameToId(i->first)); 1043 dict->SetString(kKeyField, OrgNameToId(i->first));
1044 dict->SetString(kNameField, i->first); 1044 dict->SetString(kNameField, i->first);
1045 1045
1046 // Populate second level (certs). 1046 // Populate second level (certs).
1047 base::ListValue* subnodes = new base::ListValue; 1047 auto subnodes = base::MakeUnique<base::ListValue>();
1048 for (net::CertificateList::const_iterator org_cert_it = i->second.begin(); 1048 for (net::CertificateList::const_iterator org_cert_it = i->second.begin();
1049 org_cert_it != i->second.end(); ++org_cert_it) { 1049 org_cert_it != i->second.end(); ++org_cert_it) {
1050 std::unique_ptr<base::DictionaryValue> cert_dict( 1050 std::unique_ptr<base::DictionaryValue> cert_dict(
1051 new base::DictionaryValue); 1051 new base::DictionaryValue);
1052 net::X509Certificate* cert = org_cert_it->get(); 1052 net::X509Certificate* cert = org_cert_it->get();
1053 cert_dict->SetString(kKeyField, cert_id_map_->CertToId(cert)); 1053 cert_dict->SetString(kKeyField, cert_id_map_->CertToId(cert));
1054 cert_dict->SetString( 1054 cert_dict->SetString(
1055 kNameField, certificate_manager_model_->GetColumnText( 1055 kNameField, certificate_manager_model_->GetColumnText(
1056 *cert, CertificateManagerModel::COL_SUBJECT_NAME)); 1056 *cert, CertificateManagerModel::COL_SUBJECT_NAME));
1057 cert_dict->SetBoolean( 1057 cert_dict->SetBoolean(
(...skipping 11 matching lines...) Expand all
1069 // CKA_EXTRACTABLE attribute. We may need to use the NSS function 1069 // CKA_EXTRACTABLE attribute. We may need to use the NSS function
1070 // PK11_ReadRawAttribute to do that. 1070 // PK11_ReadRawAttribute to do that.
1071 cert_dict->SetBoolean( 1071 cert_dict->SetBoolean(
1072 kExtractableField, 1072 kExtractableField,
1073 !certificate_manager_model_->IsHardwareBacked(cert)); 1073 !certificate_manager_model_->IsHardwareBacked(cert));
1074 // TODO(mattm): Other columns. 1074 // TODO(mattm): Other columns.
1075 subnodes->Append(std::move(cert_dict)); 1075 subnodes->Append(std::move(cert_dict));
1076 } 1076 }
1077 std::sort(subnodes->begin(), subnodes->end(), comparator); 1077 std::sort(subnodes->begin(), subnodes->end(), comparator);
1078 1078
1079 dict->Set(kSubnodesField, subnodes); 1079 dict->Set(kSubnodesField, std::move(subnodes));
1080 nodes->Append(std::move(dict)); 1080 nodes->Append(std::move(dict));
1081 } 1081 }
1082 std::sort(nodes->begin(), nodes->end(), comparator); 1082 std::sort(nodes->begin(), nodes->end(), comparator);
1083 1083
1084 CallJavascriptFunction("cr.webUIListenerCallback", 1084 CallJavascriptFunction("cr.webUIListenerCallback",
1085 base::Value("certificates-changed"), 1085 base::Value("certificates-changed"),
1086 base::Value(tab_name), *nodes); 1086 base::Value(tab_name), *nodes);
1087 } 1087 }
1088 } 1088 }
1089 1089
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 error_info->Set(kCertificateErrors, 1138 error_info->Set(kCertificateErrors,
1139 base::WrapUnique(cert_error_list.release())); 1139 base::WrapUnique(cert_error_list.release()));
1140 RejectCallback(*error_info); 1140 RejectCallback(*error_info);
1141 } 1141 }
1142 1142
1143 gfx::NativeWindow CertificatesHandler::GetParentWindow() const { 1143 gfx::NativeWindow CertificatesHandler::GetParentWindow() const {
1144 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); 1144 return web_ui()->GetWebContents()->GetTopLevelNativeWindow();
1145 } 1145 }
1146 1146
1147 } // namespace settings 1147 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698