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

Unified Diff: chrome/browser/media/router/discovery/discovery_network_list.h

Issue 2750453002: Add DiscoveryNetworkMonitor implementation (Closed)
Patch Set: Temporarily fix Windows and Mac compilation 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: chrome/browser/media/router/discovery/discovery_network_list.h
diff --git a/chrome/browser/media/router/discovery/discovery_network_list.h b/chrome/browser/media/router/discovery/discovery_network_list.h
new file mode 100644
index 0000000000000000000000000000000000000000..c79cba0aafd78d7dd5d89083f7d926de670bd803
--- /dev/null
+++ b/chrome/browser/media/router/discovery/discovery_network_list.h
@@ -0,0 +1,29 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DISCOVERY_NETWORK_LIST_H_
+#define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DISCOVERY_NETWORK_LIST_H_
+
+#include <algorithm>
+#include <vector>
+
+#include "chrome/browser/media/router/discovery/discovery_network_info.h"
+
+// Returns a list of information about each network to which the host is
+// connected, stable-sorted by network ID (stable relative to the order they are
+// returned by the OS during enumeration).
+std::vector<DiscoveryNetworkInfo> GetDiscoveryNetworkInfoList();
+
+// Stable sort a sequence of DiscoveryNetworkInfo objects given by the iterators
+// [first, last).
+template <typename InputIt>
+void StableSortDiscoveryNetworkInfo(InputIt first, InputIt last) {
+ std::stable_sort(
+ first, last,
+ [](const DiscoveryNetworkInfo& info1, const DiscoveryNetworkInfo& info2) {
+ return info1.network_id < info2.network_id;
+ });
+}
+
+#endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DISCOVERY_NETWORK_LIST_H_

Powered by Google App Engine
This is Rietveld 408576698