| 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 CHROME_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_CHROMEOS_H_ | |
| 6 #define CHROME_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_CHROMEOS_H_ | |
| 7 | |
| 8 #include "base/compiler_specific.h" | |
| 9 #include "content/browser/geolocation/wifi_data_provider_common.h" | |
| 10 | |
| 11 namespace chromeos { | |
| 12 class NetworkLibrary; | |
| 13 } | |
| 14 | |
| 15 class WifiDataProviderChromeOs : public content::WifiDataProviderImplBase { | |
| 16 public: | |
| 17 WifiDataProviderChromeOs(); | |
| 18 | |
| 19 // WifiDataProviderImplBase | |
| 20 virtual bool StartDataProvider() OVERRIDE; | |
| 21 virtual void StopDataProvider() OVERRIDE; | |
| 22 virtual bool GetData(content::WifiData* data) OVERRIDE; | |
| 23 | |
| 24 // Allows injection of |lib| for testing. | |
| 25 static content::WifiDataProviderCommon::WlanApiInterface* NewWlanApi( | |
| 26 chromeos::NetworkLibrary* lib); | |
| 27 | |
| 28 private: | |
| 29 virtual ~WifiDataProviderChromeOs(); | |
| 30 | |
| 31 // UI thread | |
| 32 void DoWifiScanTaskOnUIThread(); // The polling task | |
| 33 void DoStartTaskOnUIThread(); | |
| 34 void DoStopTaskOnUIThread(); | |
| 35 | |
| 36 // Client thread | |
| 37 void DidWifiScanTaskNoResults(); | |
| 38 void DidWifiScanTask(const content::WifiData& new_data); | |
| 39 void MaybeNotifyListeners(bool update_available); | |
| 40 void DidStartFailed(); | |
| 41 | |
| 42 // WifiDataProviderCommon | |
| 43 virtual content::WifiDataProviderCommon::WlanApiInterface* NewWlanApi(); | |
| 44 virtual content::PollingPolicyInterface* NewPollingPolicy(); | |
| 45 | |
| 46 // Will schedule a scan; i.e. enqueue DoWifiScanTask deferred task. | |
| 47 void ScheduleNextScan(int interval); | |
| 48 | |
| 49 // Will schedule starting of the scanning process. | |
| 50 void ScheduleStart(); | |
| 51 | |
| 52 // Will schedule stopping of the scanning process. | |
| 53 void ScheduleStop(); | |
| 54 | |
| 55 // Underlying OS wifi API. (UI thread) | |
| 56 scoped_ptr<content::WifiDataProviderCommon::WlanApiInterface> wlan_api_; | |
| 57 | |
| 58 // Controls the polling update interval. (client thread) | |
| 59 scoped_ptr<content::PollingPolicyInterface> polling_policy_; | |
| 60 | |
| 61 // The latest wifi data. (client thread) | |
| 62 content::WifiData wifi_data_; | |
| 63 | |
| 64 // Whether we have strated the data provider. (client thread) | |
| 65 bool started_; | |
| 66 | |
| 67 // Whether we've successfully completed a scan for WiFi data. (client thread) | |
| 68 bool is_first_scan_complete_; | |
| 69 | |
| 70 DISALLOW_COPY_AND_ASSIGN(WifiDataProviderChromeOs); | |
| 71 }; | |
| 72 | |
| 73 #endif // CHROME_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_CHROMEOS_H_ | |
| OLD | NEW |