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

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
« no previous file with comments | « chromeos/network/network_util.h ('k') | chromeos/network/onc/onc_signature.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/string_util.h"
8 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
9 #include "chromeos/network/favorite_state.h" 10 #include "chromeos/network/favorite_state.h"
10 #include "chromeos/network/network_state.h" 11 #include "chromeos/network/network_state.h"
11 #include "chromeos/network/network_state_handler.h" 12 #include "chromeos/network/network_state_handler.h"
12 #include "chromeos/network/onc/onc_signature.h" 13 #include "chromeos/network/onc/onc_signature.h"
13 #include "chromeos/network/onc/onc_translator.h" 14 #include "chromeos/network/onc/onc_translator.h"
14 #include "chromeos/network/shill_property_util.h" 15 #include "chromeos/network/shill_property_util.h"
15 #include "third_party/cros_system_api/dbus/service_constants.h" 16 #include "third_party/cros_system_api/dbus/service_constants.h"
16 17
17 namespace chromeos { 18 namespace chromeos {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // mask is not a valid number. 93 // mask is not a valid number.
93 return -1; 94 return -1;
94 } 95 }
95 count++; 96 count++;
96 } 97 }
97 if (count < 4) 98 if (count < 4)
98 return -1; 99 return -1;
99 return prefix_length; 100 return prefix_length;
100 } 101 }
101 102
103 std::string FormattedMacAddress(const std::string& shill_mac_address) {
104 if (shill_mac_address.size() % 2 != 0)
105 return shill_mac_address;
106 std::string result;
107 for (size_t i = 0; i < shill_mac_address.size(); ++i) {
108 if ((i != 0) && (i % 2 == 0))
109 result.push_back(':');
110 result.push_back(base::ToUpperASCII(shill_mac_address[i]));
111 }
112 return result;
113 }
114
102 bool ParseCellularScanResults(const base::ListValue& list, 115 bool ParseCellularScanResults(const base::ListValue& list,
103 std::vector<CellularScanResult>* scan_results) { 116 std::vector<CellularScanResult>* scan_results) {
104 scan_results->clear(); 117 scan_results->clear();
105 scan_results->reserve(list.GetSize()); 118 scan_results->reserve(list.GetSize());
106 for (base::ListValue::const_iterator it = list.begin(); 119 for (base::ListValue::const_iterator it = list.begin();
107 it != list.end(); ++it) { 120 it != list.end(); ++it) {
108 if (!(*it)->IsType(base::Value::TYPE_DICTIONARY)) 121 if (!(*it)->IsType(base::Value::TYPE_DICTIONARY))
109 return false; 122 return false;
110 CellularScanResult scan_result; 123 CellularScanResult scan_result;
111 const base::DictionaryValue* dict = 124 const base::DictionaryValue* dict =
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 ++it) { 179 ++it) {
167 scoped_ptr<base::DictionaryValue> onc_dictionary = 180 scoped_ptr<base::DictionaryValue> onc_dictionary =
168 TranslateFavoriteStateToONC(*it); 181 TranslateFavoriteStateToONC(*it);
169 network_properties_list->Append(onc_dictionary.release()); 182 network_properties_list->Append(onc_dictionary.release());
170 } 183 }
171 return network_properties_list.Pass(); 184 return network_properties_list.Pass();
172 } 185 }
173 186
174 } // namespace network_util 187 } // namespace network_util
175 } // namespace chromeos 188 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_util.h ('k') | chromeos/network/onc/onc_signature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698