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

Unified Diff: chromeos/network/onc/onc_utils.cc

Issue 2000803003: Use std::unique_ptr for base::DictionaryValue and base::ListValue's internal store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More fixes Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/network/onc/onc_mapper.cc ('k') | chromeos/network/onc/onc_validator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/onc/onc_utils.cc
diff --git a/chromeos/network/onc/onc_utils.cc b/chromeos/network/onc/onc_utils.cc
index 4eed8d7df78de2930132c222f70055a7ff0957a5..5db8bd4f8677c83083d4c1851de06b05aa9fafe0 100644
--- a/chromeos/network/onc/onc_utils.cc
+++ b/chromeos/network/onc/onc_utils.cc
@@ -238,7 +238,7 @@ void ExpandStringsInOncObject(
void ExpandStringsInNetworks(const StringSubstitution& substitution,
base::ListValue* network_configs) {
- for (base::Value* entry : *network_configs) {
+ for (const auto& entry : *network_configs) {
base::DictionaryValue* network = nullptr;
entry->GetAsDictionary(&network);
DCHECK(network);
@@ -362,9 +362,10 @@ std::string DecodePEM(const std::string& pem_encoded) {
CertPEMsByGUIDMap GetServerAndCACertsByGUID(
const base::ListValue& certificates) {
CertPEMsByGUIDMap certs_by_guid;
- for (const base::Value* entry : certificates) {
+ for (const auto& entry : certificates) {
const base::DictionaryValue* cert = nullptr;
- entry->GetAsDictionary(&cert);
+ bool entry_is_dictionary = entry->GetAsDictionary(&cert);
+ DCHECK(entry_is_dictionary);
std::string guid;
cert->GetStringWithoutPathExpansion(certificate::kGUID, &guid);
@@ -391,7 +392,7 @@ CertPEMsByGUIDMap GetServerAndCACertsByGUID(
}
void FillInHexSSIDFieldsInNetworks(base::ListValue* network_configs) {
- for (base::Value* entry : *network_configs) {
+ for (const auto& entry : *network_configs) {
base::DictionaryValue* network = nullptr;
entry->GetAsDictionary(&network);
DCHECK(network);
@@ -557,9 +558,10 @@ bool ResolveCertRefList(const CertPEMsByGUIDMap& certs_by_guid,
}
std::unique_ptr<base::ListValue> pem_list(new base::ListValue);
- for (const base::Value* entry : *guid_ref_list) {
+ for (const auto& entry : *guid_ref_list) {
std::string guid_ref;
- entry->GetAsString(&guid_ref);
+ bool entry_is_string = entry->GetAsString(&guid_ref);
+ DCHECK(entry_is_string);
std::string pem_encoded;
if (!GUIDRefToPEMEncoding(certs_by_guid, guid_ref, &pem_encoded))
« no previous file with comments | « chromeos/network/onc/onc_mapper.cc ('k') | chromeos/network/onc/onc_validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698