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

Side by Side 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: Merge with master. Created 4 years, 3 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
OLDNEW
(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 explicit RateLimitingLocationProviderProxy(
22 std::unique_ptr<LocationProvider> provider);
23 ~RateLimitingLocationProviderProxy() override;
24
25 // LocationProvider implemenation.
26 void SetUpdateCallback(
27 const LocationProviderUpdateCallback& callback) override;
28 bool StartProvider(bool enable_high_accuracy) override;
29 void StopProvider() override;
30 const Geoposition& GetPosition() override;
31 void OnPermissionGranted() override;
32
33 private:
34 // Limits the rate at which location updates from |location_provider_| will
35 // get passed along through |feature_update_callback_|.
36 void OnLocationUpdate(const LocationProvider* provider,
37 const Geoposition& new_position);
38
39 std::unique_ptr<LocationProvider> location_provider_;
40 LocationProvider::LocationProviderUpdateCallback location_update_callback_;
41
42 DISALLOW_COPY_AND_ASSIGN(RateLimitingLocationProviderProxy);
43 };
44
45 } // namespace device
46
47 #endif // DEVICE_GEOLOCATION_RATE_LIMITING_LOCATION_PROVIDER_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698