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

Side by Side Diff: blimp/engine/feature/geolocation/blimp_location_provider.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: In response to Wez's #73-75 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
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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 "blimp/engine/feature/geolocation/blimp_location_provider.h" 5 #include "blimp/engine/feature/geolocation/blimp_location_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "device/geolocation/geoposition.h" 10 #include "device/geolocation/geoposition.h"
(...skipping 26 matching lines...) Expand all
37 } 37 }
38 38
39 void BlimpLocationProvider::StopProvider() { 39 void BlimpLocationProvider::StopProvider() {
40 DCHECK(is_started_); 40 DCHECK(is_started_);
41 if (delegate_) { 41 if (delegate_) {
42 delegate_->RequestAccuracy(GeolocationSetInterestLevelMessage::NO_INTEREST); 42 delegate_->RequestAccuracy(GeolocationSetInterestLevelMessage::NO_INTEREST);
43 is_started_ = false; 43 is_started_ = false;
44 } 44 }
45 } 45 }
46 46
47 void BlimpLocationProvider::GetPosition(device::Geoposition* position) { 47 const device::Geoposition& BlimpLocationProvider::GetPosition() {
48 *position = cached_position_; 48 return cached_position_;
49 }
50
51 void BlimpLocationProvider::RequestRefresh() {
52 DCHECK(is_started_);
53 if (delegate_) {
54 delegate_->RequestRefresh();
55 }
56 } 49 }
57 50
58 void BlimpLocationProvider::OnPermissionGranted() { 51 void BlimpLocationProvider::OnPermissionGranted() {
59 RequestRefresh(); 52 DCHECK(is_started_);
53 if (delegate_) {
54 delegate_->OnPermissionGranted();
55 }
60 } 56 }
61 57
62 void BlimpLocationProvider::SetUpdateCallback( 58 void BlimpLocationProvider::SetUpdateCallback(
63 const LocationProviderUpdateCallback& callback) { 59 const LocationProviderUpdateCallback& callback) {
64 if (delegate_) { 60 if (delegate_) {
65 delegate_->SetUpdateCallback(base::Bind(callback, base::Unretained(this))); 61 delegate_->SetUpdateCallback(base::Bind(callback, base::Unretained(this)));
66 } 62 }
67 } 63 }
68 64
69 } // namespace engine 65 } // namespace engine
70 } // namespace blimp 66 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698