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_->GetNetworkListByType( |
stevenjb
2014/05/28 23:06:10
GetVisibleNetworksByType?
| |
823 &networks); | 823 NetworkTypePattern::Wireless(), |
824 false /* configured_only */, | |
825 true /* visible_only */, | |
826 0 /* no limit */, | |
827 &networks); | |
824 for (NetworkStateHandler::NetworkStateList::const_iterator it = | 828 for (NetworkStateHandler::NetworkStateList::const_iterator it = |
825 networks.begin(); | 829 networks.begin(); |
826 it != networks.end(); | 830 it != networks.end(); |
827 ++it) { | 831 ++it) { |
828 const NetworkState* network = *it; | 832 const NetworkState* network = *it; |
829 if (!(network->IsConnectingState() || network->IsConnectedState())) | 833 if (!(network->IsConnectingState() || network->IsConnectedState())) |
830 break; // Connected and connecting networks are listed first. | 834 break; // Connected and connecting networks are listed first. |
831 | 835 |
832 if (network->IsPrivate()) | 836 if (network->IsPrivate()) |
833 continue; | 837 continue; |
834 | 838 |
835 const bool network_is_policy_managed = | 839 const bool network_is_policy_managed = |
836 !network->profile_path().empty() && !network->guid().empty() && | 840 !network->profile_path().empty() && !network->guid().empty() && |
837 managed_configuration_handler_->FindPolicyByGuidAndProfile( | 841 managed_configuration_handler_->FindPolicyByGuidAndProfile( |
838 network->guid(), network->profile_path()); | 842 network->guid(), network->profile_path()); |
839 if (network_is_policy_managed) | 843 if (network_is_policy_managed) |
840 continue; | 844 continue; |
841 | 845 |
842 NET_LOG_EVENT("Disconnect Forced by Policy", network->path()); | 846 NET_LOG_EVENT("Disconnect Forced by Policy", network->path()); |
843 CallShillDisconnect( | 847 CallShillDisconnect( |
844 network->path(), base::Closure(), network_handler::ErrorCallback()); | 848 network->path(), base::Closure(), network_handler::ErrorCallback()); |
845 } | 849 } |
846 | 850 |
847 ConnectToBestNetworkAfterLogin(); | 851 ConnectToBestNetworkAfterLogin(); |
848 } | 852 } |
849 | 853 |
850 } // namespace chromeos | 854 } // namespace chromeos |
OLD | NEW |