Home | History | Annotate | Download | only in geolocation
      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
     15     : public WifiDataProviderImplBase {
     16  public:
     17   WifiDataProviderChromeOs();
     18 
     19   // WifiDataProviderImplBase
     20   virtual void StartDataProvider() OVERRIDE;
     21   virtual void StopDataProvider() OVERRIDE;
     22   virtual bool GetData(WifiData* data) OVERRIDE;
     23 
     24  private:
     25   friend class GeolocationChromeOsWifiDataProviderTest;
     26   virtual ~WifiDataProviderChromeOs();
     27 
     28   // UI thread
     29   void DoWifiScanTaskOnUIThread();  // The polling task
     30   void DoStartTaskOnUIThread();
     31 
     32   // Client thread
     33   void DidWifiScanTaskNoResults();
     34   void DidWifiScanTask(const WifiData& new_data);
     35 
     36   // Will schedule a scan; i.e. enqueue DoWifiScanTask deferred task.
     37   void ScheduleNextScan(int interval);
     38 
     39   // Will schedule starting of the scanning process.
     40   void ScheduleStart();
     41 
     42   // Will schedule stopping of the scanning process.
     43   void ScheduleStop();
     44 
     45   // Get access point data from chromeos.
     46   bool GetAccessPointData(WifiData::AccessPointDataSet* data);
     47 
     48   // Controls the polling update interval. (client thread)
     49   scoped_ptr<WifiPollingPolicy> polling_policy_;
     50 
     51   // The latest wifi data. (client thread)
     52   WifiData wifi_data_;
     53 
     54   // Whether we have strated the data provider. (client thread)
     55   bool started_;
     56 
     57   // Whether we've successfully completed a scan for WiFi data. (client thread)
     58   bool is_first_scan_complete_;
     59 
     60   DISALLOW_COPY_AND_ASSIGN(WifiDataProviderChromeOs);
     61 };
     62 
     63 }  // namespace content
     64 
     65 #endif  // CONTENT_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_CHROMEOS_H_
     66