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

Side by Side Diff: chromeos/components/tether/host_scan_device_prioritizer_impl.h

Issue 2945643002: [CrOS Tether] Sort Tether network lists. (Closed)
Patch Set: Order active networks before non-active. 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::TetherNetworkListSorter {
26 public:
27 HostScanDevicePrioritizerImpl(
28 NetworkStateHandler* network_state_handler,
29 TetherHostResponseRecorder* tether_host_response_recorder,
30 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map);
31 ~HostScanDevicePrioritizerImpl() override;
32
33 // HostScanDevicePrioritizer:
34 void SortByHostScanOrder(
35 std::vector<cryptauth::RemoteDevice>* remote_devices) const override;
36
37 // NetworkStateHandler::TetherNetworkListSorter:
38 void SortTetherNetworkList(
39 NetworkStateHandler::ManagedStateList* tether_networks) const override;
40
41 private:
42 // Performs sorting for both SortByHostScanOrder() and
43 // SortTetherNetworkList().
44 template <typename T>
45 void SortNetworks(std::vector<T>* list_to_sort) const;
46
47 // GetDeviceId() and Move() are used internally by SortNetworks() to sort
48 // lists of both cryptauth::RemoteDevice and std::unique_ptr<ManagedState>.
49 std::string GetDeviceId(const cryptauth::RemoteDevice& remote_device) const;
50 std::string GetDeviceId(
51 const std::unique_ptr<ManagedState>& tether_network_state) const;
52 cryptauth::RemoteDevice Move(
53 const cryptauth::RemoteDevice& remote_device) const;
54 std::unique_ptr<ManagedState> Move(
55 std::unique_ptr<ManagedState>& tether_network_state) const;
stevenjb 2017/06/21 20:59:03 All of the above is a lot of detail for a header (
Kyle Horimoto 2017/06/21 22:17:07 I moved both Move() implementations to an anonymou
stevenjb 2017/06/22 00:25:19 OK, I looked at this a little more closely and see
Kyle Horimoto 2017/06/22 02:08:01 Acknowledged.
56
57 NetworkStateHandler* network_state_handler_;
58 TetherHostResponseRecorder* tether_host_response_recorder_;
59 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map_;
60
61 DISALLOW_COPY_AND_ASSIGN(HostScanDevicePrioritizerImpl);
62 };
63
64 } // namespace tether
65
66 } // namespace chromeos
67
68 #endif // CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_DEVICE_PRIORITIZER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698