Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: device/geolocation/wifi_data_provider_common.h

Issue 2833273002: Geolocation cleanup: use unique_ptr<>s and rename New{WlanApi/PollingPolicy} to CreateBla() (Closed)
Patch Set: reillyg@s nits Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | device/geolocation/wifi_data_provider_common.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 DEVICE_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ 5 #ifndef DEVICE_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_
6 #define DEVICE_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ 6 #define DEVICE_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_
7 7
8 #include <assert.h> 8 #include <assert.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 void StartDataProvider() override; 46 void StartDataProvider() override;
47 void StopDataProvider() override; 47 void StopDataProvider() override;
48 bool GetData(WifiData* data) override; 48 bool GetData(WifiData* data) override;
49 49
50 protected: 50 protected:
51 ~WifiDataProviderCommon() override; 51 ~WifiDataProviderCommon() override;
52 52
53 // TODO(mcasas): change return types and possibly names of these two methods, 53 // TODO(mcasas): change return types and possibly names of these two methods,
54 // see https://crbug.com/714348. 54 // see https://crbug.com/714348.
55 // Returns ownership. 55 // Returns ownership.
56 virtual WlanApiInterface* NewWlanApi() = 0; 56 virtual std::unique_ptr<WlanApiInterface> CreateWlanApi() = 0;
57 // Returns ownership. 57 // Returns ownership.
58 virtual WifiPollingPolicy* NewPollingPolicy() = 0; 58 virtual std::unique_ptr<WifiPollingPolicy> CreatePollingPolicy() = 0;
59 59
60 private: 60 private:
61 // Runs a scan. Calls the callbacks if new data is found. 61 // Runs a scan. Calls the callbacks if new data is found.
62 void DoWifiScanTask(); 62 void DoWifiScanTask();
63 63
64 // Will schedule a scan; i.e. enqueue DoWifiScanTask deferred task. 64 // Will schedule a scan; i.e. enqueue DoWifiScanTask deferred task.
65 void ScheduleNextScan(int interval); 65 void ScheduleNextScan(int interval);
66 66
67 WifiData wifi_data_; 67 WifiData wifi_data_;
68 68
69 // Whether we've successfully completed a scan for WiFi data. 69 // Whether we've successfully completed a scan for WiFi data.
70 bool is_first_scan_complete_; 70 bool is_first_scan_complete_;
71 71
72 // Underlying OS wifi API. 72 // Underlying OS wifi API.
73 std::unique_ptr<WlanApiInterface> wlan_api_; 73 std::unique_ptr<WlanApiInterface> wlan_api_;
74 74
75 // Controls the polling update interval. 75 // Controls the polling update interval.
76 std::unique_ptr<WifiPollingPolicy> polling_policy_; 76 std::unique_ptr<WifiPollingPolicy> polling_policy_;
77 77
78 // Holder for delayed tasks; takes care of cleanup. 78 // Holder for delayed tasks; takes care of cleanup.
79 base::WeakPtrFactory<WifiDataProviderCommon> weak_factory_; 79 base::WeakPtrFactory<WifiDataProviderCommon> weak_factory_;
80 80
81 DISALLOW_COPY_AND_ASSIGN(WifiDataProviderCommon); 81 DISALLOW_COPY_AND_ASSIGN(WifiDataProviderCommon);
82 }; 82 };
83 83
84 } // namespace device 84 } // namespace device
85 85
86 #endif // DEVICE_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ 86 #endif // DEVICE_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_
OLDNEW
« no previous file with comments | « no previous file | device/geolocation/wifi_data_provider_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698