Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / content / browser / geolocation / location_provider_android.cc
blob20e672f5e3df37ab521660e298a265222b86e463
1 // Copyright (c) 2012 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.
5 #include "content/browser/geolocation/location_provider_android.h"
7 #include "base/time/time.h"
8 #include "content/browser/geolocation/location_api_adapter_android.h"
9 #include "content/public/common/geoposition.h"
11 namespace content {
13 // LocationProviderAndroid
14 LocationProviderAndroid::LocationProviderAndroid() {
17 LocationProviderAndroid::~LocationProviderAndroid() {
18 StopProvider();
21 void LocationProviderAndroid::NotifyNewGeoposition(
22 const Geoposition& position) {
23 last_position_ = position;
24 NotifyCallback(last_position_);
27 bool LocationProviderAndroid::StartProvider(bool high_accuracy) {
28 return AndroidLocationApiAdapter::GetInstance()->Start(this, high_accuracy);
31 void LocationProviderAndroid::StopProvider() {
32 AndroidLocationApiAdapter::GetInstance()->Stop();
35 void LocationProviderAndroid::GetPosition(Geoposition* position) {
36 *position = last_position_;
39 void LocationProviderAndroid::RequestRefresh() {
40 // Nothing to do here, android framework will call us back on new position.
43 void LocationProviderAndroid::OnPermissionGranted() {
44 // Nothing to do here.
47 LocationProvider* NewSystemLocationProvider() {
48 return new LocationProviderAndroid;
51 } // namespace content