Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: chromeos/network/network_state_handler.cc

Issue 2819303002: Changed wifi arcs to mobile bars for Tether network. (Closed)
Patch Set: Fixed small typo preventing unit tests from building. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 << " not registered; could not remove association.";
613 return false;
614 }
615
616 std::string wifi_network_guid = tether_network->tether_guid();
617 NetworkState* wifi_network =
618 GetModifiableNetworkStateFromGuid(wifi_network_guid);
619
620 if (!wifi_network) {
621 NET_LOG(ERROR) << "DisassociateTetherNetworkStateWithWifiNetwork(): Wi-Fi "
622 << "network with ID " << wifi_network_guid
623 << " not registered; could not remove association.";
624 return false;
625 }
626
627 wifi_network->set_tether_guid(std::string());
628 tether_network->set_tether_guid(std::string());
629
630 NotifyNetworkListChanged();
631
632 return true;
602 } 633 }
603 634
604 bool NetworkStateHandler::AssociateTetherNetworkStateWithWifiNetwork( 635 bool NetworkStateHandler::AssociateTetherNetworkStateWithWifiNetwork(
605 const std::string& tether_network_guid, 636 const std::string& tether_network_guid,
606 const std::string& wifi_network_guid) { 637 const std::string& wifi_network_guid) {
607 if (tether_technology_state_ != TECHNOLOGY_ENABLED) { 638 if (tether_technology_state_ != TECHNOLOGY_ENABLED) {
608 NET_LOG(ERROR) << "AssociateTetherNetworkStateWithWifiNetwork() called " 639 NET_LOG(ERROR) << "AssociateTetherNetworkStateWithWifiNetwork() called "
609 << "when Tether networks are not enabled. Cannot " 640 << "when Tether networks are not enabled. Cannot "
610 << "associate."; 641 << "associate.";
611 return false; 642 return false;
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 if (type.MatchesType(shill::kTypeVPN)) 1474 if (type.MatchesType(shill::kTypeVPN))
1444 technologies.emplace_back(shill::kTypeVPN); 1475 technologies.emplace_back(shill::kTypeVPN);
1445 if (type.MatchesType(kTypeTether)) 1476 if (type.MatchesType(kTypeTether))
1446 technologies.emplace_back(kTypeTether); 1477 technologies.emplace_back(kTypeTether);
1447 1478
1448 CHECK_GT(technologies.size(), 0ul); 1479 CHECK_GT(technologies.size(), 0ul);
1449 return technologies; 1480 return technologies;
1450 } 1481 }
1451 1482
1452 } // namespace chromeos 1483 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698