Chromium Code Reviews| 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/guid.h" | 9 #include "base/guid.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 556 if (ConnectionStateChanged(network, prev_connection_state)) { | 556 if (ConnectionStateChanged(network, prev_connection_state)) { |
| 557 OnNetworkConnectionStateChanged(network); | 557 OnNetworkConnectionStateChanged(network); |
| 558 // If the connection state changes, other properties such as IPConfig | 558 // If the connection state changes, other properties such as IPConfig |
| 559 // may have changed, so request a full update. | 559 // may have changed, so request a full update. |
| 560 RequestUpdateForNetwork(service_path); | 560 RequestUpdateForNetwork(service_path); |
| 561 } | 561 } |
| 562 } else { | 562 } else { |
| 563 std::string value_str; | 563 std::string value_str; |
| 564 value.GetAsString(&value_str); | 564 value.GetAsString(&value_str); |
| 565 // Some property changes are noisy and not interesting: | 565 // Some property changes are noisy and not interesting: |
| 566 // * Wifi SignalStrength | 566 // * Wifi or WiMAX SignalStrength |
| 567 // * WifiFrequencyList updates | 567 // * WifiFrequencyList updates |
| 568 // * Device property changes to "/" (occurs before a service is removed) | 568 // * Device property changes to "/" (occurs before a service is removed) |
| 569 if (key != shill::kSignalStrengthProperty && | 569 if (key != shill::kSignalStrengthProperty && |
| 570 key != shill::kWifiFrequencyListProperty && | 570 key != shill::kWifiFrequencyListProperty && |
| 571 (key != shill::kDeviceProperty || value_str != "/")) { | 571 (key != shill::kDeviceProperty || value_str != "/")) { |
| 572 std::string log_event = "NetworkPropertyUpdated"; | 572 std::string log_event = "NetworkPropertyUpdated"; |
| 573 // Trigger a default network update for interesting changes only. | 573 // Trigger a default network update for interesting changes only. |
| 574 if (network->path() == default_network_path_) { | 574 if (network->path() == default_network_path_) { |
| 575 NotifyDefaultNetworkChanged(network); | 575 NotifyDefaultNetworkChanged(network); |
| 576 log_event = "Default" + log_event; | 576 log_event = "Default" + log_event; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 696 NotifyDeviceListChanged(); | 696 NotifyDeviceListChanged(); |
| 697 } else { | 697 } else { |
| 698 NOTREACHED(); | 698 NOTREACHED(); |
| 699 } | 699 } |
| 700 } | 700 } |
| 701 | 701 |
| 702 void NetworkStateHandler::SortNetworkList() { | 702 void NetworkStateHandler::SortNetworkList() { |
| 703 // Note: usually active networks will precede inactive networks, however | 703 // Note: usually active networks will precede inactive networks, however |
| 704 // this may briefly be untrue during state transitions (e.g. a network may | 704 // this may briefly be untrue during state transitions (e.g. a network may |
| 705 // transition to idle before the list is updated). | 705 // transition to idle before the list is updated). |
| 706 // Handle WiMAX in the same way as WiFi. | |
|
stevenjb
2014/09/17 16:49:04
nit: I think we should probably handle Wimax like
pneubeck (no reviews)
2014/09/17 20:10:47
Sorry, this is a leftover from me debugging the AP
| |
| 706 ManagedStateList active, non_wifi_visible, wifi_visible, hidden, new_networks; | 707 ManagedStateList active, non_wifi_visible, wifi_visible, hidden, new_networks; |
| 707 for (ManagedStateList::iterator iter = network_list_.begin(); | 708 for (ManagedStateList::iterator iter = network_list_.begin(); |
| 708 iter != network_list_.end(); ++iter) { | 709 iter != network_list_.end(); ++iter) { |
| 709 NetworkState* network = (*iter)->AsNetworkState(); | 710 NetworkState* network = (*iter)->AsNetworkState(); |
| 710 if (!network->update_received()) { | 711 if (!network->update_received()) { |
| 711 new_networks.push_back(network); | 712 new_networks.push_back(network); |
| 712 continue; | 713 continue; |
| 713 } | 714 } |
| 714 if (network->IsConnectedState() || network->IsConnectingState()) { | 715 if (network->IsConnectedState() || network->IsConnectingState()) { |
| 715 active.push_back(network); | 716 active.push_back(network); |
| 716 continue; | 717 continue; |
| 717 } | 718 } |
| 718 if (network->visible()) { | 719 if (network->visible()) { |
| 719 if (NetworkTypePattern::WiFi().MatchesType(network->type())) | 720 if (NetworkTypePattern::WiFi().MatchesType(network->type()) || |
| 721 NetworkTypePattern::Wimax().MatchesType(network->type())) { | |
| 720 wifi_visible.push_back(network); | 722 wifi_visible.push_back(network); |
| 721 else | 723 } else { |
| 722 non_wifi_visible.push_back(network); | 724 non_wifi_visible.push_back(network); |
| 725 } | |
| 723 } else { | 726 } else { |
| 724 hidden.push_back(network); | 727 hidden.push_back(network); |
| 725 } | 728 } |
| 726 } | 729 } |
| 727 network_list_.clear(); | 730 network_list_.clear(); |
| 728 network_list_.insert(network_list_.end(), active.begin(), active.end()); | 731 network_list_.insert(network_list_.end(), active.begin(), active.end()); |
| 729 network_list_.insert( | 732 network_list_.insert( |
| 730 network_list_.end(), non_wifi_visible.begin(), non_wifi_visible.end()); | 733 network_list_.end(), non_wifi_visible.begin(), non_wifi_visible.end()); |
| 731 network_list_.insert( | 734 network_list_.insert( |
| 732 network_list_.end(), wifi_visible.begin(), wifi_visible.end()); | 735 network_list_.end(), wifi_visible.begin(), wifi_visible.end()); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 958 if (type.MatchesType(shill::kTypeBluetooth)) | 961 if (type.MatchesType(shill::kTypeBluetooth)) |
| 959 technologies.push_back(new std::string(shill::kTypeBluetooth)); | 962 technologies.push_back(new std::string(shill::kTypeBluetooth)); |
| 960 if (type.MatchesType(shill::kTypeVPN)) | 963 if (type.MatchesType(shill::kTypeVPN)) |
| 961 technologies.push_back(new std::string(shill::kTypeVPN)); | 964 technologies.push_back(new std::string(shill::kTypeVPN)); |
| 962 | 965 |
| 963 CHECK_GT(technologies.size(), 0ul); | 966 CHECK_GT(technologies.size(), 0ul); |
| 964 return technologies.Pass(); | 967 return technologies.Pass(); |
| 965 } | 968 } |
| 966 | 969 |
| 967 } // namespace chromeos | 970 } // namespace chromeos |
| OLD | NEW |