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

Side by Side Diff: chromeos/network/network_util.cc

Issue 285233008: Add MacAddress to ONC and networkingPrivate (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: Rebase Created 6 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 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 "base/strings/string_tokenizer.h" 7 #include "base/strings/string_tokenizer.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chromeos/network/favorite_state.h" 9 #include "chromeos/network/favorite_state.h"
10 #include "chromeos/network/network_state.h" 10 #include "chromeos/network/network_state.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // mask is not a valid number. 92 // mask is not a valid number.
93 return -1; 93 return -1;
94 } 94 }
95 count++; 95 count++;
96 } 96 }
97 if (count < 4) 97 if (count < 4)
98 return -1; 98 return -1;
99 return prefix_length; 99 return prefix_length;
100 } 100 }
101 101
102 std::string FormattedMacAddress(const std::string& shill_mac_address) {
103 if (shill_mac_address.size() % 2 != 0)
104 return shill_mac_address;
105 std::string result;
106 for (size_t i = 0; i < shill_mac_address.size(); ++i) {
107 if ((i != 0) && (i % 2 == 0))
108 result.push_back(':');
109 result.push_back(shill_mac_address[i]);
110 }
111 return result;
112 }
113
102 bool ParseCellularScanResults(const base::ListValue& list, 114 bool ParseCellularScanResults(const base::ListValue& list,
103 std::vector<CellularScanResult>* scan_results) { 115 std::vector<CellularScanResult>* scan_results) {
104 scan_results->clear(); 116 scan_results->clear();
105 scan_results->reserve(list.GetSize()); 117 scan_results->reserve(list.GetSize());
106 for (base::ListValue::const_iterator it = list.begin(); 118 for (base::ListValue::const_iterator it = list.begin();
107 it != list.end(); ++it) { 119 it != list.end(); ++it) {
108 if (!(*it)->IsType(base::Value::TYPE_DICTIONARY)) 120 if (!(*it)->IsType(base::Value::TYPE_DICTIONARY))
109 return false; 121 return false;
110 CellularScanResult scan_result; 122 CellularScanResult scan_result;
111 const base::DictionaryValue* dict = 123 const base::DictionaryValue* dict =
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 onc_dictionary->SetString("onc_source", onc_source); 187 onc_dictionary->SetString("onc_source", onc_source);
176 } 188 }
177 189
178 network_properties_list->Append(onc_dictionary.release()); 190 network_properties_list->Append(onc_dictionary.release());
179 } 191 }
180 return network_properties_list.Pass(); 192 return network_properties_list.Pass();
181 } 193 }
182 194
183 } // namespace network_util 195 } // namespace network_util
184 } // namespace chromeos 196 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698