Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: content/browser/geolocation/wifi_data_provider_linux.cc

Issue 12210030: Linux/ChromeOS Chromium style checker cleanup, content/ edition. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 21 matching lines...) Expand all
32 enum { NM_DEVICE_TYPE_WIFI = 2 }; 32 enum { NM_DEVICE_TYPE_WIFI = 2 };
33 33
34 // Wifi API binding to NetworkManager, to allow reuse of the polling behavior 34 // Wifi API binding to NetworkManager, to allow reuse of the polling behavior
35 // defined in WifiDataProviderCommon. 35 // defined in WifiDataProviderCommon.
36 // TODO(joth): NetworkManager also allows for notification based handling, 36 // TODO(joth): NetworkManager also allows for notification based handling,
37 // however this will require reworking of the threading code to run a GLib 37 // however this will require reworking of the threading code to run a GLib
38 // event loop (GMainLoop). 38 // event loop (GMainLoop).
39 class NetworkManagerWlanApi : public WifiDataProviderCommon::WlanApiInterface { 39 class NetworkManagerWlanApi : public WifiDataProviderCommon::WlanApiInterface {
40 public: 40 public:
41 NetworkManagerWlanApi(); 41 NetworkManagerWlanApi();
42 ~NetworkManagerWlanApi(); 42 virtual ~NetworkManagerWlanApi();
43 43
44 // Must be called before any other interface method. Will return false if the 44 // Must be called before any other interface method. Will return false if the
45 // NetworkManager session cannot be created (e.g. not present on this distro), 45 // NetworkManager session cannot be created (e.g. not present on this distro),
46 // in which case no other method may be called. 46 // in which case no other method may be called.
47 bool Init(); 47 bool Init();
48 48
49 // Similar to Init() but can inject the bus object. Used for testing. 49 // Similar to Init() but can inject the bus object. Used for testing.
50 bool InitWithBus(dbus::Bus* bus); 50 bool InitWithBus(dbus::Bus* bus);
51 51
52 // WifiDataProviderCommon::WlanApiInterface 52 // WifiDataProviderCommon::WlanApiInterface
53 // 53 //
54 // This function makes blocking D-Bus calls, but it's totally fine as 54 // This function makes blocking D-Bus calls, but it's totally fine as
55 // the code runs in "Geolocation" thread, not the browser's UI thread. 55 // the code runs in "Geolocation" thread, not the browser's UI thread.
56 virtual bool GetAccessPointData(WifiData::AccessPointDataSet* data); 56 virtual bool GetAccessPointData(WifiData::AccessPointDataSet* data) OVERRIDE;
57 57
58 private: 58 private:
59 // Enumerates the list of available network adapter devices known to 59 // Enumerates the list of available network adapter devices known to
60 // NetworkManager. Return true on success. 60 // NetworkManager. Return true on success.
61 bool GetAdapterDeviceList(std::vector<dbus::ObjectPath>* device_paths); 61 bool GetAdapterDeviceList(std::vector<dbus::ObjectPath>* device_paths);
62 62
63 // Given the NetworkManager path to a wireless adapater, dumps the wifi scan 63 // Given the NetworkManager path to a wireless adapater, dumps the wifi scan
64 // results and appends them to |data|. Returns false if a fatal error is 64 // results and appends them to |data|. Returns false if a fatal error is
65 // encountered such that the data set could not be populated. 65 // encountered such that the data set could not be populated.
66 bool GetAccessPointsForAdapter(const dbus::ObjectPath& adapter_path, 66 bool GetAccessPointsForAdapter(const dbus::ObjectPath& adapter_path,
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698