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

Side by Side Diff: blimp/client/core/geolocation/blimp_location_provider.cc

Issue 2249283003: Hooks together Geolocation Feature in the Client and Engine. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lai
Patch Set: Addresses nyquist's #9 comments. Created 4 years, 4 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
(Empty)
1 // Copyright 2016 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 "blimp/client/core/geolocation/blimp_location_provider.h"
6
7 #include "device/geolocation/geoposition.h"
8 #include "device/geolocation/location_arbitrator_impl.h"
9
10 namespace blimp {
11 namespace client {
12 namespace {
13 class BlimpGeolocationDelegate : public device::GeolocationDelegate {
14 public:
15 BlimpGeolocationDelegate() = default;
16
17 private:
18 DISALLOW_COPY_AND_ASSIGN(BlimpGeolocationDelegate);
19 };
20
21 } // namespace
22
23 BlimpLocationProvider::BlimpLocationProvider()
24 : location_provider_(new device::LocationArbitratorImpl(
25 base::Bind(&BlimpLocationProvider::OnLocationUpdate,
26 base::Unretained(this)),
27 new BlimpGeolocationDelegate())) {}
Wez 2016/08/19 23:12:10 Why not pass in a default GeolocationDelegate here
CJ 2016/08/22 20:28:08 I thought there would be some issue with there not
28
29 BlimpLocationProvider::~BlimpLocationProvider() {}
30
31 void BlimpLocationProvider::SetUpdateCallback(
32 const LocationProviderUpdateCallback& callback) {
33 DCHECK(!callback.is_null());
34 feature_update_callback_ = callback;
35 }
36
37 bool BlimpLocationProvider::StartProvider(bool enable_high_accuracy) {
38 return location_provider_->StartProvider(enable_high_accuracy);
39 }
40
41 void BlimpLocationProvider::StopProvider() {
42 location_provider_->StopProvider();
43 }
44
45 const device::Geoposition& BlimpLocationProvider::GetPosition() {
46 return location_provider_->GetPosition();
47 }
48
49 void BlimpLocationProvider::OnPermissionGranted() {
50 location_provider_->OnPermissionGranted();
51 }
52
53 void BlimpLocationProvider::OnLocationUpdate(
54 const device::Geoposition& new_position) {
55 feature_update_callback_.Run(this, new_position);
56 }
57
58 } // namespace client
59 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698