Chromium Code Reviews| Index: chromeos/network/network_state_handler.cc |
| diff --git a/chromeos/network/network_state_handler.cc b/chromeos/network/network_state_handler.cc |
| index fbb75d5b9d0e9ce557c40c70cb3ca60eb73c4ae8..6d477b7f3d6832cb9a3461a56f0dbe85d368226a 100644 |
| --- a/chromeos/network/network_state_handler.cc |
| +++ b/chromeos/network/network_state_handler.cc |
| @@ -271,9 +271,7 @@ void NetworkStateHandler::GetNetworkListByType(const NetworkTypePattern& type, |
| iter != network_list_.end(); ++iter) { |
| const NetworkState* network = (*iter)->AsNetworkState(); |
| DCHECK(network); |
| - if (!network->update_received()) |
| - continue; |
| - if (network->Matches(type)) |
| + if (network->update_received() && network->Matches(type)) |
| list->push_back(network); |
| } |
| } |
| @@ -285,13 +283,17 @@ void NetworkStateHandler::GetDeviceList(DeviceStateList* list) const { |
| iter != device_list_.end(); ++iter) { |
| const DeviceState* device = (*iter)->AsDeviceState(); |
| DCHECK(device); |
| - if (!device->update_received()) |
| - continue; |
| - list->push_back(device); |
| + if (device->update_received()) |
| + list->push_back(device); |
| } |
| } |
| void NetworkStateHandler::GetFavoriteList(FavoriteStateList* list) const { |
| + GetFavoriteListByType(NetworkTypePattern::Default(), list); |
| +} |
| + |
| +void NetworkStateHandler::GetFavoriteListByType(const NetworkTypePattern& type, |
| + FavoriteStateList* list) const { |
| DCHECK(list); |
| FavoriteStateList result; |
| list->clear(); |
| @@ -299,10 +301,10 @@ void NetworkStateHandler::GetFavoriteList(FavoriteStateList* list) const { |
| iter != favorite_list_.end(); ++iter) { |
| const FavoriteState* favorite = (*iter)->AsFavoriteState(); |
| DCHECK(favorite); |
| - if (!favorite->update_received()) |
| - continue; |
| - if (favorite->is_favorite()) |
| + if (favorite->update_received() && favorite->is_favorite() && |
| + favorite->Matches(type)) { |
| list->push_back(favorite); |
| + } |
| } |
| } |
| @@ -362,6 +364,43 @@ void NetworkStateHandler::SetCheckPortalList( |
| shill_property_handler_->SetCheckPortalList(check_portal_list); |
| } |
| +const FavoriteState* NetworkStateHandler::GetEAPForEthernet( |
| + const NetworkStateBase* ethernet) const { |
|
stevenjb
2013/09/16 23:53:24
I don't especially like passing a NetworkState* ba
pneubeck (no reviews)
2013/09/17 12:48:36
Done.
|
| + // The same EAP service is shared for all ethernet services/devices. |
| + // However EAP is used/enabled per device and only if the connection was |
| + // successfully established. |
| + DCHECK(ethernet); |
| + DCHECK(ethernet->type() == flimflam::kTypeEthernet); |
| + const NetworkState* ethernet_service = ethernet->AsNetworkState(); |
| + if (!ethernet_service || !ethernet_service->IsConnectedState()) |
| + return NULL; |
| + const DeviceState* device = GetDeviceState(ethernet_service->device_path()); |
| + if (!device) { |
| + NET_LOG_ERROR( |
| + "GetEAPForEthernet", |
| + base::StringPrintf("Unknown device %s of connected ethernet service %s", |
| + ethernet_service->path().c_str(), |
| + ethernet_service->device_path().c_str())); |
| + return NULL; |
| + } |
| + if (!device->eap_authentication_completed()) |
| + return NULL; |
| + |
| + FavoriteStateList list; |
| + GetFavoriteListByType(NetworkTypePattern::Primitive(shill::kTypeEthernetEap), |
| + &list); |
| + if (list.empty()) { |
| + NET_LOG_ERROR("GetEAPForEthernet", |
| + base::StringPrintf( |
| + "Ethernet service %s connected using EAP, but no " |
| + "EAP service found.", |
| + ethernet_service->path().c_str())); |
| + return NULL; |
| + } |
| + DCHECK(list.size() == 1); |
| + return list.front(); |
| +} |
| + |
| void NetworkStateHandler::GetNetworkStatePropertiesForTest( |
| base::DictionaryValue* dictionary) const { |
| for (ManagedStateList::const_iterator iter = network_list_.begin(); |
| @@ -562,6 +601,22 @@ void NetworkStateHandler::UpdateDeviceProperty(const std::string& device_path, |
| if (key == flimflam::kScanningProperty && device->scanning() == false) |
| ScanCompleted(device->type()); |
| + if (key == shill::kEapAuthenticationCompletedProperty) { |
| + // Notify a change for each Ethernet service using this device. |
| + NetworkStateList ethernet_services; |
| + GetNetworkListByType(NetworkTypePattern::Ethernet(), ðernet_services); |
| + for (NetworkStateList::const_iterator it = ethernet_services.begin(); |
| + it != ethernet_services.end(); ++it) { |
| + const NetworkState* ethernet_service = *it; |
| + if (ethernet_service->update_received() || |
|
stevenjb
2013/09/16 23:53:24
If this is false, then there should be an update i
pneubeck (no reviews)
2013/09/17 12:48:36
The intention here is:
Sometime after you plugin
stevenjb
2013/09/17 16:22:59
In that case we should call RequestUpdateForNetwor
|
| + ethernet_service->device_path() != device->path()) { |
| + continue; |
| + } |
| + if (ethernet_service->path() == default_network_path_) |
| + OnDefaultNetworkChanged(); |
| + NetworkPropertiesUpdated(ethernet_service); |
| + } |
| + } |
| } |
| void NetworkStateHandler::CheckPortalListChanged( |