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

Unified Diff: blimp/engine/feature/geolocation/blimp_location_provider.cc

Issue 2091023006: Adds EngineGeolocationFeature for Blimp Geolocation project. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updating repo to see if try is fixed Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: blimp/engine/feature/geolocation/blimp_location_provider.cc
diff --git a/blimp/engine/feature/geolocation/blimp_location_provider.cc b/blimp/engine/feature/geolocation/blimp_location_provider.cc
index de86b9fc1e65b31384c8cbdd43cca52128e388ca..7c78cde4c9178d4e46432862e41fc2401153dca2 100644
--- a/blimp/engine/feature/geolocation/blimp_location_provider.cc
+++ b/blimp/engine/feature/geolocation/blimp_location_provider.cc
@@ -4,6 +4,9 @@
#include "blimp/engine/feature/geolocation/blimp_location_provider.h"
+#include "base/bind.h"
+#include "base/bind_helpers.h"
+#include "base/memory/weak_ptr.h"
#include "content/public/common/geoposition.h"
namespace blimp {
@@ -15,12 +18,25 @@ BlimpLocationProvider::~BlimpLocationProvider() {
StopProvider();
}
+void BlimpLocationProvider::SetDelegate(
+ base::WeakPtr<BlimpLocationProvider::Delegate> delegate) {
+ DCHECK(delegate);
+ DCHECK(!delegate_);
+
+ delegate_ = delegate;
+}
+
bool BlimpLocationProvider::StartProvider(bool high_accuracy) {
- NOTIMPLEMENTED();
+ DCHECK(delegate_);
Wez 2016/07/12 21:35:13 |delegate_| is a WeakPtr, so it's perfectly valid
CJ 2016/07/13 21:49:19 Done.
Wez 2016/07/14 01:19:21 I meant that, if it is possible for the WeakPtr to
CJ 2016/07/14 23:55:08 Done.
+
+ delegate_->UpdateListenState(high_accuracy);
return true;
}
void BlimpLocationProvider::StopProvider() {
+ DCHECK(delegate_);
+
+ delegate_->StopListenState();
}
void BlimpLocationProvider::GetPosition(content::Geoposition* position) {
@@ -30,7 +46,9 @@ void BlimpLocationProvider::GetPosition(content::Geoposition* position) {
}
void BlimpLocationProvider::RequestRefresh() {
- NOTIMPLEMENTED();
+ DCHECK(delegate_);
+
+ delegate_->RequestRefresh();
}
void BlimpLocationProvider::OnPermissionGranted() {
@@ -38,24 +56,11 @@ void BlimpLocationProvider::OnPermissionGranted() {
NOTIMPLEMENTED();
Wez 2016/07/12 21:35:13 Add a comment to explain why we're both requesting
CJ 2016/07/13 21:49:20 I think I can remove the NOTIMPLEMENTED here.
Wez 2016/07/14 01:19:21 Acknowledged.
}
-void BlimpLocationProvider::NotifyCallback(
- const content::Geoposition& position) {
- DCHECK(!callback_.is_null());
-
- callback_.Run(this, position);
-}
-
-void BlimpLocationProvider::OnLocationResponse(
- const content::Geoposition& position) {
- NotifyCallback(position);
- NOTIMPLEMENTED();
-}
-
void BlimpLocationProvider::SetUpdateCallback(
const LocationProviderUpdateCallback& callback) {
DCHECK(!callback.is_null());
Wez 2016/07/12 21:35:13 LocationProvider does not specify that it's invali
CJ 2016/07/13 21:49:20 Done.
- callback_ = callback;
+ delegate_->SetUpdateCallback(base::Bind(callback, base::Unretained(this)));
Wez 2016/07/12 21:35:13 You're passing Bind()ing to Unretained(this) - wha
CJ 2016/07/13 21:49:20 I don't think that could happen? BlimpLocationProv
Wez 2016/07/14 01:19:21 Not sure what you mean by "ends up". You're passin
CJ 2016/07/14 23:55:08 I believe so yes. It just uses that pointer to upd
}
} // namespace engine

Powered by Google App Engine
This is Rietveld 408576698