OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_connection_handler.h" | 5 #include "chromeos/network/network_connection_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 | 812 |
813 if (!only_policy_autoconnect) | 813 if (!only_policy_autoconnect) |
814 return; | 814 return; |
815 | 815 |
816 NET_LOG_DEBUG("DisconnectIfPolicyRequires", | 816 NET_LOG_DEBUG("DisconnectIfPolicyRequires", |
817 "Disconnecting unmanaged and shared networks if any exist."); | 817 "Disconnecting unmanaged and shared networks if any exist."); |
818 | 818 |
819 // Get the list of unmanaged & shared networks that are connected or | 819 // Get the list of unmanaged & shared networks that are connected or |
820 // connecting. | 820 // connecting. |
821 NetworkStateHandler::NetworkStateList networks; | 821 NetworkStateHandler::NetworkStateList networks; |
822 network_state_handler_->GetNetworkListByType(NetworkTypePattern::Wireless(), | 822 network_state_handler_->GetVisibleNetworkListByType( |
823 &networks); | 823 NetworkTypePattern::Wireless(), &networks); |
824 for (NetworkStateHandler::NetworkStateList::const_iterator it = | 824 for (NetworkStateHandler::NetworkStateList::const_iterator it = |
825 networks.begin(); | 825 networks.begin(); |
826 it != networks.end(); | 826 it != networks.end(); |
827 ++it) { | 827 ++it) { |
828 const NetworkState* network = *it; | 828 const NetworkState* network = *it; |
829 if (!(network->IsConnectingState() || network->IsConnectedState())) | 829 if (!(network->IsConnectingState() || network->IsConnectedState())) |
830 break; // Connected and connecting networks are listed first. | 830 break; // Connected and connecting networks are listed first. |
831 | 831 |
832 if (network->IsPrivate()) | 832 if (network->IsPrivate()) |
833 continue; | 833 continue; |
834 | 834 |
835 const bool network_is_policy_managed = | 835 const bool network_is_policy_managed = |
836 !network->profile_path().empty() && !network->guid().empty() && | 836 !network->profile_path().empty() && !network->guid().empty() && |
837 managed_configuration_handler_->FindPolicyByGuidAndProfile( | 837 managed_configuration_handler_->FindPolicyByGuidAndProfile( |
838 network->guid(), network->profile_path()); | 838 network->guid(), network->profile_path()); |
839 if (network_is_policy_managed) | 839 if (network_is_policy_managed) |
840 continue; | 840 continue; |
841 | 841 |
842 NET_LOG_EVENT("Disconnect Forced by Policy", network->path()); | 842 NET_LOG_EVENT("Disconnect Forced by Policy", network->path()); |
843 CallShillDisconnect( | 843 CallShillDisconnect( |
844 network->path(), base::Closure(), network_handler::ErrorCallback()); | 844 network->path(), base::Closure(), network_handler::ErrorCallback()); |
845 } | 845 } |
846 | 846 |
847 ConnectToBestNetworkAfterLogin(); | 847 ConnectToBestNetworkAfterLogin(); |
848 } | 848 } |
849 | 849 |
850 } // namespace chromeos | 850 } // namespace chromeos |
OLD | NEW |