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