diff options
Diffstat (limited to 'chromeos/network')
-rw-r--r-- | chromeos/network/network_state.cc | 14 | ||||
-rw-r--r-- | chromeos/network/network_state.h | 5 |
2 files changed, 18 insertions, 1 deletions
diff --git a/chromeos/network/network_state.cc b/chromeos/network/network_state.cc index 6c022bf..df5f825 100644 --- a/chromeos/network/network_state.cc +++ b/chromeos/network/network_state.cc @@ -90,7 +90,14 @@ bool NetworkState::PropertyChanged(const std::string& key, if (key == shill::kSignalStrengthProperty) { return GetIntegerValue(key, value, &signal_strength_); } else if (key == shill::kStateProperty) { - return GetStringValue(key, value, &connection_state_); + std::string saved_state = connection_state_; + if (GetStringValue(key, value, &connection_state_)) { + if (connection_state_ != saved_state) + last_connection_state_ = saved_state; + return true; + } else { + return false; + } } else if (key == shill::kVisibleProperty) { return GetBooleanValue(key, value, &visible_); } else if (key == shill::kConnectableProperty) { @@ -350,6 +357,11 @@ bool NetworkState::IsConnectingState() const { return visible() && StateIsConnecting(connection_state_); } +bool NetworkState::IsReconnecting() const { + return visible() && StateIsConnecting(connection_state_) && + StateIsConnected(last_connection_state_); +} + bool NetworkState::IsInProfile() const { // kTypeEthernetEap is always saved. We need this check because it does // not show up in the visible list, but its properties may not be available diff --git a/chromeos/network/network_state.h b/chromeos/network/network_state.h index 6128a62..24bb8c0 100644 --- a/chromeos/network/network_state.h +++ b/chromeos/network/network_state.h @@ -107,6 +107,10 @@ class CHROMEOS_EXPORT NetworkState : public ManagedState { bool IsConnectedState() const; bool IsConnectingState() const; + // Returns true if |last_connection_state_| is connected, and + // |connection_state_| is connecting. + bool IsReconnecting() const; + // Returns true if this is a network stored in a profile. bool IsInProfile() const; @@ -161,6 +165,7 @@ class CHROMEOS_EXPORT NetworkState : public ManagedState { std::string device_path_; std::string guid_; std::string connection_state_; + std::string last_connection_state_; std::string profile_path_; std::vector<uint8_t> raw_ssid_; // Unknown encoding. Not necessarily UTF-8. int priority_ = 0; |