| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Provides wifi scan API binding for chromeos, using proprietary APIs. | 5 // Provides wifi scan API binding for chromeos, using proprietary APIs. |
| 6 | 6 |
| 7 #include "chrome/browser/geolocation/wifi_data_provider_chromeos.h" | 7 #include "chrome/browser/geolocation/wifi_data_provider_chromeos.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 : network_library_(lib) { | 69 : network_library_(lib) { |
| 70 DCHECK(network_library_ != NULL); | 70 DCHECK(network_library_ != NULL); |
| 71 } | 71 } |
| 72 | 72 |
| 73 NetworkLibraryWlanApi::~NetworkLibraryWlanApi() { | 73 NetworkLibraryWlanApi::~NetworkLibraryWlanApi() { |
| 74 } | 74 } |
| 75 | 75 |
| 76 bool NetworkLibraryWlanApi::GetAccessPointData( | 76 bool NetworkLibraryWlanApi::GetAccessPointData( |
| 77 WifiData::AccessPointDataSet* result) { | 77 WifiData::AccessPointDataSet* result) { |
| 78 WifiAccessPointVector access_points; | 78 WifiAccessPointVector access_points; |
| 79 if (!network_library_->GetWifiAccessPoints(&access_points)) | 79 // TODO(stevenjb): Re-implement this with chromeos::GeolocationHandler. The |
| 80 return false; | 80 // previous code has been broken since switching to Shill. crbug.com/167987 |
| 81 for (WifiAccessPointVector::const_iterator i = access_points.begin(); | 81 return false; |
| 82 i != access_points.end(); ++i) { | |
| 83 AccessPointData ap_data; | |
| 84 ap_data.mac_address = ASCIIToUTF16(i->mac_address); | |
| 85 ap_data.radio_signal_strength = i->signal_strength; | |
| 86 ap_data.channel = i->channel; | |
| 87 ap_data.signal_to_noise = i->signal_to_noise; | |
| 88 ap_data.ssid = UTF8ToUTF16(i->name); | |
| 89 result->insert(ap_data); | |
| 90 } | |
| 91 return !result->empty() || network_library_->wifi_enabled(); | |
| 92 } | 82 } |
| 93 | 83 |
| 94 } // namespace | 84 } // namespace |
| 95 } // namespace chromeos | 85 } // namespace chromeos |
| 96 | 86 |
| 97 WifiDataProviderChromeOs::WifiDataProviderChromeOs() : started_(false) { | 87 WifiDataProviderChromeOs::WifiDataProviderChromeOs() : started_(false) { |
| 98 } | 88 } |
| 99 | 89 |
| 100 WifiDataProviderChromeOs::~WifiDataProviderChromeOs() { | 90 WifiDataProviderChromeOs::~WifiDataProviderChromeOs() { |
| 101 } | 91 } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 DCHECK(CalledOnClientThread()); | 229 DCHECK(CalledOnClientThread()); |
| 240 DCHECK(!started_); | 230 DCHECK(!started_); |
| 241 started_ = true; | 231 started_ = true; |
| 242 // Perform first scan ASAP regardless of the polling policy. If this scan | 232 // Perform first scan ASAP regardless of the polling policy. If this scan |
| 243 // fails we'll retry at a rate in line with the polling policy. | 233 // fails we'll retry at a rate in line with the polling policy. |
| 244 BrowserThread::PostTask( | 234 BrowserThread::PostTask( |
| 245 BrowserThread::UI, | 235 BrowserThread::UI, |
| 246 FROM_HERE, | 236 FROM_HERE, |
| 247 base::Bind(&WifiDataProviderChromeOs::DoStartTaskOnUIThread, this)); | 237 base::Bind(&WifiDataProviderChromeOs::DoStartTaskOnUIThread, this)); |
| 248 } | 238 } |
| OLD | NEW |