| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |