Index: content/browser/geolocation/wifi_data_provider_chromeos.cc |
diff --git a/content/browser/geolocation/wifi_data_provider_chromeos.cc b/content/browser/geolocation/wifi_data_provider_chromeos.cc |
index 7f29276ec7b79f87c29c67aed92391f139d52b8b..26e36f5312f57356c7785787a35c52adcfafa903 100644 |
--- a/content/browser/geolocation/wifi_data_provider_chromeos.cc |
+++ b/content/browser/geolocation/wifi_data_provider_chromeos.cc |
@@ -70,14 +70,14 @@ void WifiDataProviderChromeOs::DoWifiScanTaskOnUIThread() { |
WifiData new_data; |
- if (!GetAccessPointData(&new_data.access_point_data)) { |
+ if (GetAccessPointData(&new_data.access_point_data)) { |
client_loop()->PostTask( |
FROM_HERE, |
- base::Bind(&WifiDataProviderChromeOs::DidWifiScanTaskNoResults, this)); |
+ base::Bind(&WifiDataProviderChromeOs::DidWifiScanTask, this, new_data)); |
} else { |
client_loop()->PostTask( |
FROM_HERE, |
- base::Bind(&WifiDataProviderChromeOs::DidWifiScanTask, this, new_data)); |
+ base::Bind(&WifiDataProviderChromeOs::DidWifiScanTaskNoResults, this)); |
} |
} |
@@ -87,7 +87,6 @@ void WifiDataProviderChromeOs::DidWifiScanTaskNoResults() { |
// in between DoWifiScanTaskOnUIThread and this method). |
if (started_) |
ScheduleNextScan(polling_policy_->NoWifiInterval()); |
- MaybeRunCallbacks(false); |
} |
void WifiDataProviderChromeOs::DidWifiScanTask(const WifiData& new_data) { |
@@ -100,10 +99,7 @@ void WifiDataProviderChromeOs::DidWifiScanTask(const WifiData& new_data) { |
polling_policy_->UpdatePollingInterval(update_available); |
ScheduleNextScan(polling_policy_->PollingInterval()); |
} |
- MaybeRunCallbacks(update_available); |
-} |
-void WifiDataProviderChromeOs::MaybeRunCallbacks(bool update_available) { |
if (update_available || !is_first_scan_complete_) { |
is_first_scan_complete_ = true; |
RunCallbacks(); |
@@ -140,9 +136,12 @@ void WifiDataProviderChromeOs::ScheduleStart() { |
bool WifiDataProviderChromeOs::GetAccessPointData( |
WifiData::AccessPointDataSet* result) { |
- chromeos::WifiAccessPointVector access_points; |
+ // If wifi isn't enabled, we've effectively completed the task. |
+ // Return true to indicate an empty access point list. |
if (!chromeos::NetworkHandler::Get()->geolocation_handler()->wifi_enabled()) |
- return false; |
+ return true; |
+ |
+ chromeos::WifiAccessPointVector access_points; |
int64 age_ms = 0; |
if (!chromeos::NetworkHandler::Get()->geolocation_handler()-> |
GetWifiAccessPoints(&access_points, &age_ms)) { |