OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 DEVICE_GEOLOCATION_RATE_LIMITING_LOCATION_PROVIDER_PROXY_H_ |
| 6 #define DEVICE_GEOLOCATION_RATE_LIMITING_LOCATION_PROVIDER_PROXY_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "device/geolocation/geolocation_delegate.h" |
| 11 #include "device/geolocation/geoposition.h" |
| 12 #include "device/geolocation/location_provider.h" |
| 13 |
| 14 namespace device { |
| 15 |
| 16 // Location provider that limits the rate of geolocation updates. |
| 17 // TODO(lethalantidote): Schedule aspect still to be implemented. Dummy for now. |
| 18 class DEVICE_GEOLOCATION_EXPORT RateLimitingLocationProviderProxy |
| 19 : public LocationProvider { |
| 20 public: |
| 21 RateLimitingLocationProviderProxy(); |
| 22 ~RateLimitingLocationProviderProxy() override; |
| 23 |
| 24 // LocationProvider implemenation. |
| 25 void SetUpdateCallback( |
| 26 const LocationProviderUpdateCallback& callback) override; |
| 27 bool StartProvider(bool enable_high_accuracy) override; |
| 28 void StopProvider() override; |
| 29 const Geoposition& GetPosition() override; |
| 30 void OnPermissionGranted() override; |
| 31 |
| 32 private: |
| 33 // Limits the rate in which location updates from |location_provider_| will |
| 34 // get passed along through |feature_update_callback_|. |
| 35 void OnLocationUpdate(const LocationProvider* provider, |
| 36 const Geoposition& new_position); |
| 37 |
| 38 std::unique_ptr<LocationProvider> location_provider_; |
| 39 LocationProvider::LocationProviderUpdateCallback feature_update_callback_; |
| 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(RateLimitingLocationProviderProxy); |
| 42 }; |
| 43 |
| 44 } // namespace device |
| 45 |
| 46 #endif // DEVICE_GEOLOCATION_RATE_LIMITING_LOCATION_PROVIDER_PROXY_H_ |
OLD | NEW |