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

Unified Diff: chromeos/network/network_state_handler.cc

Issue 2701463003: Create a Tether section in the system tray network list. (Closed)
Patch Set: Create a Tether section in the system tray network list. Created 3 years, 10 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.cc
diff --git a/chromeos/network/network_state_handler.cc b/chromeos/network/network_state_handler.cc
index cb8e51d850e9130f4b0ab7af79679cd49738a885..8bfe0ae87d0909f4a8a60e0109fb5f87b5ae89dc 100644
--- a/chromeos/network/network_state_handler.cc
+++ b/chromeos/network/network_state_handler.cc
@@ -200,6 +200,10 @@ bool NetworkStateHandler::GetScanningByType(
const NetworkState* NetworkStateHandler::GetNetworkState(
const std::string& service_path) const {
const NetworkState* network = GetModifiableNetworkState(service_path);
+ // This is a hack that I don't intend to keep here.
Ryan Hansberry 2017/02/15 19:57:39 Could/should NetworkListMd be changed to use Netwo
stevenjb 2017/02/15 20:59:04 We shouldn't do this hack. Ideally converting Netw
Ryan Hansberry 2017/02/16 22:42:20 Fixed after https://codereview.chromium.org/269847
+ if (!network) {
+ return GetNetworkStateFromGuid(service_path);
+ }
if (network && !network->update_received())
return nullptr;
return network;
@@ -289,6 +293,16 @@ void NetworkStateHandler::GetNetworkListByType(const NetworkTypePattern& type,
DCHECK(list);
list->clear();
int count = 0;
+
+ if (NetworkTypePattern::Tether().MatchesPattern(type)) {
+ for (auto iter = tether_network_list_.begin();
+ iter != tether_network_list_.end(); ++iter) {
+ list->push_back((*iter)->AsNetworkState());
+ if (limit > 0 && ++count >= limit)
+ return;
+ }
+ }
+
// Sort the network list if necessary.
if (!network_list_sorted_)
SortNetworkList();

Powered by Google App Engine
This is Rietveld 408576698