Index: chromeos/network/network_state_handler.h |
diff --git a/chromeos/network/network_state_handler.h b/chromeos/network/network_state_handler.h |
index d695b40186a6ce12f9f59ee5e9654933304b9435..5a55d4b4a958b8aa44c1bb7802151c96cb5aa088 100644 |
--- a/chromeos/network/network_state_handler.h |
+++ b/chromeos/network/network_state_handler.h |
@@ -69,6 +69,16 @@ class CHROMEOS_EXPORT NetworkStateHandler |
typedef std::vector<const NetworkState*> NetworkStateList; |
typedef std::vector<const DeviceState*> DeviceStateList; |
+ // Sorts Tether networks. Because sorting rules are determined by the Tether |
+ // component, a delegate is required to sort the list. |
stevenjb
2017/06/22 00:25:20
This isn't really necessary/helpful, the name is c
Kyle Horimoto
2017/06/22 02:08:01
Done.
|
+ class TetherSortDelegate { |
+ public: |
+ // Sorts the list so that the highest-priority networks are in the front of |
+ // the list. |
stevenjb
2017/06/22 00:25:20
This should be more generic::
// Sorts |tether_ne
Kyle Horimoto
2017/06/22 02:08:01
Done.
|
+ virtual void SortTetherNetworkList( |
+ ManagedStateList* tether_networks) const = 0; |
+ }; |
+ |
enum TechnologyState { |
TECHNOLOGY_UNAVAILABLE, |
TECHNOLOGY_AVAILABLE, |
@@ -267,6 +277,12 @@ class CHROMEOS_EXPORT NetworkStateHandler |
// provided |guid| to "Connected". This will be reflected in the UI. |
void SetTetherNetworkStateConnected(const std::string& guid); |
+ // Sets the sorting delegate for Tether networks. |
stevenjb
2017/06/22 00:25:20
No need for a comment for a trivial setter.
Kyle Horimoto
2017/06/22 02:08:01
Done.
|
+ void set_tether_sort_delegate( |
+ const TetherSortDelegate* tether_sort_delegate) { |
+ tether_sort_delegate_ = tether_sort_delegate; |
+ } |
+ |
// Sets |list| to contain the list of devices. The returned list contains |
// a copy of DeviceState pointers which should not be stored or used beyond |
// the scope of the calling function (i.e. they may later become invalid, but |
@@ -523,6 +539,9 @@ class CHROMEOS_EXPORT NetworkStateHandler |
TechnologyState tether_technology_state_ = |
TechnologyState::TECHNOLOGY_UNAVAILABLE; |
+ // Not owned by this instance. |
+ const TetherSortDelegate* tether_sort_delegate_ = nullptr; |
+ |
// Ensure that Shutdown() gets called exactly once. |
bool did_shutdown_ = false; |