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

Side by Side Diff: chromeos/network/network_util.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, 6 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 "chromeos/network/network_util.h" 5 #include "chromeos/network/network_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 result.push_back(':'); 120 result.push_back(':');
121 result.push_back(base::ToUpperASCII(shill_mac_address[i])); 121 result.push_back(base::ToUpperASCII(shill_mac_address[i]));
122 } 122 }
123 return result; 123 return result;
124 } 124 }
125 125
126 bool ParseCellularScanResults(const base::ListValue& list, 126 bool ParseCellularScanResults(const base::ListValue& list,
127 std::vector<CellularScanResult>* scan_results) { 127 std::vector<CellularScanResult>* scan_results) {
128 scan_results->clear(); 128 scan_results->clear();
129 scan_results->reserve(list.GetSize()); 129 scan_results->reserve(list.GetSize());
130 for (base::ListValue::const_iterator it = list.begin(); 130 for (const auto& value : list) {
131 it != list.end(); ++it) { 131 const base::DictionaryValue* dict;
132 if (!(*it)->IsType(base::Value::TYPE_DICTIONARY)) 132 if (!value->GetAsDictionary(&dict))
133 return false; 133 return false;
134 CellularScanResult scan_result; 134 CellularScanResult scan_result;
135 const base::DictionaryValue* dict =
136 static_cast<const base::DictionaryValue*>(*it);
137 // If the network id property is not present then this network cannot be 135 // If the network id property is not present then this network cannot be
138 // connected to so don't include it in the results. 136 // connected to so don't include it in the results.
139 if (!dict->GetStringWithoutPathExpansion(shill::kNetworkIdProperty, 137 if (!dict->GetStringWithoutPathExpansion(shill::kNetworkIdProperty,
140 &scan_result.network_id)) 138 &scan_result.network_id))
141 continue; 139 continue;
142 dict->GetStringWithoutPathExpansion(shill::kStatusProperty, 140 dict->GetStringWithoutPathExpansion(shill::kStatusProperty,
143 &scan_result.status); 141 &scan_result.status);
144 dict->GetStringWithoutPathExpansion(shill::kLongNameProperty, 142 dict->GetStringWithoutPathExpansion(shill::kLongNameProperty,
145 &scan_result.long_name); 143 &scan_result.long_name);
146 dict->GetStringWithoutPathExpansion(shill::kShortNameProperty, 144 dict->GetStringWithoutPathExpansion(shill::kShortNameProperty,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 std::string TranslateShillTypeToONC(const std::string& shill_type) { 220 std::string TranslateShillTypeToONC(const std::string& shill_type) {
223 if (shill_type == shill::kTypeEthernet) 221 if (shill_type == shill::kTypeEthernet)
224 return ::onc::network_type::kEthernet; 222 return ::onc::network_type::kEthernet;
225 std::string onc_type; 223 std::string onc_type;
226 onc::TranslateStringToONC(onc::kNetworkTypeTable, shill_type, &onc_type); 224 onc::TranslateStringToONC(onc::kNetworkTypeTable, shill_type, &onc_type);
227 return onc_type; 225 return onc_type;
228 } 226 }
229 227
230 } // namespace network_util 228 } // namespace network_util
231 } // namespace chromeos 229 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromecast/crash/linux/synchronized_minidump_manager.cc ('k') | chromeos/network/onc/onc_mapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698