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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 return NULL; | 188 return NULL; |
189 return network; | 189 return network; |
190 } | 190 } |
191 | 191 |
192 const FavoriteState* NetworkStateHandler::DefaultFavoriteNetwork() const { | 192 const FavoriteState* NetworkStateHandler::DefaultFavoriteNetwork() const { |
193 const NetworkState* default_network = DefaultNetwork(); | 193 const NetworkState* default_network = DefaultNetwork(); |
194 if (!default_network) | 194 if (!default_network) |
195 return NULL; | 195 return NULL; |
196 const FavoriteState* default_favorite = | 196 const FavoriteState* default_favorite = |
197 GetFavoriteState(default_network->path()); | 197 GetFavoriteState(default_network->path()); |
198 DCHECK(default_favorite); | 198 DCHECK(default_network->type() != shill::kTypeWifi || |
199 DCHECK(default_favorite->update_received()); | 199 default_favorite) << "No favorite for: " << default_network->path(); |
| 200 DCHECK(!default_favorite || default_favorite->update_received()) |
| 201 << "No update received for: " << default_network->path(); |
200 return default_favorite; | 202 return default_favorite; |
201 } | 203 } |
202 | 204 |
203 const NetworkState* NetworkStateHandler::ConnectedNetworkByType( | 205 const NetworkState* NetworkStateHandler::ConnectedNetworkByType( |
204 const NetworkTypePattern& type) const { | 206 const NetworkTypePattern& type) const { |
205 for (ManagedStateList::const_iterator iter = network_list_.begin(); | 207 for (ManagedStateList::const_iterator iter = network_list_.begin(); |
206 iter != network_list_.end(); ++iter) { | 208 iter != network_list_.end(); ++iter) { |
207 const NetworkState* network = (*iter)->AsNetworkState(); | 209 const NetworkState* network = (*iter)->AsNetworkState(); |
208 DCHECK(network); | 210 DCHECK(network); |
209 if (!network->update_received()) | 211 if (!network->update_received()) |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 } | 813 } |
812 | 814 |
813 if (type.MatchesType(shill::kTypeCellular)) | 815 if (type.MatchesType(shill::kTypeCellular)) |
814 return shill::kTypeCellular; | 816 return shill::kTypeCellular; |
815 | 817 |
816 NOTREACHED(); | 818 NOTREACHED(); |
817 return std::string(); | 819 return std::string(); |
818 } | 820 } |
819 | 821 |
820 } // namespace chromeos | 822 } // namespace chromeos |
OLD | NEW |