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