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

Unified Diff: device/geolocation/rate_limiting_location_provider_proxy.h

Issue 2249283003: Hooks together Geolocation Feature in the Client and Engine. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lai
Patch Set: Addresses Wez's #14 comments Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698