Chromium Code Reviews| Index: chromeos/network/network_state.cc |
| diff --git a/chromeos/network/network_state.cc b/chromeos/network/network_state.cc |
| index a20e22ca3c4881bac3b47ce599f6751fd72d90af..2fbba25d34aa889b1eb50de3282b4ac8d2d83d4d 100644 |
| --- a/chromeos/network/network_state.cc |
| +++ b/chromeos/network/network_state.cc |
| @@ -15,6 +15,7 @@ |
| #include "chromeos/network/network_util.h" |
| #include "chromeos/network/onc/onc_utils.h" |
| #include "chromeos/network/shill_property_util.h" |
| +#include "chromeos/network/tether_constants.h" |
| #include "components/device_event_log/device_event_log.h" |
| #include "third_party/cros_system_api/dbus/service_constants.h" |
| @@ -292,6 +293,18 @@ void NetworkState::GetStateProperties(base::DictionaryValue* dictionary) const { |
| dictionary->SetBooleanWithoutPathExpansion(shill::kOutOfCreditsProperty, |
| cellular_out_of_credits()); |
| } |
| + |
| + // Tether properties |
| + if (NetworkTypePattern::Tether().MatchesType(type())) { |
| + DCHECK(!carrier().empty()); |
| + DCHECK(battery_percentage() >= 0 && battery_percentage() <= 100); |
| + DCHECK(signal_strength() >= 0 && signal_strength() <= 100); |
|
Ryan Hansberry
2017/04/18 16:08:55
0 <= signal strength <= 4
Kyle Horimoto
2017/04/18 17:15:23
Not on Chrome OS.
|
| + dictionary->SetIntegerWithoutPathExpansion(kTetherBatteryPercentage, |
| + battery_percentage()); |
|
Ryan Hansberry
2017/04/18 16:08:55
nit: the dchecks are in order 1. carrier, 2. batte
Kyle Horimoto
2017/04/18 17:15:23
Done.
|
| + dictionary->SetStringWithoutPathExpansion(kTetherCarrier, carrier()); |
| + dictionary->SetIntegerWithoutPathExpansion(kTetherSignalStrength, |
| + signal_strength()); |
| + } |
| } |
| void NetworkState::IPConfigPropertiesChanged( |
| @@ -350,6 +363,21 @@ void NetworkState::set_connection_state(const std::string connection_state) { |
| connection_state_ = connection_state; |
| } |
| +void NetworkState::SetTetherSignalStrength(int signal_strength) { |
| + DCHECK(kTypeTether == type()); |
|
Ryan Hansberry
2017/04/18 16:08:55
This is kind of odd looking -- can you use Equals(
Kyle Horimoto
2017/04/18 17:15:23
I'm not sure what you mean. std::string doesn't ha
|
| + signal_strength_ = signal_strength; |
| +} |
| + |
| +void NetworkState::SetBatteryPercentage(int battery_percentage) { |
| + DCHECK(kTypeTether == type()); |
| + battery_percentage_ = battery_percentage; |
| +} |
| + |
| +void NetworkState::SetCarrier(const std::string& carrier) { |
| + DCHECK(kTypeTether == type()); |
| + carrier_ = carrier; |
| +} |
| + |
| bool NetworkState::IsDynamicWep() const { |
| return security_class_ == shill::kSecurityWep && |
| eap_key_mgmt_ == shill::kKeyManagementIEEE8021X; |