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

Side by Side Diff: chromeos/components/tether/host_scan_device_prioritizer_impl.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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 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 CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_DEVICE_PRIORITIZER_IMPL_H_
6 #define CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_DEVICE_PRIORITIZER_IMPL_H_
7
8 #include "base/macros.h"
9 #include "chromeos/components/tether/host_scan_device_prioritizer.h"
10 #include "chromeos/network/network_state_handler.h"
11 #include "components/cryptauth/remote_device.h"
12
13 namespace chromeos {
14
15 class NetworkStateHandler;
16
17 namespace tether {
18
19 class TetherHostResponseRecorder;
20 class DeviceIdTetherNetworkGuidMap;
21
22 // Implementation of HostScanDevicePrioritizer.
23 class HostScanDevicePrioritizerImpl
24 : public HostScanDevicePrioritizer,
25 public NetworkStateHandler::TetherSortDelegate {
26 public:
27 HostScanDevicePrioritizerImpl(
28 TetherHostResponseRecorder* tether_host_response_recorder,
29 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map);
30 ~HostScanDevicePrioritizerImpl() override;
31
32 // HostScanDevicePrioritizer:
33 void SortByHostScanOrder(
34 std::vector<cryptauth::RemoteDevice>* remote_devices) const override;
35
36 // NetworkStateHandler::TetherNetworkListSorter:
37 void SortTetherNetworkList(
38 NetworkStateHandler::ManagedStateList* tether_networks) const override;
39
40 private:
41 // Performs sorting for both SortByHostScanOrder() and
42 // SortTetherNetworkList().
43 template <typename T>
44 void SortNetworks(std::vector<T>* list_to_sort) const;
45
46 std::string GetDeviceId(const cryptauth::RemoteDevice& remote_device) const;
47 std::string GetDeviceId(
48 const std::unique_ptr<ManagedState>& tether_network_state) const;
49
50 TetherHostResponseRecorder* tether_host_response_recorder_;
51 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map_;
52
53 DISALLOW_COPY_AND_ASSIGN(HostScanDevicePrioritizerImpl);
54 };
55
56 } // namespace tether
57
58 } // namespace chromeos
59
60 #endif // CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_DEVICE_PRIORITIZER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698