OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMEOS_COMPONENTS_TETHER_HOST_SCANNER_H_ | 5 #ifndef CHROMEOS_COMPONENTS_TETHER_HOST_SCANNER_H_ |
6 #define CHROMEOS_COMPONENTS_TETHER_HOST_SCANNER_H_ | 6 #define CHROMEOS_COMPONENTS_TETHER_HOST_SCANNER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "chromeos/components/tether/host_scanner_operation.h" | 11 #include "chromeos/components/tether/host_scanner_operation.h" |
12 #include "chromeos/components/tether/notification_presenter.h" | 12 #include "chromeos/components/tether/notification_presenter.h" |
13 #include "chromeos/network/network_state_handler.h" | 13 #include "chromeos/network/network_state_handler.h" |
14 #include "components/cryptauth/remote_device.h" | 14 #include "components/cryptauth/remote_device.h" |
15 | 15 |
16 namespace chromeos { | 16 namespace chromeos { |
17 | 17 |
18 namespace tether { | 18 namespace tether { |
19 | 19 |
20 class BleConnectionManager; | 20 class BleConnectionManager; |
| 21 class DeviceIdTetherNetworkGuidMap; |
21 class HostScanDevicePrioritizer; | 22 class HostScanDevicePrioritizer; |
22 class TetherHostFetcher; | 23 class TetherHostFetcher; |
23 | 24 |
24 // Scans for nearby tether hosts. | 25 // Scans for nearby tether hosts. |
25 // TODO(khorimoto): Add some sort of "staleness" timeout which removes scan | 26 // TODO(khorimoto): Add some sort of "staleness" timeout which removes scan |
26 // results which occurred long enough ago that they are no | 27 // results which occurred long enough ago that they are no |
27 // longer valid. | 28 // longer valid. |
28 class HostScanner : public HostScannerOperation::Observer { | 29 class HostScanner : public HostScannerOperation::Observer { |
29 public: | 30 public: |
30 HostScanner(TetherHostFetcher* tether_host_fetcher, | 31 HostScanner(TetherHostFetcher* tether_host_fetcher, |
31 BleConnectionManager* connection_manager, | 32 BleConnectionManager* connection_manager, |
32 HostScanDevicePrioritizer* host_scan_device_prioritizer, | 33 HostScanDevicePrioritizer* host_scan_device_prioritizer, |
33 NetworkStateHandler* network_state_handler, | 34 NetworkStateHandler* network_state_handler, |
34 NotificationPresenter* notification_presenter); | 35 NotificationPresenter* notification_presenter, |
| 36 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map); |
35 virtual ~HostScanner(); | 37 virtual ~HostScanner(); |
36 | 38 |
37 // Starts a host scan if there is no current scan. If a scan is ongoing, this | 39 // Starts a host scan if there is no current scan. If a scan is ongoing, this |
38 // function is a no-op. | 40 // function is a no-op. |
39 virtual void StartScan(); | 41 virtual void StartScan(); |
40 | 42 |
41 bool IsScanActive(); | 43 bool IsScanActive(); |
42 | 44 |
43 std::vector<HostScannerOperation::ScannedDeviceInfo> | 45 std::vector<HostScannerOperation::ScannedDeviceInfo> |
44 most_recent_scan_results() { | 46 most_recent_scan_results() { |
(...skipping 10 matching lines...) Expand all Loading... |
55 friend class HostScannerTest; | 57 friend class HostScannerTest; |
56 friend class HostScanSchedulerTest; | 58 friend class HostScanSchedulerTest; |
57 | 59 |
58 void OnTetherHostsFetched(const cryptauth::RemoteDeviceList& tether_hosts); | 60 void OnTetherHostsFetched(const cryptauth::RemoteDeviceList& tether_hosts); |
59 | 61 |
60 TetherHostFetcher* tether_host_fetcher_; | 62 TetherHostFetcher* tether_host_fetcher_; |
61 BleConnectionManager* connection_manager_; | 63 BleConnectionManager* connection_manager_; |
62 HostScanDevicePrioritizer* host_scan_device_prioritizer_; | 64 HostScanDevicePrioritizer* host_scan_device_prioritizer_; |
63 NetworkStateHandler* network_state_handler_; | 65 NetworkStateHandler* network_state_handler_; |
64 NotificationPresenter* notification_presenter_; | 66 NotificationPresenter* notification_presenter_; |
| 67 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map_; |
65 | 68 |
66 bool is_fetching_hosts_; | 69 bool is_fetching_hosts_; |
67 std::unique_ptr<HostScannerOperation> host_scanner_operation_; | 70 std::unique_ptr<HostScannerOperation> host_scanner_operation_; |
68 std::vector<HostScannerOperation::ScannedDeviceInfo> | 71 std::vector<HostScannerOperation::ScannedDeviceInfo> |
69 most_recent_scan_results_; | 72 most_recent_scan_results_; |
70 | 73 |
71 base::WeakPtrFactory<HostScanner> weak_ptr_factory_; | 74 base::WeakPtrFactory<HostScanner> weak_ptr_factory_; |
72 | 75 |
73 DISALLOW_COPY_AND_ASSIGN(HostScanner); | 76 DISALLOW_COPY_AND_ASSIGN(HostScanner); |
74 }; | 77 }; |
75 | 78 |
76 } // namespace tether | 79 } // namespace tether |
77 | 80 |
78 } // namespace chromeos | 81 } // namespace chromeos |
79 | 82 |
80 #endif // CHROMEOS_COMPONENTS_TETHER_HOST_SCANNER_H_ | 83 #endif // CHROMEOS_COMPONENTS_TETHER_HOST_SCANNER_H_ |
OLD | NEW |