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

Side by Side Diff: chrome/browser/ui/webui/options/certificate_manager_handler.cc

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

Powered by Google App Engine
This is Rietveld 408576698