Index: device/geolocation/rate_limiting_location_provider_proxy.h |
diff --git a/device/geolocation/rate_limiting_location_provider_proxy.h b/device/geolocation/rate_limiting_location_provider_proxy.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7de1ea36149f9da063547022c90c035425fef266 |
--- /dev/null |
+++ b/device/geolocation/rate_limiting_location_provider_proxy.h |
@@ -0,0 +1,46 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef DEVICE_GEOLOCATION_RATE_LIMITING_LOCATION_PROVIDER_PROXY_H_ |
+#define DEVICE_GEOLOCATION_RATE_LIMITING_LOCATION_PROVIDER_PROXY_H_ |
+ |
+#include <memory> |
+ |
+#include "device/geolocation/geolocation_delegate.h" |
+#include "device/geolocation/geoposition.h" |
+#include "device/geolocation/location_provider.h" |
+ |
+namespace device { |
+ |
+// Location provider that limits the rate of geolocation updates. |
+// TODO(lethalantidote): Schedule aspect still to be implemented. Dummy for now. |
+class DEVICE_GEOLOCATION_EXPORT RateLimitingLocationProviderProxy |
+ : public LocationProvider { |
+ public: |
+ RateLimitingLocationProviderProxy(); |
+ ~RateLimitingLocationProviderProxy() override; |
+ |
+ // LocationProvider implemenation. |
+ void SetUpdateCallback( |
+ const LocationProviderUpdateCallback& callback) override; |
+ bool StartProvider(bool enable_high_accuracy) override; |
+ void StopProvider() override; |
+ const Geoposition& GetPosition() override; |
+ void OnPermissionGranted() override; |
+ |
+ private: |
+ // Limits the rate in which location updates from |location_provider_| will |
+ // get passed along through |feature_update_callback_|. |
+ void OnLocationUpdate(const LocationProvider* provider, |
+ const Geoposition& new_position); |
+ |
+ std::unique_ptr<LocationProvider> location_provider_; |
+ LocationProvider::LocationProviderUpdateCallback feature_update_callback_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(RateLimitingLocationProviderProxy); |
+}; |
+ |
+} // namespace device |
+ |
+#endif // DEVICE_GEOLOCATION_RATE_LIMITING_LOCATION_PROVIDER_PROXY_H_ |