diff options
author | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-15 10:55:38 +0000 |
---|---|---|
committer | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-15 10:55:38 +0000 |
commit | 63259a5095c73aafc0e3d84b0e1ba1ef48b05048 (patch) | |
tree | e776c25f7f1c3326e70d961b6e6d874c3de0081f /chrome/browser/geolocation/wifi_data_provider_chromeos.cc | |
parent | dfb6bc0a84ab1a4de19741428c24bc4d2d290305 (diff) | |
download | chromium_src-63259a5095c73aafc0e3d84b0e1ba1ef48b05048.zip chromium_src-63259a5095c73aafc0e3d84b0e1ba1ef48b05048.tar.gz chromium_src-63259a5095c73aafc0e3d84b0e1ba1ef48b05048.tar.bz2 |
Implement wifi geolocation for Chrome OS
Update network_library to use libcros to fetch wifi access point list, and update the geolocation code to use this for wifi scanning.
Depends on changes codereview.chromium.org/2927007 and codereview.chromium.org/2958008 (will be landed after them both)
BUG=45671
TEST=Open maps.google.com/maps/m on netbook with wifi enabled, it should go to your location with a few hundred
Review URL: http://codereview.chromium.org/2905008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52476 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/geolocation/wifi_data_provider_chromeos.cc')
-rw-r--r-- | chrome/browser/geolocation/wifi_data_provider_chromeos.cc | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/chrome/browser/geolocation/wifi_data_provider_chromeos.cc b/chrome/browser/geolocation/wifi_data_provider_chromeos.cc index 41097d3..1a0343c 100644 --- a/chrome/browser/geolocation/wifi_data_provider_chromeos.cc +++ b/chrome/browser/geolocation/wifi_data_provider_chromeos.cc @@ -45,22 +45,21 @@ NetworkLibraryWlanApi::~NetworkLibraryWlanApi() { } bool NetworkLibraryWlanApi::GetAccessPointData( - WifiData::AccessPointDataSet* data) { - const WifiNetworkVector& networks = network_library_->wifi_networks(); - for (WifiNetworkVector::const_iterator i = networks.begin(); - i != networks.end(); ++i) { - for (WifiNetwork::AccessPointVector::const_iterator j = - i->access_points().begin(); j != i->access_points().end(); ++j) { - AccessPointData ap_data; - ap_data.mac_address = ASCIIToUTF16(j->mac_address); - ap_data.radio_signal_strength = j->signal_strength; - ap_data.channel = j->channel; - ap_data.signal_to_noise = j->signal_to_noise; - ap_data.ssid = UTF8ToUTF16(i->name()); - data->insert(ap_data); - } + WifiData::AccessPointDataSet* result) { + WifiAccessPointVector access_points; + if (!network_library_->GetWifiAccessPoints(&access_points)) + return false; + for (WifiAccessPointVector::const_iterator i = access_points.begin(); + i != access_points.end(); ++i) { + AccessPointData ap_data; + ap_data.mac_address = ASCIIToUTF16(i->mac_address); + ap_data.radio_signal_strength = i->signal_strength; + ap_data.channel = i->channel; + ap_data.signal_to_noise = i->signal_to_noise; + ap_data.ssid = UTF8ToUTF16(i->name); + result->insert(ap_data); } - return !data->empty() || network_library_->wifi_available(); + return !result->empty() || network_library_->wifi_enabled(); } } // namespace |