Index: chromeos/network/network_state_handler.cc |
diff --git a/chromeos/network/network_state_handler.cc b/chromeos/network/network_state_handler.cc |
index eaed6e9ce3c70e4908cc14f6f4b8b1ca8aae67cc..488c4f0a15580f8fd6a36b30303cdb2f4537ca46 100644 |
--- a/chromeos/network/network_state_handler.cc |
+++ b/chromeos/network/network_state_handler.cc |
@@ -7,6 +7,7 @@ |
#include <stddef.h> |
#include "base/bind.h" |
+#include "base/command_line.h" |
#include "base/format_macros.h" |
#include "base/guid.h" |
#include "base/json/json_string_value_serializer.h" |
@@ -19,6 +20,7 @@ |
#include "base/strings/string_util.h" |
#include "base/strings/stringprintf.h" |
#include "base/values.h" |
+#include "chromeos/chromeos_switches.h" |
#include "chromeos/network/device_state.h" |
#include "chromeos/network/network_event_log.h" |
#include "chromeos/network/network_state.h" |
@@ -133,7 +135,18 @@ NetworkStateHandler::TechnologyState NetworkStateHandler::GetTechnologyState( |
state = TECHNOLOGY_UNINITIALIZED; |
else if (shill_property_handler_->IsTechnologyAvailable(technology)) |
state = TECHNOLOGY_AVAILABLE; |
- else |
+ else if (technology == kTypeTether) { |
+ bool isTetherAvailable = base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ chromeos::switches::kEnableTether); |
+ if (isTetherAvailable) { |
+ // TODO (hansberry): Figure this one out. |
+ bool isTetherEnabled = true; |
+ if (isTetherEnabled) { |
+ return TECHNOLOGY_ENABLED; |
+ } |
+ return TECHNOLOGY_AVAILABLE; |
stevenjb
2017/02/16 22:56:35
Avoid the placeholder code, just return TECHNOLOGY
Ryan Hansberry
2017/02/17 19:29:42
Done. Added testing.
|
+ } |
+ } else |
state = TECHNOLOGY_UNAVAILABLE; |
VLOG(2) << "GetTechnologyState: " << type.ToDebugString() << " = " << state; |
return state; |
@@ -289,6 +302,16 @@ void NetworkStateHandler::GetNetworkListByType(const NetworkTypePattern& type, |
DCHECK(list); |
list->clear(); |
int count = 0; |
+ |
+ if (NetworkTypePattern::Tether().MatchesPattern(type)) { |
+ for (auto iter = tether_network_list_.begin(); |
+ iter != tether_network_list_.end(); ++iter) { |
+ list->push_back((*iter)->AsNetworkState()); |
+ if (limit > 0 && ++count >= limit) |
+ return; |
+ } |
+ } |
+ |
// Sort the network list if necessary. |
if (!network_list_sorted_) |
SortNetworkList(); |
@@ -1028,6 +1051,9 @@ std::string NetworkStateHandler::GetTechnologyForType( |
if (type.MatchesType(shill::kTypeCellular)) |
return shill::kTypeCellular; |
+ if (type.MatchesType(kTypeTether)) |
+ return kTypeTether; |
+ |
NOTREACHED(); |
return std::string(); |
} |