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

Side by Side Diff: chrome/browser/ui/webui/options/certificate_manager_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 (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/options/certificate_manager_handler.h" 5 #include "chrome/browser/ui/webui/options/certificate_manager_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 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 { 1138 {
1139 std::unique_ptr<base::ListValue> nodes(new base::ListValue); 1139 std::unique_ptr<base::ListValue> nodes(new base::ListValue);
1140 for (CertificateManagerModel::OrgGroupingMap::iterator i = map.begin(); 1140 for (CertificateManagerModel::OrgGroupingMap::iterator i = map.begin();
1141 i != map.end(); ++i) { 1141 i != map.end(); ++i) {
1142 // Populate first level (org name). 1142 // Populate first level (org name).
1143 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue); 1143 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
1144 dict->SetString(kKeyId, OrgNameToId(i->first)); 1144 dict->SetString(kKeyId, OrgNameToId(i->first));
1145 dict->SetString(kNameId, i->first); 1145 dict->SetString(kNameId, i->first);
1146 1146
1147 // Populate second level (certs). 1147 // Populate second level (certs).
1148 base::ListValue* subnodes = new base::ListValue; 1148 auto subnodes = base::MakeUnique<base::ListValue>();
1149 for (net::CertificateList::const_iterator org_cert_it = i->second.begin(); 1149 for (net::CertificateList::const_iterator org_cert_it = i->second.begin();
1150 org_cert_it != i->second.end(); ++org_cert_it) { 1150 org_cert_it != i->second.end(); ++org_cert_it) {
1151 std::unique_ptr<base::DictionaryValue> cert_dict( 1151 std::unique_ptr<base::DictionaryValue> cert_dict(
1152 new base::DictionaryValue); 1152 new base::DictionaryValue);
1153 net::X509Certificate* cert = org_cert_it->get(); 1153 net::X509Certificate* cert = org_cert_it->get();
1154 cert_dict->SetString(kKeyId, cert_id_map_->CertToId(cert)); 1154 cert_dict->SetString(kKeyId, cert_id_map_->CertToId(cert));
1155 cert_dict->SetString(kNameId, certificate_manager_model_->GetColumnText( 1155 cert_dict->SetString(kNameId, certificate_manager_model_->GetColumnText(
1156 *cert, CertificateManagerModel::COL_SUBJECT_NAME)); 1156 *cert, CertificateManagerModel::COL_SUBJECT_NAME));
1157 cert_dict->SetBoolean( 1157 cert_dict->SetBoolean(
1158 kReadOnlyId, 1158 kReadOnlyId,
(...skipping 10 matching lines...) Expand all
1169 // CKA_EXTRACTABLE attribute. We may need to use the NSS function 1169 // CKA_EXTRACTABLE attribute. We may need to use the NSS function
1170 // PK11_ReadRawAttribute to do that. 1170 // PK11_ReadRawAttribute to do that.
1171 cert_dict->SetBoolean( 1171 cert_dict->SetBoolean(
1172 kExtractableId, 1172 kExtractableId,
1173 !certificate_manager_model_->IsHardwareBacked(cert)); 1173 !certificate_manager_model_->IsHardwareBacked(cert));
1174 // TODO(mattm): Other columns. 1174 // TODO(mattm): Other columns.
1175 subnodes->Append(std::move(cert_dict)); 1175 subnodes->Append(std::move(cert_dict));
1176 } 1176 }
1177 std::sort(subnodes->begin(), subnodes->end(), comparator); 1177 std::sort(subnodes->begin(), subnodes->end(), comparator);
1178 1178
1179 dict->Set(kSubNodesId, subnodes); 1179 dict->Set(kSubNodesId, std::move(subnodes));
1180 nodes->Append(std::move(dict)); 1180 nodes->Append(std::move(dict));
1181 } 1181 }
1182 std::sort(nodes->begin(), nodes->end(), comparator); 1182 std::sort(nodes->begin(), nodes->end(), comparator);
1183 1183
1184 base::ListValue args; 1184 base::ListValue args;
1185 args.AppendString(tree_name); 1185 args.AppendString(tree_name);
1186 args.Append(std::move(nodes)); 1186 args.Append(std::move(nodes));
1187 web_ui()->CallJavascriptFunctionUnsafe("CertificateManager.onPopulateTree", 1187 web_ui()->CallJavascriptFunctionUnsafe("CertificateManager.onPopulateTree",
1188 args); 1188 args);
1189 } 1189 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 web_ui()->CallJavascriptFunctionUnsafe("CertificateImportErrorOverlay.show", 1231 web_ui()->CallJavascriptFunctionUnsafe("CertificateImportErrorOverlay.show",
1232 title_value, error_value, 1232 title_value, error_value,
1233 cert_error_list); 1233 cert_error_list);
1234 } 1234 }
1235 1235
1236 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { 1236 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const {
1237 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); 1237 return web_ui()->GetWebContents()->GetTopLevelNativeWindow();
1238 } 1238 }
1239 1239
1240 } // namespace options 1240 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698