Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: device/geolocation/location_provider_android.cc

Issue 2226143002: Gets rid of the LocationArbitrator interface, in preference for LocationProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into lai Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/geolocation/location_provider_android.h" 5 #include "device/geolocation/location_provider_android.h"
6 6
7 #include <memory>
8
7 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
8 #include "base/time/time.h" 10 #include "base/time/time.h"
9 #include "device/geolocation/geoposition.h" 11 #include "device/geolocation/geoposition.h"
10 #include "device/geolocation/location_api_adapter_android.h" 12 #include "device/geolocation/location_api_adapter_android.h"
11 13
12 namespace device { 14 namespace device {
13 15
14 // LocationProviderAndroid 16 // LocationProviderAndroid
15 LocationProviderAndroid::LocationProviderAndroid() {} 17 LocationProviderAndroid::LocationProviderAndroid() {}
16 18
17 LocationProviderAndroid::~LocationProviderAndroid() { 19 LocationProviderAndroid::~LocationProviderAndroid() {
18 StopProvider(); 20 StopProvider();
19 } 21 }
20 22
21 void LocationProviderAndroid::NotifyNewGeoposition( 23 void LocationProviderAndroid::NotifyNewGeoposition(
22 const Geoposition& position) { 24 const Geoposition& position) {
23 last_position_ = position; 25 last_position_ = position;
24 NotifyCallback(last_position_); 26 NotifyCallback(last_position_);
25 } 27 }
26 28
27 bool LocationProviderAndroid::StartProvider(bool high_accuracy) { 29 bool LocationProviderAndroid::StartProvider(bool high_accuracy) {
28 return AndroidLocationApiAdapter::GetInstance()->Start(this, high_accuracy); 30 return AndroidLocationApiAdapter::GetInstance()->Start(this, high_accuracy);
29 } 31 }
30 32
31 void LocationProviderAndroid::StopProvider() { 33 void LocationProviderAndroid::StopProvider() {
32 AndroidLocationApiAdapter::GetInstance()->Stop(); 34 AndroidLocationApiAdapter::GetInstance()->Stop();
33 } 35 }
34 36
35 void LocationProviderAndroid::GetPosition(Geoposition* position) { 37 const Geoposition& LocationProviderAndroid::GetPosition() {
36 *position = last_position_; 38 return last_position_;
37 }
38
39 void LocationProviderAndroid::RequestRefresh() {
40 // Nothing to do here, android framework will call us back on new position.
41 } 39 }
42 40
43 void LocationProviderAndroid::OnPermissionGranted() { 41 void LocationProviderAndroid::OnPermissionGranted() {
44 // Nothing to do here. 42 // Nothing to do here.
45 } 43 }
46 44
47 // static 45 // static
48 std::unique_ptr<LocationProvider> NewSystemLocationProvider() { 46 std::unique_ptr<LocationProvider> NewSystemLocationProvider() {
49 return base::WrapUnique(new LocationProviderAndroid); 47 return base::WrapUnique(new LocationProviderAndroid);
50 } 48 }
51 49
52 } // namespace device 50 } // namespace device
OLDNEW
« no previous file with comments | « device/geolocation/location_provider_android.h ('k') | device/geolocation/location_provider_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698