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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // in which case no other method may be called. | 47 // in which case no other method may be called. |
48 bool Init(); | 48 bool Init(); |
49 | 49 |
50 // Similar to Init() but can inject the bus object. Used for testing. | 50 // Similar to Init() but can inject the bus object. Used for testing. |
51 bool InitWithBus(dbus::Bus* bus); | 51 bool InitWithBus(dbus::Bus* bus); |
52 | 52 |
53 // WifiDataProviderCommon::WlanApiInterface | 53 // WifiDataProviderCommon::WlanApiInterface |
54 // | 54 // |
55 // This function makes blocking D-Bus calls, but it's totally fine as | 55 // This function makes blocking D-Bus calls, but it's totally fine as |
56 // the code runs in "Geolocation" thread, not the browser's UI thread. | 56 // the code runs in "Geolocation" thread, not the browser's UI thread. |
57 virtual bool GetAccessPointData(WifiData::AccessPointDataSet* data) OVERRIDE; | 57 virtual bool GetAccessPointData(WifiData::AccessPointDataSet* data) override; |
58 | 58 |
59 private: | 59 private: |
60 // Enumerates the list of available network adapter devices known to | 60 // Enumerates the list of available network adapter devices known to |
61 // NetworkManager. Return true on success. | 61 // NetworkManager. Return true on success. |
62 bool GetAdapterDeviceList(std::vector<dbus::ObjectPath>* device_paths); | 62 bool GetAdapterDeviceList(std::vector<dbus::ObjectPath>* device_paths); |
63 | 63 |
64 // Given the NetworkManager path to a wireless adapater, dumps the wifi scan | 64 // Given the NetworkManager path to a wireless adapater, dumps the wifi scan |
65 // results and appends them to |data|. Returns false if a fatal error is | 65 // results and appends them to |data|. Returns false if a fatal error is |
66 // encountered such that the data set could not be populated. | 66 // encountered such that the data set could not be populated. |
67 bool GetAccessPointsForAdapter(const dbus::ObjectPath& adapter_path, | 67 bool GetAccessPointsForAdapter(const dbus::ObjectPath& adapter_path, |
(...skipping 304 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 |