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

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

Issue 22611005: Switch over MobileActivator to use Network*Handler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ws Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chromeos/network/network_state_handler.h ('k') | 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/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 std::string result; 270 std::string result;
271 for (size_t i = 0; i < address.size(); ++i) { 271 for (size_t i = 0; i < address.size(); ++i) {
272 if ((i != 0) && (i % 2 == 0)) 272 if ((i != 0) && (i % 2 == 0))
273 result.push_back(':'); 273 result.push_back(':');
274 result.push_back(address[i]); 274 result.push_back(address[i]);
275 } 275 }
276 return result; 276 return result;
277 } 277 }
278 278
279 void NetworkStateHandler::GetNetworkList(NetworkStateList* list) const { 279 void NetworkStateHandler::GetNetworkList(NetworkStateList* list) const {
280 GetNetworkListByType(kMatchTypeDefault, list);
281 }
282
283 void NetworkStateHandler::GetNetworkListByType(const std::string& type,
284 NetworkStateList* list) const {
280 DCHECK(list); 285 DCHECK(list);
281 list->clear(); 286 list->clear();
282 for (ManagedStateList::const_iterator iter = network_list_.begin(); 287 for (ManagedStateList::const_iterator iter = network_list_.begin();
283 iter != network_list_.end(); ++iter) { 288 iter != network_list_.end(); ++iter) {
284 if (!(*iter)->update_received()) 289 if (!(*iter)->update_received())
285 continue; 290 continue;
286 const NetworkState* network = (*iter)->AsNetworkState(); 291 const NetworkState* network = (*iter)->AsNetworkState();
287 DCHECK(network); 292 DCHECK(network);
288 list->push_back(network); 293 if (ManagedStateMatchesType(network, type))
294 list->push_back(network);
289 } 295 }
290 } 296 }
291 297
292 void NetworkStateHandler::GetDeviceList(DeviceStateList* list) const { 298 void NetworkStateHandler::GetDeviceList(DeviceStateList* list) const {
293 DCHECK(list); 299 DCHECK(list);
294 list->clear(); 300 list->clear();
295 for (ManagedStateList::const_iterator iter = device_list_.begin(); 301 for (ManagedStateList::const_iterator iter = device_list_.begin();
296 iter != device_list_.end(); ++iter) { 302 iter != device_list_.end(); ++iter) {
297 if (!(*iter)->update_received()) 303 if (!(*iter)->update_received())
298 continue; 304 continue;
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 } 723 }
718 if (type == kMatchTypeDefault || type == kMatchTypeNonVirtual || 724 if (type == kMatchTypeDefault || type == kMatchTypeNonVirtual ||
719 type == kMatchTypeWireless) { 725 type == kMatchTypeWireless) {
720 NOTREACHED(); 726 NOTREACHED();
721 return flimflam::kTypeWifi; 727 return flimflam::kTypeWifi;
722 } 728 }
723 return type; 729 return type;
724 } 730 }
725 731
726 } // namespace chromeos 732 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_state_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698