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

Unified Diff: chromeos/components/tether/host_scan_cache.cc

Issue 2913313002: Tether: Persist if first-time setup is required to HostScanCache. (Closed)
Patch Set: khorimoto@ comments. Created 3 years, 7 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
Index: chromeos/components/tether/host_scan_cache.cc
diff --git a/chromeos/components/tether/host_scan_cache.cc b/chromeos/components/tether/host_scan_cache.cc
index c059aebe095dd932b3f3b7da58ad1ec1914e107f..51696431e1996a6f94e4e69fa1386fee8362e6ad 100644
--- a/chromeos/components/tether/host_scan_cache.cc
+++ b/chromeos/components/tether/host_scan_cache.cc
@@ -41,7 +41,8 @@ void HostScanCache::SetHostScanResult(const std::string& tether_network_guid,
const std::string& device_name,
const std::string& carrier,
int battery_percentage,
- int signal_strength) {
+ int signal_strength,
+ bool setup_required) {
DCHECK(!tether_network_guid.empty());
auto found_iter = tether_guid_to_timer_map_.find(tether_network_guid);
@@ -72,6 +73,11 @@ void HostScanCache::SetHostScanResult(const std::string& tether_network_guid,
<< "new signal strength: " << signal_strength;
}
+ if (setup_required)
+ setup_required_tether_guids_.insert(tether_network_guid);
+ else
+ setup_required_tether_guids_.erase(tether_network_guid);
+
StartTimer(tether_network_guid);
}
@@ -95,6 +101,7 @@ bool HostScanCache::RemoveHostScanResult(
}
tether_guid_to_timer_map_.erase(it);
+ setup_required_tether_guids_.erase(tether_network_guid);
return network_state_handler_->RemoveTetherNetworkState(tether_network_guid);
}
@@ -133,6 +140,12 @@ void HostScanCache::ClearCacheExceptForActiveHost() {
}
}
+bool HostScanCache::DoesHostRequireSetup(
+ const std::string& tether_network_guid) {
+ return setup_required_tether_guids_.find(tether_network_guid) !=
+ setup_required_tether_guids_.end();
+}
+
void HostScanCache::OnPreviouslyConnectedHostIdsChanged() {
for (auto& map_entry : tether_guid_to_timer_map_) {
const std::string& tether_network_guid = map_entry.first;
« no previous file with comments | « chromeos/components/tether/host_scan_cache.h ('k') | chromeos/components/tether/host_scan_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698