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..df37c3821edb0aaea3d606ae1a9d6ecbac83d905 |
--- /dev/null |
+++ b/device/geolocation/rate_limiting_location_provider_proxy.h |
@@ -0,0 +1,49 @@ |
+// 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. |
Wez
2016/08/24 23:07:18
What is the point of having a "dummy" that doesn't
CJ
2016/08/25 19:08:22
I can make a baseline to see if the techniques I p
Wez
2016/08/30 00:03:58
Right, but you don't need the RateLimitingLocation
CJ
2016/08/31 23:22:56
Done.
|
+class DEVICE_GEOLOCATION_EXPORT RateLimitingLocationProviderProxy |
+ : public LocationProvider { |
+ public: |
+ RateLimitingLocationProviderProxy(); |
+ ~RateLimitingLocationProviderProxy() override; |
+ |
+ void SetLocationProviderForTest( |
+ std::unique_ptr<LocationProvider> location_provider); |
Wez
2016/08/24 23:07:18
If this is only for test then how does a caller pr
CJ
2016/08/25 19:08:22
Good point, its gone, constructor now handles it.
|
+ |
+ // 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 |
Wez
2016/08/24 23:07:18
nit: s/in/at
CJ
2016/08/25 19:08:22
Done.
|
+ // 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_; |
Wez
2016/08/24 23:07:18
What is "feature" in this context?
CJ
2016/08/25 19:08:22
Good point.
|
+ |
+ DISALLOW_COPY_AND_ASSIGN(RateLimitingLocationProviderProxy); |
+}; |
+ |
+} // namespace device |
+ |
+#endif // DEVICE_GEOLOCATION_RATE_LIMITING_LOCATION_PROVIDER_PROXY_H_ |