Index: chromeos/components/tether/host_scanner.h |
diff --git a/chromeos/components/tether/host_scanner.h b/chromeos/components/tether/host_scanner.h |
index 85e1ef77c9fdaeaff8c6e99fa0a76c0a99b1cc38..1913a980eae7afb97099daa464122431ef118dad 100644 |
--- a/chromeos/components/tether/host_scanner.h |
+++ b/chromeos/components/tether/host_scanner.h |
@@ -19,24 +19,23 @@ |
class BleConnectionManager; |
class DeviceIdTetherNetworkGuidMap; |
-class HostScanCache; |
class HostScanDevicePrioritizer; |
class TetherHostFetcher; |
class TetherHostResponseRecorder; |
-// Scans for nearby tether hosts. When StartScan() is called, this class creates |
-// a new HostScannerOperation and uses it to contact nearby devices to query |
-// whether they can provide tether capabilities. Once the scan results are |
-// received, they are stored in the HostScanCache passed to the constructor. |
+// Scans for nearby tether hosts. |
+// TODO(khorimoto): Add some sort of "staleness" timeout which removes scan |
+// results which occurred long enough ago that they are no |
+// longer valid. |
class HostScanner : public HostScannerOperation::Observer { |
public: |
HostScanner(TetherHostFetcher* tether_host_fetcher, |
BleConnectionManager* connection_manager, |
HostScanDevicePrioritizer* host_scan_device_prioritizer, |
TetherHostResponseRecorder* tether_host_response_recorder, |
+ NetworkStateHandler* network_state_handler, |
NotificationPresenter* notification_presenter, |
- DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map, |
- HostScanCache* host_scan_cache); |
+ DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map); |
virtual ~HostScanner(); |
// Starts a host scan if there is no current scan. If a scan is ongoing, this |
@@ -44,6 +43,11 @@ |
virtual void StartScan(); |
bool IsScanActive(); |
+ |
+ std::vector<HostScannerOperation::ScannedDeviceInfo> |
+ most_recent_scan_results() { |
+ return most_recent_scan_results_; |
+ } |
// HostScannerOperation::Observer: |
void OnTetherAvailabilityResponse( |
@@ -56,19 +60,19 @@ |
friend class HostScanSchedulerTest; |
void OnTetherHostsFetched(const cryptauth::RemoteDeviceList& tether_hosts); |
- void SetCacheEntry( |
- const HostScannerOperation::ScannedDeviceInfo& scanned_device_info); |
TetherHostFetcher* tether_host_fetcher_; |
BleConnectionManager* connection_manager_; |
HostScanDevicePrioritizer* host_scan_device_prioritizer_; |
TetherHostResponseRecorder* tether_host_response_recorder_; |
+ NetworkStateHandler* network_state_handler_; |
NotificationPresenter* notification_presenter_; |
DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map_; |
- HostScanCache* host_scan_cache_; |
bool is_fetching_hosts_; |
std::unique_ptr<HostScannerOperation> host_scanner_operation_; |
+ std::vector<HostScannerOperation::ScannedDeviceInfo> |
+ most_recent_scan_results_; |
base::WeakPtrFactory<HostScanner> weak_ptr_factory_; |