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 "device/geolocation/wifi_data_provider_linux.h" | 9 #include "content/browser/geolocation/wifi_data_provider_linux.h" |
10 | 10 |
11 #include <stddef.h> | 11 #include <stddef.h> |
12 #include <stdint.h> | 12 #include <stdint.h> |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 | 15 |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "content/browser/geolocation/wifi_data_provider_manager.h" |
19 #include "dbus/bus.h" | 20 #include "dbus/bus.h" |
20 #include "dbus/message.h" | 21 #include "dbus/message.h" |
21 #include "dbus/object_path.h" | 22 #include "dbus/object_path.h" |
22 #include "dbus/object_proxy.h" | 23 #include "dbus/object_proxy.h" |
23 #include "device/geolocation/wifi_data_provider_manager.h" | |
24 | 24 |
25 namespace device { | 25 namespace content { |
26 namespace { | 26 namespace { |
27 // The time periods between successive polls of the wifi data. | 27 // The time periods between successive polls of the wifi data. |
28 const int kDefaultPollingIntervalMilliseconds = 10 * 1000; // 10s | 28 const int kDefaultPollingIntervalMilliseconds = 10 * 1000; // 10s |
29 const int kNoChangePollingIntervalMilliseconds = 2 * 60 * 1000; // 2 mins | 29 const int kNoChangePollingIntervalMilliseconds = 2 * 60 * 1000; // 2 mins |
30 const int kTwoNoChangePollingIntervalMilliseconds = 10 * 60 * 1000; // 10 mins | 30 const int kTwoNoChangePollingIntervalMilliseconds = 10 * 60 * 1000; // 10 mins |
31 const int kNoWifiPollingIntervalMilliseconds = 20 * 1000; // 20s | 31 const int kNoWifiPollingIntervalMilliseconds = 20 * 1000; // 20s |
32 | 32 |
33 const char kNetworkManagerServiceName[] = "org.freedesktop.NetworkManager"; | 33 const char kNetworkManagerServiceName[] = "org.freedesktop.NetworkManager"; |
34 const char kNetworkManagerPath[] = "/org/freedesktop/NetworkManager"; | 34 const char kNetworkManagerPath[] = "/org/freedesktop/NetworkManager"; |
35 const char kNetworkManagerInterface[] = "org.freedesktop.NetworkManager"; | 35 const char kNetworkManagerInterface[] = "org.freedesktop.NetworkManager"; |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 } | 371 } |
372 | 372 |
373 WifiDataProviderCommon::WlanApiInterface* | 373 WifiDataProviderCommon::WlanApiInterface* |
374 WifiDataProviderLinux::NewWlanApiForTesting(dbus::Bus* bus) { | 374 WifiDataProviderLinux::NewWlanApiForTesting(dbus::Bus* bus) { |
375 std::unique_ptr<NetworkManagerWlanApi> wlan_api(new NetworkManagerWlanApi); | 375 std::unique_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 device | 381 } // namespace content |
OLD | NEW |