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 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "content/browser/geolocation/wifi_data_provider_manager.h" |
14 #include "dbus/bus.h" | 15 #include "dbus/bus.h" |
15 #include "dbus/message.h" | 16 #include "dbus/message.h" |
16 #include "dbus/object_path.h" | 17 #include "dbus/object_path.h" |
17 #include "dbus/object_proxy.h" | 18 #include "dbus/object_proxy.h" |
18 | 19 |
19 namespace content { | 20 namespace content { |
20 namespace { | 21 namespace { |
21 // The time periods between successive polls of the wifi data. | 22 // The time periods between successive polls of the wifi data. |
22 const int kDefaultPollingIntervalMilliseconds = 10 * 1000; // 10s | 23 const int kDefaultPollingIntervalMilliseconds = 10 * 1000; // 10s |
23 const int kNoChangePollingIntervalMilliseconds = 2 * 60 * 1000; // 2 mins | 24 const int kNoChangePollingIntervalMilliseconds = 2 * 60 * 1000; // 2 mins |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT); | 338 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT); |
338 if (!response) { | 339 if (!response) { |
339 LOG(WARNING) << "Failed to get property for " << property_name; | 340 LOG(WARNING) << "Failed to get property for " << property_name; |
340 } | 341 } |
341 return response.Pass(); | 342 return response.Pass(); |
342 } | 343 } |
343 | 344 |
344 } // namespace | 345 } // namespace |
345 | 346 |
346 // static | 347 // static |
347 WifiDataProviderImplBase* WifiDataProvider::DefaultFactoryFunction() { | 348 WifiDataProvider* WifiDataProviderManager::DefaultFactoryFunction() { |
348 return new WifiDataProviderLinux(); | 349 return new WifiDataProviderLinux(); |
349 } | 350 } |
350 | 351 |
351 WifiDataProviderLinux::WifiDataProviderLinux() { | 352 WifiDataProviderLinux::WifiDataProviderLinux() { |
352 } | 353 } |
353 | 354 |
354 WifiDataProviderLinux::~WifiDataProviderLinux() { | 355 WifiDataProviderLinux::~WifiDataProviderLinux() { |
355 } | 356 } |
356 | 357 |
357 WifiDataProviderCommon::WlanApiInterface* | 358 WifiDataProviderCommon::WlanApiInterface* |
(...skipping 13 matching lines...) Expand all Loading... |
371 | 372 |
372 WifiDataProviderCommon::WlanApiInterface* | 373 WifiDataProviderCommon::WlanApiInterface* |
373 WifiDataProviderLinux::NewWlanApiForTesting(dbus::Bus* bus) { | 374 WifiDataProviderLinux::NewWlanApiForTesting(dbus::Bus* bus) { |
374 scoped_ptr<NetworkManagerWlanApi> wlan_api(new NetworkManagerWlanApi); | 375 scoped_ptr<NetworkManagerWlanApi> wlan_api(new NetworkManagerWlanApi); |
375 if (wlan_api->InitWithBus(bus)) | 376 if (wlan_api->InitWithBus(bus)) |
376 return wlan_api.release(); | 377 return wlan_api.release(); |
377 return NULL; | 378 return NULL; |
378 } | 379 } |
379 | 380 |
380 } // namespace content | 381 } // namespace content |
OLD | NEW |