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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
582 NotifyNetworkListChanged(); | 582 NotifyNetworkListChanged(); |
583 return true; | 583 return true; |
584 } | 584 } |
585 | 585 |
586 bool NetworkStateHandler::RemoveTetherNetworkState(const std::string& guid) { | 586 bool NetworkStateHandler::RemoveTetherNetworkState(const std::string& guid) { |
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 | |
Kyle Horimoto
2017/05/03 01:53:34
nit: Remove changes to functions you did not edit.
lesliewatkins
2017/05/03 22:00:24
Done.
| |
592 if (wifi_network) | 593 if (wifi_network) |
593 wifi_network->set_tether_guid(std::string()); | 594 wifi_network->set_tether_guid(std::string()); |
594 | 595 |
595 tether_network_list_.erase(iter); | 596 tether_network_list_.erase(iter); |
596 NotifyNetworkListChanged(); | 597 NotifyNetworkListChanged(); |
598 | |
597 return true; | 599 return true; |
598 } | 600 } |
599 } | 601 } |
602 return false; | |
603 } | |
600 | 604 |
601 return false; | 605 bool NetworkStateHandler::DisassociateTetherNetworkStateWithWifiNetwork( |
606 const std::string& tether_network_guid, | |
607 const std::string& wifi_network_guid) { | |
608 bool success = true; | |
609 | |
610 NetworkState* tether_network = | |
611 GetModifiableNetworkStateFromGuid(tether_network_guid); | |
612 NetworkState* wifi_network = | |
613 GetModifiableNetworkStateFromGuid(wifi_network_guid); | |
614 | |
615 if (!tether_network) { | |
616 NET_LOG(ERROR) << "Tether network with guid " << tether_network_guid | |
Kyle Horimoto
2017/05/03 01:53:34
nit: Make your log more descriptive to tell which
lesliewatkins
2017/05/03 22:00:25
Done.
| |
617 << " doesn\'t exist.\n"; | |
Kyle Horimoto
2017/05/03 01:53:34
nit: You don't need to escape an apostrophe. Same
lesliewatkins
2017/05/03 22:00:25
Done.
| |
618 success = false; | |
619 } else { | |
620 tether_network->set_tether_guid(std::string()); | |
621 } | |
622 | |
623 if (!wifi_network) { | |
624 NET_LOG(ERROR) << "Wi-Fi network with guid " << wifi_network_guid | |
625 << " doesn\'t exist.\n"; | |
626 success = false; | |
627 } else { | |
628 wifi_network->set_tether_guid(std::string()); | |
629 } | |
630 | |
Kyle Horimoto
2017/05/03 01:53:34
You need to call NotifyNetworkListChanged() if at
lesliewatkins
2017/05/03 22:00:24
Done.
| |
631 return success; | |
602 } | 632 } |
603 | 633 |
604 bool NetworkStateHandler::AssociateTetherNetworkStateWithWifiNetwork( | 634 bool NetworkStateHandler::AssociateTetherNetworkStateWithWifiNetwork( |
605 const std::string& tether_network_guid, | 635 const std::string& tether_network_guid, |
606 const std::string& wifi_network_guid) { | 636 const std::string& wifi_network_guid) { |
607 if (tether_technology_state_ != TECHNOLOGY_ENABLED) { | 637 if (tether_technology_state_ != TECHNOLOGY_ENABLED) { |
608 NET_LOG(ERROR) << "AssociateTetherNetworkStateWithWifiNetwork() called " | 638 NET_LOG(ERROR) << "AssociateTetherNetworkStateWithWifiNetwork() called " |
609 << "when Tether networks are not enabled. Cannot " | 639 << "when Tether networks are not enabled. Cannot " |
610 << "associate."; | 640 << "associate."; |
611 return false; | 641 return false; |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1443 if (type.MatchesType(shill::kTypeVPN)) | 1473 if (type.MatchesType(shill::kTypeVPN)) |
1444 technologies.emplace_back(shill::kTypeVPN); | 1474 technologies.emplace_back(shill::kTypeVPN); |
1445 if (type.MatchesType(kTypeTether)) | 1475 if (type.MatchesType(kTypeTether)) |
1446 technologies.emplace_back(kTypeTether); | 1476 technologies.emplace_back(kTypeTether); |
1447 | 1477 |
1448 CHECK_GT(technologies.size(), 0ul); | 1478 CHECK_GT(technologies.size(), 0ul); |
1449 return technologies; | 1479 return technologies; |
1450 } | 1480 } |
1451 | 1481 |
1452 } // namespace chromeos | 1482 } // namespace chromeos |
OLD | NEW |