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/logging.h" | 10 #include "base/logging.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 return NULL; | 184 return NULL; |
185 return GetNetworkState(default_network_path_); | 185 return GetNetworkState(default_network_path_); |
186 } | 186 } |
187 | 187 |
188 const FavoriteState* NetworkStateHandler::DefaultFavoriteNetwork() const { | 188 const FavoriteState* NetworkStateHandler::DefaultFavoriteNetwork() const { |
189 const NetworkState* default_network = DefaultNetwork(); | 189 const NetworkState* default_network = DefaultNetwork(); |
190 if (!default_network) | 190 if (!default_network) |
191 return NULL; | 191 return NULL; |
192 const FavoriteState* default_favorite = | 192 const FavoriteState* default_favorite = |
193 GetFavoriteState(default_network->path()); | 193 GetFavoriteState(default_network->path()); |
194 DCHECK(default_favorite); | 194 DCHECK(default_network->type() != shill::kTypeWifi || |
195 DCHECK(default_favorite->update_received()); | 195 default_favorite) << "No favorite for: " << default_network->path(); |
| 196 DCHECK(!default_favorite || default_favorite->update_received()) |
| 197 << "No update received for: " << default_network->path(); |
196 return default_favorite; | 198 return default_favorite; |
197 } | 199 } |
198 | 200 |
199 const NetworkState* NetworkStateHandler::ConnectedNetworkByType( | 201 const NetworkState* NetworkStateHandler::ConnectedNetworkByType( |
200 const NetworkTypePattern& type) const { | 202 const NetworkTypePattern& type) const { |
201 for (ManagedStateList::const_iterator iter = network_list_.begin(); | 203 for (ManagedStateList::const_iterator iter = network_list_.begin(); |
202 iter != network_list_.end(); ++iter) { | 204 iter != network_list_.end(); ++iter) { |
203 const NetworkState* network = (*iter)->AsNetworkState(); | 205 const NetworkState* network = (*iter)->AsNetworkState(); |
204 DCHECK(network); | 206 DCHECK(network); |
205 if (!network->update_received()) | 207 if (!network->update_received()) |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 } | 833 } |
832 | 834 |
833 if (type.MatchesType(shill::kTypeCellular)) | 835 if (type.MatchesType(shill::kTypeCellular)) |
834 return shill::kTypeCellular; | 836 return shill::kTypeCellular; |
835 | 837 |
836 NOTREACHED(); | 838 NOTREACHED(); |
837 return std::string(); | 839 return std::string(); |
838 } | 840 } |
839 | 841 |
840 } // namespace chromeos | 842 } // namespace chromeos |
OLD | NEW |