| OLD | NEW |
| (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 |
| OLD | NEW |