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 suitable for typical linux distributions. | 5 // Provides wifi scan API binding for suitable for typical linux distributions. |
6 // Currently, only the NetworkManager API is used, accessed via D-Bus (in turn | 6 // Currently, only the NetworkManager API is used, accessed via D-Bus (in turn |
7 // accessed via the GLib wrapper). | 7 // accessed via the GLib wrapper). |
8 | 8 |
9 #include "content/browser/geolocation/wifi_data_provider_linux.h" | 9 #include "content/browser/geolocation/wifi_data_provider_linux.h" |
10 | 10 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 163 } |
164 VLOG(1) << "Device type: " << device_type; | 164 VLOG(1) << "Device type: " << device_type; |
165 | 165 |
166 if (device_type == NM_DEVICE_TYPE_WIFI) { // Found a wlan adapter | 166 if (device_type == NM_DEVICE_TYPE_WIFI) { // Found a wlan adapter |
167 if (GetAccessPointsForAdapter(device_path, data)) | 167 if (GetAccessPointsForAdapter(device_path, data)) |
168 ++success_count; | 168 ++success_count; |
169 else | 169 else |
170 ++fail_count; | 170 ++fail_count; |
171 } | 171 } |
172 } | 172 } |
173 // At least one successfull scan overrides any other adapter reporting error. | 173 // At least one successful scan overrides any other adapter reporting error. |
174 return success_count || fail_count == 0; | 174 return success_count || fail_count == 0; |
175 } | 175 } |
176 | 176 |
177 bool NetworkManagerWlanApi::GetAdapterDeviceList( | 177 bool NetworkManagerWlanApi::GetAdapterDeviceList( |
178 std::vector<dbus::ObjectPath>* device_paths) { | 178 std::vector<dbus::ObjectPath>* device_paths) { |
179 dbus::MethodCall method_call(kNetworkManagerInterface, "GetDevices"); | 179 dbus::MethodCall method_call(kNetworkManagerInterface, "GetDevices"); |
180 scoped_ptr<dbus::Response> response( | 180 scoped_ptr<dbus::Response> response( |
181 network_manager_proxy_->CallMethodAndBlock( | 181 network_manager_proxy_->CallMethodAndBlock( |
182 &method_call, | 182 &method_call, |
183 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); | 183 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 372 |
373 WifiDataProviderCommon::WlanApiInterface* | 373 WifiDataProviderCommon::WlanApiInterface* |
374 WifiDataProviderLinux::NewWlanApiForTesting(dbus::Bus* bus) { | 374 WifiDataProviderLinux::NewWlanApiForTesting(dbus::Bus* bus) { |
375 scoped_ptr<NetworkManagerWlanApi> wlan_api(new NetworkManagerWlanApi); | 375 scoped_ptr<NetworkManagerWlanApi> wlan_api(new NetworkManagerWlanApi); |
376 if (wlan_api->InitWithBus(bus)) | 376 if (wlan_api->InitWithBus(bus)) |
377 return wlan_api.release(); | 377 return wlan_api.release(); |
378 return NULL; | 378 return NULL; |
379 } | 379 } |
380 | 380 |
381 } // namespace content | 381 } // namespace content |
OLD | NEW |