OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DISCOVERY_NETWORK_LIST_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DISCOVERY_NETWORK_LIST_H_ |
| 7 |
| 8 #include <algorithm> |
| 9 #include <vector> |
| 10 |
| 11 #include "chrome/browser/media/router/discovery/discovery_network_info.h" |
| 12 |
| 13 // Returns a list of information about each network to which the host is |
| 14 // connected, stable-sorted by network ID (stable relative to the order they are |
| 15 // returned by the OS during enumeration). |
| 16 std::vector<DiscoveryNetworkInfo> GetDiscoveryNetworkInfoList(); |
| 17 |
| 18 // Stable sort a sequence of DiscoveryNetworkInfo objects given by the iterators |
| 19 // [first, last). |
| 20 template <typename InputIt> |
| 21 void StableSortDiscoveryNetworkInfo(InputIt first, InputIt last) { |
| 22 std::stable_sort( |
| 23 first, last, |
| 24 [](const DiscoveryNetworkInfo& info1, const DiscoveryNetworkInfo& info2) { |
| 25 return info1.network_id < info2.network_id; |
| 26 }); |
| 27 } |
| 28 |
| 29 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DISCOVERY_NETWORK_LIST_H_ |
OLD | NEW |