| 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/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 for (size_t i = 0; i < address.size(); ++i) { | 251 for (size_t i = 0; i < address.size(); ++i) { |
| 252 if ((i != 0) && (i % 2 == 0)) | 252 if ((i != 0) && (i % 2 == 0)) |
| 253 result.push_back(':'); | 253 result.push_back(':'); |
| 254 result.push_back(address[i]); | 254 result.push_back(address[i]); |
| 255 } | 255 } |
| 256 return result; | 256 return result; |
| 257 } | 257 } |
| 258 | 258 |
| 259 void NetworkStateHandler::GetNetworkList(NetworkStateList* list) const { | 259 void NetworkStateHandler::GetNetworkList(NetworkStateList* list) const { |
| 260 DCHECK(list); | 260 DCHECK(list); |
| 261 NetworkStateList result; | |
| 262 list->clear(); | 261 list->clear(); |
| 263 for (ManagedStateList::const_iterator iter = network_list_.begin(); | 262 for (ManagedStateList::const_iterator iter = network_list_.begin(); |
| 264 iter != network_list_.end(); ++iter) { | 263 iter != network_list_.end(); ++iter) { |
| 265 const NetworkState* network = (*iter)->AsNetworkState(); | 264 const NetworkState* network = (*iter)->AsNetworkState(); |
| 266 DCHECK(network); | 265 DCHECK(network); |
| 267 list->push_back(network); | 266 list->push_back(network); |
| 268 } | 267 } |
| 269 } | 268 } |
| 270 | 269 |
| 270 void NetworkStateHandler::GetDeviceList(DeviceStateList* list) const { |
| 271 DCHECK(list); |
| 272 list->clear(); |
| 273 for (ManagedStateList::const_iterator iter = device_list_.begin(); |
| 274 iter != device_list_.end(); ++iter) { |
| 275 const DeviceState* device = (*iter)->AsDeviceState(); |
| 276 DCHECK(device); |
| 277 list->push_back(device); |
| 278 } |
| 279 } |
| 280 |
| 271 void NetworkStateHandler::RequestScan() const { | 281 void NetworkStateHandler::RequestScan() const { |
| 272 NET_LOG_USER("RequestScan", ""); | 282 NET_LOG_USER("RequestScan", ""); |
| 273 shill_property_handler_->RequestScan(); | 283 shill_property_handler_->RequestScan(); |
| 274 } | 284 } |
| 275 | 285 |
| 276 void NetworkStateHandler::WaitForScan(const std::string& type, | 286 void NetworkStateHandler::WaitForScan(const std::string& type, |
| 277 const base::Closure& callback) { | 287 const base::Closure& callback) { |
| 278 scan_complete_callbacks_[type].push_back(callback); | 288 scan_complete_callbacks_[type].push_back(callback); |
| 279 if (!GetScanningByType(type)) | 289 if (!GetScanningByType(type)) |
| 280 RequestScan(); | 290 RequestScan(); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 } | 629 } |
| 620 if (type == kMatchTypeDefault || type == kMatchTypeNonVirtual || | 630 if (type == kMatchTypeDefault || type == kMatchTypeNonVirtual || |
| 621 type == kMatchTypeWireless) { | 631 type == kMatchTypeWireless) { |
| 622 NOTREACHED(); | 632 NOTREACHED(); |
| 623 return flimflam::kTypeWifi; | 633 return flimflam::kTypeWifi; |
| 624 } | 634 } |
| 625 return type; | 635 return type; |
| 626 } | 636 } |
| 627 | 637 |
| 628 } // namespace chromeos | 638 } // namespace chromeos |
| OLD | NEW |