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

Unified Diff: chromeos/network/network_state_handler.h

Issue 2945643002: [CrOS Tether] Sort Tether network lists. (Closed)
Patch Set: stevenjb@ comments. Created 3 years, 6 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_handler.h
diff --git a/chromeos/network/network_state_handler.h b/chromeos/network/network_state_handler.h
index d695b40186a6ce12f9f59ee5e9654933304b9435..42eaa5d7fcccf6c800dd6f3319348b9fd254f826 100644
--- a/chromeos/network/network_state_handler.h
+++ b/chromeos/network/network_state_handler.h
@@ -69,6 +69,14 @@ class CHROMEOS_EXPORT NetworkStateHandler
typedef std::vector<const NetworkState*> NetworkStateList;
typedef std::vector<const DeviceState*> DeviceStateList;
+ class TetherSortDelegate {
+ public:
+ // Sorts |tether_networks| according to the Tether component rules.
+ // |tether_networks| contains only networks of type Tether.
+ virtual void SortTetherNetworkList(
+ ManagedStateList* tether_networks) const = 0;
+ };
+
enum TechnologyState {
TECHNOLOGY_UNAVAILABLE,
TECHNOLOGY_AVAILABLE,
@@ -190,7 +198,7 @@ class CHROMEOS_EXPORT NetworkStateHandler
void GetNetworkListByType(const NetworkTypePattern& type,
bool configured_only,
bool visible_only,
- int limit,
+ size_t limit,
NetworkStateList* list);
// Finds and returns the NetworkState associated with |service_path| or NULL
@@ -267,6 +275,11 @@ class CHROMEOS_EXPORT NetworkStateHandler
// provided |guid| to "Connected". This will be reflected in the UI.
void SetTetherNetworkStateConnected(const std::string& guid);
+ 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
@@ -475,7 +488,7 @@ class CHROMEOS_EXPORT NetworkStateHandler
// used beyond the scope of the calling function (i.e. they may later become
// invalid, but only on the UI thread).
// NOTE: See AddTetherNetworkState for more information about Tether networks.
- void GetTetherNetworkList(int limit, NetworkStateList* list);
+ void GetTetherNetworkList(bool active, size_t limit, NetworkStateList* list);
// Set the connection_state of a Tether NetworkState corresponding to the
// provided |guid|.
@@ -523,6 +536,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;

Powered by Google App Engine
This is Rietveld 408576698