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"
13 // LocationProviderAndroid
14 LocationProviderAndroid::LocationProviderAndroid() {
17 LocationProviderAndroid::~LocationProviderAndroid() {
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