summaryrefslogtreecommitdiffstats
path: root/content/browser/geolocation/wifi_data_provider_chromeos.cc
diff options
context:
space:
mode:
authorrobliao@chromium.org <robliao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-06 18:13:56 +0000
committerrobliao@chromium.org <robliao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-06 18:13:56 +0000
commit779a78fb020cba65f0038a0e7818893ebb509877 (patch)
treeaeb2adddf4be02570477b09fa8056fd2b628234a /content/browser/geolocation/wifi_data_provider_chromeos.cc
parent8b0e097bff94843b6b30f92ceebb540480216fe1 (diff)
downloadchromium_src-779a78fb020cba65f0038a0e7818893ebb509877.zip
chromium_src-779a78fb020cba65f0038a0e7818893ebb509877.tar.gz
chromium_src-779a78fb020cba65f0038a0e7818893ebb509877.tar.bz2
Initial Geolocation Wifi Scan Checking Fix for CrOS
The ChromeOS Wifi provider was erronously reporting an initial scan of 0 wifi access points when the shill's scanning had not yet completed. This resulted in a fallback to IP geo for the first request and then proper Wifi based location on the second request. BUG=236418 Review URL: https://chromiumcodereview.appspot.com/23889009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221737 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/geolocation/wifi_data_provider_chromeos.cc')
-rw-r--r--content/browser/geolocation/wifi_data_provider_chromeos.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/content/browser/geolocation/wifi_data_provider_chromeos.cc b/content/browser/geolocation/wifi_data_provider_chromeos.cc
index 7f29276..26e36f5 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)) {