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

Unified Diff: chromeos/components/tether/host_scanner.h

Issue 2852693004: [CrOS Tether] Create HostScanCache, which caches scan results and inserts them into the network sta… (Closed)
Patch Set: stevenjb@ comments. Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/components/tether/host_scan_cache_unittest.cc ('k') | chromeos/components/tether/host_scanner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/components/tether/host_scanner.h
diff --git a/chromeos/components/tether/host_scanner.h b/chromeos/components/tether/host_scanner.h
index 1913a980eae7afb97099daa464122431ef118dad..85e1ef77c9fdaeaff8c6e99fa0a76c0a99b1cc38 100644
--- a/chromeos/components/tether/host_scanner.h
+++ b/chromeos/components/tether/host_scanner.h
@@ -19,23 +19,24 @@ namespace tether {
class BleConnectionManager;
class DeviceIdTetherNetworkGuidMap;
+class HostScanCache;
class HostScanDevicePrioritizer;
class TetherHostFetcher;
class TetherHostResponseRecorder;
-// 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.
+// 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.
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);
+ DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map,
+ HostScanCache* host_scan_cache);
virtual ~HostScanner();
// Starts a host scan if there is no current scan. If a scan is ongoing, this
@@ -44,11 +45,6 @@ class HostScanner : public HostScannerOperation::Observer {
bool IsScanActive();
- std::vector<HostScannerOperation::ScannedDeviceInfo>
- most_recent_scan_results() {
- return most_recent_scan_results_;
- }
-
// HostScannerOperation::Observer:
void OnTetherAvailabilityResponse(
std::vector<HostScannerOperation::ScannedDeviceInfo>&
@@ -60,19 +56,19 @@ class HostScanner : public HostScannerOperation::Observer {
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_;
« no previous file with comments | « chromeos/components/tether/host_scan_cache_unittest.cc ('k') | chromeos/components/tether/host_scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698