| 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 "content/browser/geolocation/wifi_data_provider_chromeos.h" | 7 #include "content/browser/geolocation/wifi_data_provider_chromeos.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 chromeos::WifiAccessPointVector access_points; | 144 chromeos::WifiAccessPointVector access_points; |
| 145 int64 age_ms = 0; | 145 int64 age_ms = 0; |
| 146 if (!chromeos::NetworkHandler::Get()->geolocation_handler()-> | 146 if (!chromeos::NetworkHandler::Get()->geolocation_handler()-> |
| 147 GetWifiAccessPoints(&access_points, &age_ms)) { | 147 GetWifiAccessPoints(&access_points, &age_ms)) { |
| 148 return false; | 148 return false; |
| 149 } | 149 } |
| 150 for (chromeos::WifiAccessPointVector::const_iterator i | 150 for (chromeos::WifiAccessPointVector::const_iterator i |
| 151 = access_points.begin(); | 151 = access_points.begin(); |
| 152 i != access_points.end(); ++i) { | 152 i != access_points.end(); ++i) { |
| 153 AccessPointData ap_data; | 153 AccessPointData ap_data; |
| 154 ap_data.mac_address = ASCIIToUTF16(i->mac_address); | 154 ap_data.mac_address = base::ASCIIToUTF16(i->mac_address); |
| 155 ap_data.radio_signal_strength = i->signal_strength; | 155 ap_data.radio_signal_strength = i->signal_strength; |
| 156 ap_data.channel = i->channel; | 156 ap_data.channel = i->channel; |
| 157 ap_data.signal_to_noise = i->signal_to_noise; | 157 ap_data.signal_to_noise = i->signal_to_noise; |
| 158 ap_data.ssid = UTF8ToUTF16(i->ssid); | 158 ap_data.ssid = base::UTF8ToUTF16(i->ssid); |
| 159 result->insert(ap_data); | 159 result->insert(ap_data); |
| 160 } | 160 } |
| 161 // If the age is significantly longer than our long polling time, assume the | 161 // If the age is significantly longer than our long polling time, assume the |
| 162 // data is stale and return false which will trigger a faster update. | 162 // data is stale and return false which will trigger a faster update. |
| 163 if (age_ms > kTwoNoChangePollingIntervalMilliseconds * 2) | 163 if (age_ms > kTwoNoChangePollingIntervalMilliseconds * 2) |
| 164 return false; | 164 return false; |
| 165 return true; | 165 return true; |
| 166 } | 166 } |
| 167 | 167 |
| 168 // static | 168 // static |
| 169 WifiDataProviderImplBase* WifiDataProvider::DefaultFactoryFunction() { | 169 WifiDataProviderImplBase* WifiDataProvider::DefaultFactoryFunction() { |
| 170 return new WifiDataProviderChromeOs(); | 170 return new WifiDataProviderChromeOs(); |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace content | 173 } // namespace content |
| OLD | NEW |