• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CONTENT_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_CHROMEOS_H_
6 #define CONTENT_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_CHROMEOS_H_
7 
8 #include "base/compiler_specific.h"
9 #include "content/browser/geolocation/wifi_data_provider.h"
10 #include "content/browser/geolocation/wifi_polling_policy.h"
11 
12 namespace content {
13 
14 class CONTENT_EXPORT WifiDataProviderChromeOs : public WifiDataProvider {
15  public:
16   WifiDataProviderChromeOs();
17 
18   // WifiDataProvider
19   virtual void StartDataProvider() OVERRIDE;
20   virtual void StopDataProvider() OVERRIDE;
21   virtual bool GetData(WifiData* data) OVERRIDE;
22 
23  private:
24   friend class GeolocationChromeOsWifiDataProviderTest;
25   virtual ~WifiDataProviderChromeOs();
26 
27   // UI thread
28   void DoWifiScanTaskOnUIThread();  // The polling task
29   void DoStartTaskOnUIThread();
30 
31   // Client thread
32   void DidWifiScanTaskNoResults();
33   void DidWifiScanTask(const WifiData& new_data);
34 
35   // Will schedule a scan; i.e. enqueue DoWifiScanTask deferred task.
36   void ScheduleNextScan(int interval);
37 
38   // Will schedule starting of the scanning process.
39   void ScheduleStart();
40 
41   // Will schedule stopping of the scanning process.
42   void ScheduleStop();
43 
44   // Get access point data from chromeos.
45   bool GetAccessPointData(WifiData::AccessPointDataSet* data);
46 
47   // Controls the polling update interval. (client thread)
48   scoped_ptr<WifiPollingPolicy> polling_policy_;
49 
50   // The latest wifi data. (client thread)
51   WifiData wifi_data_;
52 
53   // Whether we have strated the data provider. (client thread)
54   bool started_;
55 
56   // Whether we've successfully completed a scan for WiFi data. (client thread)
57   bool is_first_scan_complete_;
58 
59   DISALLOW_COPY_AND_ASSIGN(WifiDataProviderChromeOs);
60 };
61 
62 }  // namespace content
63 
64 #endif  // CONTENT_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_CHROMEOS_H_
65