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

Side by Side Diff: chromeos/network/device_state.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/device_state.h" 5 #include "chromeos/network/device_state.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 NET_LOG_EVENT("IPConfig Updated: " + ip_config_path, path()); 151 NET_LOG_EVENT("IPConfig Updated: " + ip_config_path, path());
152 ip_config->Clear(); 152 ip_config->Clear();
153 } else { 153 } else {
154 NET_LOG_EVENT("IPConfig Added: " + ip_config_path, path()); 154 NET_LOG_EVENT("IPConfig Added: " + ip_config_path, path());
155 ip_config = new base::DictionaryValue; 155 ip_config = new base::DictionaryValue;
156 ip_configs_.SetWithoutPathExpansion(ip_config_path, ip_config); 156 ip_configs_.SetWithoutPathExpansion(ip_config_path, ip_config);
157 } 157 }
158 ip_config->MergeDictionary(&properties); 158 ip_config->MergeDictionary(&properties);
159 } 159 }
160 160
161 std::string DeviceState::GetFormattedMacAddress() const {
162 if (mac_address_.size() % 2 != 0)
163 return mac_address_;
164 std::string result;
165 for (size_t i = 0; i < mac_address_.size(); ++i) {
166 if ((i != 0) && (i % 2 == 0))
167 result.push_back(':');
168 result.push_back(mac_address_[i]);
169 }
170 return result;
171 }
172
173 bool DeviceState::IsSimAbsent() const { 161 bool DeviceState::IsSimAbsent() const {
174 return technology_family_ == shill::kTechnologyFamilyGsm && !sim_present_; 162 return technology_family_ == shill::kTechnologyFamilyGsm && !sim_present_;
175 } 163 }
176 164
177 } // namespace chromeos 165 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/device_state.h ('k') | chromeos/network/managed_network_configuration_handler_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698