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

Side by Side Diff: device/geolocation/rate_limiting_location_provider_proxy.cc

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 #include "device/geolocation/rate_limiting_location_provider_proxy.h"
6
7 #include <utility>
8
9 #include "device/geolocation/geolocation_delegate.h"
10 #include "device/geolocation/geoposition.h"
11 #include "device/geolocation/location_arbitrator.h"
12
13 namespace device {
14
15 RateLimitingLocationProviderProxy::RateLimitingLocationProviderProxy(
16 std::unique_ptr<LocationProvider> provider)
17 : location_provider_(std::move(provider)) {
18 location_provider_->SetUpdateCallback(
19 base::Bind(&RateLimitingLocationProviderProxy::OnLocationUpdate,
20 base::Unretained(this)));
21 }
22
23 RateLimitingLocationProviderProxy::~RateLimitingLocationProviderProxy() {}
24
25 void RateLimitingLocationProviderProxy::SetUpdateCallback(
26 const LocationProviderUpdateCallback& callback) {
27 DCHECK(!callback.is_null());
28 location_update_callback_ = callback;
29 }
30
31 bool RateLimitingLocationProviderProxy::StartProvider(
32 bool enable_high_accuracy) {
33 return location_provider_->StartProvider(enable_high_accuracy);
34 }
35
36 void RateLimitingLocationProviderProxy::StopProvider() {
37 location_provider_->StopProvider();
38 }
39
40 const device::Geoposition& RateLimitingLocationProviderProxy::GetPosition() {
41 return location_provider_->GetPosition();
42 }
43
44 void RateLimitingLocationProviderProxy::OnPermissionGranted() {
45 location_provider_->OnPermissionGranted();
46 }
47
48 void RateLimitingLocationProviderProxy::OnLocationUpdate(
49 const LocationProvider* provider,
50 const Geoposition& new_position) {
51 location_update_callback_.Run(this, new_position);
52 }
53
54 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698