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

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

Issue 61183002: Get device by type for Hardware Address (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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_state_handler.h" 5 #include "chromeos/network/network_state_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 if (!network->update_received()) 240 if (!network->update_received())
241 continue; 241 continue;
242 if (network->Matches(type)) 242 if (network->Matches(type))
243 return network; 243 return network;
244 } 244 }
245 return NULL; 245 return NULL;
246 } 246 }
247 247
248 std::string NetworkStateHandler::HardwareAddressForType( 248 std::string NetworkStateHandler::HardwareAddressForType(
249 const NetworkTypePattern& type) const { 249 const NetworkTypePattern& type) const {
250 const DeviceState* device = NULL;
250 const NetworkState* network = ConnectedNetworkByType(type); 251 const NetworkState* network = ConnectedNetworkByType(type);
251 if (!network) 252 if (network)
252 return std::string(); 253 device = GetDeviceState(network->device_path());
253 const DeviceState* device = GetDeviceState(network->device_path()); 254 else
255 device = GetDeviceStateByType(type);
254 if (!device) 256 if (!device)
255 return std::string(); 257 return std::string();
256 std::string result = device->mac_address(); 258 std::string result = device->mac_address();
257 StringToUpperASCII(&result); 259 StringToUpperASCII(&result);
258 return result; 260 return result;
259 } 261 }
260 262
261 std::string NetworkStateHandler::FormattedHardwareAddressForType( 263 std::string NetworkStateHandler::FormattedHardwareAddressForType(
262 const NetworkTypePattern& type) const { 264 const NetworkTypePattern& type) const {
263 std::string address = HardwareAddressForType(type); 265 std::string address = HardwareAddressForType(type);
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 } 819 }
818 820
819 if (type.MatchesType(shill::kTypeCellular)) 821 if (type.MatchesType(shill::kTypeCellular))
820 return shill::kTypeCellular; 822 return shill::kTypeCellular;
821 823
822 NOTREACHED(); 824 NOTREACHED();
823 return std::string(); 825 return std::string();
824 } 826 }
825 827
826 } // namespace chromeos 828 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698