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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
587 for (auto iter = tether_network_list_.begin(); | 587 for (auto iter = tether_network_list_.begin(); |
588 iter != tether_network_list_.end(); ++iter) { | 588 iter != tether_network_list_.end(); ++iter) { |
589 if (iter->get()->AsNetworkState()->guid() == guid) { | 589 if (iter->get()->AsNetworkState()->guid() == guid) { |
590 NetworkState* wifi_network = GetModifiableNetworkStateFromGuid( | 590 NetworkState* wifi_network = GetModifiableNetworkStateFromGuid( |
591 iter->get()->AsNetworkState()->tether_guid()); | 591 iter->get()->AsNetworkState()->tether_guid()); |
592 if (wifi_network) | 592 if (wifi_network) |
593 wifi_network->set_tether_guid(std::string()); | 593 wifi_network->set_tether_guid(std::string()); |
594 | 594 |
595 tether_network_list_.erase(iter); | 595 tether_network_list_.erase(iter); |
596 NotifyNetworkListChanged(); | 596 NotifyNetworkListChanged(); |
597 | |
597 return true; | 598 return true; |
598 } | 599 } |
599 } | 600 } |
601 return false; | |
602 } | |
600 | 603 |
601 return false; | 604 bool NetworkStateHandler::DisassociateTetherNetworkStateFromWifiNetwork( |
605 const std::string& tether_network_guid) { | |
606 NetworkState* tether_network = | |
607 GetModifiableNetworkStateFromGuid(tether_network_guid); | |
608 | |
609 if (!tether_network) { | |
610 NET_LOG(ERROR) << "DisassociateTetherNetworkStateWithWifiNetwork(): Tether " | |
611 << "network with ID " << tether_network_guid | |
612 << " " | |
613 "not registered; could not remove association."; | |
stevenjb
2017/05/04 17:21:27
What Kyle meant was:
NET_LOG(ERROR) << "Disassocia
lesliewatkins
2017/05/04 17:31:04
Done.
| |
614 return false; | |
615 } | |
616 | |
617 std::string wifi_network_guid = tether_network->tether_guid(); | |
618 NetworkState* wifi_network = | |
619 GetModifiableNetworkStateFromGuid(wifi_network_guid); | |
620 | |
621 if (!wifi_network) { | |
622 NET_LOG(ERROR) << "DisassociateTetherNetworkStateWithWifiNetwork(): Wi-Fi " | |
623 << "network with ID " << wifi_network_guid | |
624 << " not registered; could not remove association."; | |
stevenjb
2017/05/04 17:21:27
nit: Same " " issue here (but as Kyle mentioned, i
lesliewatkins
2017/05/04 17:31:04
Done.
| |
625 return false; | |
626 } | |
627 | |
628 wifi_network->set_tether_guid(std::string()); | |
629 tether_network->set_tether_guid(std::string()); | |
630 | |
631 NotifyNetworkListChanged(); | |
632 | |
633 return true; | |
602 } | 634 } |
603 | 635 |
604 bool NetworkStateHandler::AssociateTetherNetworkStateWithWifiNetwork( | 636 bool NetworkStateHandler::AssociateTetherNetworkStateWithWifiNetwork( |
605 const std::string& tether_network_guid, | 637 const std::string& tether_network_guid, |
606 const std::string& wifi_network_guid) { | 638 const std::string& wifi_network_guid) { |
607 if (tether_technology_state_ != TECHNOLOGY_ENABLED) { | 639 if (tether_technology_state_ != TECHNOLOGY_ENABLED) { |
608 NET_LOG(ERROR) << "AssociateTetherNetworkStateWithWifiNetwork() called " | 640 NET_LOG(ERROR) << "AssociateTetherNetworkStateWithWifiNetwork() called " |
609 << "when Tether networks are not enabled. Cannot " | 641 << "when Tether networks are not enabled. Cannot " |
610 << "associate."; | 642 << "associate."; |
611 return false; | 643 return false; |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1443 if (type.MatchesType(shill::kTypeVPN)) | 1475 if (type.MatchesType(shill::kTypeVPN)) |
1444 technologies.emplace_back(shill::kTypeVPN); | 1476 technologies.emplace_back(shill::kTypeVPN); |
1445 if (type.MatchesType(kTypeTether)) | 1477 if (type.MatchesType(kTypeTether)) |
1446 technologies.emplace_back(kTypeTether); | 1478 technologies.emplace_back(kTypeTether); |
1447 | 1479 |
1448 CHECK_GT(technologies.size(), 0ul); | 1480 CHECK_GT(technologies.size(), 0ul); |
1449 return technologies; | 1481 return technologies; |
1450 } | 1482 } |
1451 | 1483 |
1452 } // namespace chromeos | 1484 } // namespace chromeos |
OLD | NEW |