| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 for (size_t i = 0; i < address.size(); ++i) { | 258 for (size_t i = 0; i < address.size(); ++i) { |
| 259 if ((i != 0) && (i % 2 == 0)) | 259 if ((i != 0) && (i % 2 == 0)) |
| 260 result.push_back(':'); | 260 result.push_back(':'); |
| 261 result.push_back(address[i]); | 261 result.push_back(address[i]); |
| 262 } | 262 } |
| 263 return result; | 263 return result; |
| 264 } | 264 } |
| 265 | 265 |
| 266 void NetworkStateHandler::GetNetworkList(NetworkStateList* list) const { | 266 void NetworkStateHandler::GetNetworkList(NetworkStateList* list) const { |
| 267 DCHECK(list); | 267 DCHECK(list); |
| 268 NetworkStateList result; | |
| 269 list->clear(); | 268 list->clear(); |
| 270 for (ManagedStateList::const_iterator iter = network_list_.begin(); | 269 for (ManagedStateList::const_iterator iter = network_list_.begin(); |
| 271 iter != network_list_.end(); ++iter) { | 270 iter != network_list_.end(); ++iter) { |
| 272 const NetworkState* network = (*iter)->AsNetworkState(); | 271 const NetworkState* network = (*iter)->AsNetworkState(); |
| 273 DCHECK(network); | 272 DCHECK(network); |
| 274 list->push_back(network); | 273 list->push_back(network); |
| 275 } | 274 } |
| 276 } | 275 } |
| 277 | 276 |
| 277 void NetworkStateHandler::GetDeviceList(DeviceStateList* list) const { |
| 278 DCHECK(list); |
| 279 list->clear(); |
| 280 for (ManagedStateList::const_iterator iter = device_list_.begin(); |
| 281 iter != device_list_.end(); ++iter) { |
| 282 const DeviceState* device = (*iter)->AsDeviceState(); |
| 283 DCHECK(device); |
| 284 list->push_back(device); |
| 285 } |
| 286 } |
| 287 |
| 278 void NetworkStateHandler::GetFavoriteList(FavoriteStateList* list) const { | 288 void NetworkStateHandler::GetFavoriteList(FavoriteStateList* list) const { |
| 279 DCHECK(list); | 289 DCHECK(list); |
| 280 FavoriteStateList result; | 290 FavoriteStateList result; |
| 281 list->clear(); | 291 list->clear(); |
| 282 for (ManagedStateList::const_iterator iter = favorite_list_.begin(); | 292 for (ManagedStateList::const_iterator iter = favorite_list_.begin(); |
| 283 iter != favorite_list_.end(); ++iter) { | 293 iter != favorite_list_.end(); ++iter) { |
| 284 const FavoriteState* favorite = (*iter)->AsFavoriteState(); | 294 const FavoriteState* favorite = (*iter)->AsFavoriteState(); |
| 285 DCHECK(favorite); | 295 DCHECK(favorite); |
| 286 if (favorite->is_favorite()) | 296 if (favorite->is_favorite()) |
| 287 list->push_back(favorite); | 297 list->push_back(favorite); |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 } | 689 } |
| 680 if (type == kMatchTypeDefault || type == kMatchTypeNonVirtual || | 690 if (type == kMatchTypeDefault || type == kMatchTypeNonVirtual || |
| 681 type == kMatchTypeWireless) { | 691 type == kMatchTypeWireless) { |
| 682 NOTREACHED(); | 692 NOTREACHED(); |
| 683 return flimflam::kTypeWifi; | 693 return flimflam::kTypeWifi; |
| 684 } | 694 } |
| 685 return type; | 695 return type; |
| 686 } | 696 } |
| 687 | 697 |
| 688 } // namespace chromeos | 698 } // namespace chromeos |
| OLD | NEW |