OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #include "content/browser/geolocation/location_provider_android.h" | |
6 | |
7 #include "base/memory/ptr_util.h" | |
8 #include "base/time/time.h" | |
9 #include "content/browser/geolocation/location_api_adapter_android.h" | |
10 #include "content/public/common/geoposition.h" | |
11 | |
12 namespace content { | |
13 | |
14 // LocationProviderAndroid | |
15 LocationProviderAndroid::LocationProviderAndroid() { | |
16 } | |
17 | |
18 LocationProviderAndroid::~LocationProviderAndroid() { | |
19 StopProvider(); | |
20 } | |
21 | |
22 void LocationProviderAndroid::NotifyNewGeoposition( | |
23 const Geoposition& position) { | |
24 last_position_ = position; | |
25 NotifyCallback(last_position_); | |
26 } | |
27 | |
28 bool LocationProviderAndroid::StartProvider(bool high_accuracy) { | |
29 return AndroidLocationApiAdapter::GetInstance()->Start(this, high_accuracy); | |
30 } | |
31 | |
32 void LocationProviderAndroid::StopProvider() { | |
33 AndroidLocationApiAdapter::GetInstance()->Stop(); | |
34 } | |
35 | |
36 void LocationProviderAndroid::GetPosition(Geoposition* position) { | |
37 *position = last_position_; | |
38 } | |
39 | |
40 void LocationProviderAndroid::RequestRefresh() { | |
41 // Nothing to do here, android framework will call us back on new position. | |
42 } | |
43 | |
44 void LocationProviderAndroid::OnPermissionGranted() { | |
45 // Nothing to do here. | |
46 } | |
47 | |
48 // static | |
49 std::unique_ptr<LocationProvider> NewSystemLocationProvider() { | |
50 return base::WrapUnique(new LocationProviderAndroid); | |
51 } | |
52 | |
53 } // namespace content | |
OLD | NEW |