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

Unified Diff: chromeos/network/network_state.h

Issue 2819383002: [CrOS Tether] Update NetworkState to include tether properties and integrate into NetworkStateHandl… (Closed)
Patch Set: Update TODOs. Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chromeos/network/network_state.h
diff --git a/chromeos/network/network_state.h b/chromeos/network/network_state.h
index 17fa58bca8c2fbbbbeb12571011ad68fe5bbca0e..840bf30d8e1aced5b68a81492038668d46233c44 100644
--- a/chromeos/network/network_state.h
+++ b/chromeos/network/network_state.h
@@ -10,6 +10,7 @@
#include <string>
#include <vector>
+#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/values.h"
#include "chromeos/network/managed_state.h"
@@ -79,8 +80,19 @@ class CHROMEOS_EXPORT NetworkState : public ManagedState {
// Wireless property accessors
bool connectable() const { return connectable_; }
+ // For Shill nletwork types, the connectable property is set via an update
stevenjb 2017/04/19 17:34:17 network
Kyle Horimoto 2017/04/19 19:23:29 Done.
+ // from Shill, so SetTetherNetworkConnectable() should not be called in those
+ // cases. For tether networks, the network is connectable by default, so this
+ // function should be called when the network is created.
+ void SetTetherNetworkConnectable();
stevenjb 2017/04/19 17:34:17 Generally keep complex methods separate from trivi
Kyle Horimoto 2017/04/19 19:23:29 Done.
bool is_captive_portal() const { return is_captive_portal_; }
int signal_strength() const { return signal_strength_; }
+ // For Wi-Fi, WiMAX, and cellular networks, signal strength is set via updates
+ // from Shill, so SetTetherSignalStrength() should not be called in those
+ // cases. For tether networks, the signal strength is received as a message
+ // from the tether host over Bluetooth, so it must be set via
+ // SetTetherSignalStrength() since it does not come from Shill.
+ void SetTetherSignalStrength(int signal_strength);
stevenjb 2017/04/19 17:34:17 ditto
Kyle Horimoto 2017/04/19 19:23:29 Done.
// Wifi property accessors
const std::string& eap_method() const { return eap_method_; }
@@ -102,6 +114,11 @@ class CHROMEOS_EXPORT NetworkState : public ManagedState {
return third_party_vpn_provider_extension_id_;
}
+ // Tether accessors and setters.
+ int battery_percentage() const { return battery_percentage_; }
+ void SetBatteryPercentage(int battery_percentage);
stevenjb 2017/04/19 17:34:17 inline, set_battery_percentage()
Kyle Horimoto 2017/04/19 19:23:29 Done.
+ const std::string& carrier() const { return carrier_; }
+ void SetCarrier(const std::string& carrier);
stevenjb 2017/04/19 17:34:17 inline
Kyle Horimoto 2017/04/19 19:23:29 Done.
const std::string& tether_guid() const { return tether_guid_; }
void set_tether_guid(const std::string& guid) { tether_guid_ = guid; }
@@ -153,6 +170,7 @@ class CHROMEOS_EXPORT NetworkState : public ManagedState {
friend class MobileActivatorTest;
friend class NetworkStateHandler;
friend class NetworkChangeNotifierChromeosUpdateTest;
+ FRIEND_TEST_ALL_PREFIXES(NetworkStateTest, TetherProperties);
// Updates |name_| from WiFi.HexSSID if provided, and validates |name_|.
// Returns true if |name_| changes.
@@ -213,6 +231,10 @@ class CHROMEOS_EXPORT NetworkState : public ManagedState {
std::string vpn_provider_type_;
std::string third_party_vpn_provider_extension_id_;
+ // Tether properties.
+ std::string carrier_;
+ int battery_percentage_;
+
// TODO(pneubeck): Remove this once (Managed)NetworkConfigurationHandler
// provides proxy configuration. crbug.com/241775
base::DictionaryValue proxy_config_;

Powered by Google App Engine
This is Rietveld 408576698