| Index: device/geolocation/rate_limiting_location_provider_proxy.cc
|
| diff --git a/device/geolocation/rate_limiting_location_provider_proxy.cc b/device/geolocation/rate_limiting_location_provider_proxy.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..963116230f140230c47d86d028eb9b8095d22982
|
| --- /dev/null
|
| +++ b/device/geolocation/rate_limiting_location_provider_proxy.cc
|
| @@ -0,0 +1,54 @@
|
| +// 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.
|
| +
|
| +#include "device/geolocation/rate_limiting_location_provider_proxy.h"
|
| +
|
| +#include <utility>
|
| +
|
| +#include "device/geolocation/geolocation_delegate.h"
|
| +#include "device/geolocation/geoposition.h"
|
| +#include "device/geolocation/location_arbitrator.h"
|
| +
|
| +namespace device {
|
| +
|
| +RateLimitingLocationProviderProxy::RateLimitingLocationProviderProxy(
|
| + std::unique_ptr<LocationProvider> provider)
|
| + : location_provider_(std::move(provider)) {
|
| + location_provider_->SetUpdateCallback(
|
| + base::Bind(&RateLimitingLocationProviderProxy::OnLocationUpdate,
|
| + base::Unretained(this)));
|
| +}
|
| +
|
| +RateLimitingLocationProviderProxy::~RateLimitingLocationProviderProxy() {}
|
| +
|
| +void RateLimitingLocationProviderProxy::SetUpdateCallback(
|
| + const LocationProviderUpdateCallback& callback) {
|
| + DCHECK(!callback.is_null());
|
| + location_update_callback_ = callback;
|
| +}
|
| +
|
| +bool RateLimitingLocationProviderProxy::StartProvider(
|
| + bool enable_high_accuracy) {
|
| + return location_provider_->StartProvider(enable_high_accuracy);
|
| +}
|
| +
|
| +void RateLimitingLocationProviderProxy::StopProvider() {
|
| + location_provider_->StopProvider();
|
| +}
|
| +
|
| +const device::Geoposition& RateLimitingLocationProviderProxy::GetPosition() {
|
| + return location_provider_->GetPosition();
|
| +}
|
| +
|
| +void RateLimitingLocationProviderProxy::OnPermissionGranted() {
|
| + location_provider_->OnPermissionGranted();
|
| +}
|
| +
|
| +void RateLimitingLocationProviderProxy::OnLocationUpdate(
|
| + const LocationProvider* provider,
|
| + const Geoposition& new_position) {
|
| + location_update_callback_.Run(this, new_position);
|
| +}
|
| +
|
| +} // namespace device
|
|
|