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

Unified Diff: chrome/browser/geolocation/wifi_data_provider_win.h

Issue 604019: Refactor the state-machine & threading out of the windows wifi provider into ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/geolocation/wifi_data_provider_win.h
===================================================================
--- chrome/browser/geolocation/wifi_data_provider_win.h (revision 38765)
+++ chrome/browser/geolocation/wifi_data_provider_win.h (working copy)
@@ -5,67 +5,21 @@
#ifndef CHROME_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_WIN_H_
#define CHROME_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_WIN_H_
-#include "base/task.h"
-#include "base/thread.h"
-#include "chrome/browser/geolocation/device_data_provider.h"
+#include "chrome/browser/geolocation/wifi_data_provider_common.h"
class PollingPolicyInterface;
-class Win32WifiDataProvider
- : public WifiDataProviderImplBase,
- private base::Thread {
+class Win32WifiDataProvider : public WifiDataProviderCommon {
public:
- // Interface to abstract the low level data OS library call, and to allow
- // mocking (hence public).
- class WlanApiInterface {
- public:
- virtual ~WlanApiInterface() {}
- // Gets wifi data for all visible access points.
- virtual bool GetAccessPointData(WifiData::AccessPointDataSet *data) = 0;
- };
-
Win32WifiDataProvider();
- // Takes ownership of wlan_api. Must be called before Start().
- void inject_mock_wlan_api(WlanApiInterface* wlan_api);
-
- // Takes ownership of polic. Must be called before Start().
- void inject_mock_polling_policy(PollingPolicyInterface* policy);
-
- // WifiDataProviderImplBase implementation
- virtual bool StartDataProvider();
- virtual void StopDataProvider();
- virtual bool GetData(WifiData *data);
-
private:
virtual ~Win32WifiDataProvider();
- // Thread implementation
- virtual void Init();
- virtual void CleanUp();
+ // WifiDataProviderCommon
+ virtual WlanApiInterface* NewWlanApi();
+ virtual PollingPolicyInterface* NewPolicyPolicy();
- // Task which run in the child thread.
- void DoWifiScanTask();
-
- // Will schedule a scan; i.e. enqueue DoWifiScanTask deferred task.
- void ScheduleNextScan();
-
- WifiData wifi_data_;
- Lock data_mutex_;
-
- // Whether we've successfully completed a scan for WiFi data (or the polling
- // thread has terminated early).
- bool is_first_scan_complete_;
-
- // Underlying OS wifi API.
- scoped_ptr<WlanApiInterface> wlan_api_;
-
- // Controls the polling update interval.
- scoped_ptr<PollingPolicyInterface> polling_policy_;
-
- // Holder for the tasks which run on the thread; takes care of cleanup.
- ScopedRunnableMethodFactory<Win32WifiDataProvider> task_factory_;
-
DISALLOW_COPY_AND_ASSIGN(Win32WifiDataProvider);
};

Powered by Google App Engine
This is Rietveld 408576698