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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: blimp/client/core/geolocation/blimp_location_provider.cc
diff --git a/blimp/client/core/geolocation/blimp_location_provider.cc b/blimp/client/core/geolocation/blimp_location_provider.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b1fe83f349fe526450b14f90ab65f0779b899cd1
--- /dev/null
+++ b/blimp/client/core/geolocation/blimp_location_provider.cc
@@ -0,0 +1,59 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "blimp/client/core/geolocation/blimp_location_provider.h"
+
+#include "device/geolocation/geoposition.h"
+#include "device/geolocation/location_arbitrator_impl.h"
+
+namespace blimp {
+namespace client {
+namespace {
+class BlimpGeolocationDelegate : public device::GeolocationDelegate {
+ public:
+ BlimpGeolocationDelegate() = default;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BlimpGeolocationDelegate);
+};
+
+} // namespace
+
+BlimpLocationProvider::BlimpLocationProvider()
+ : location_provider_(new device::LocationArbitratorImpl(
+ base::Bind(&BlimpLocationProvider::OnLocationUpdate,
+ base::Unretained(this)),
+ 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
+
+BlimpLocationProvider::~BlimpLocationProvider() {}
+
+void BlimpLocationProvider::SetUpdateCallback(
+ const LocationProviderUpdateCallback& callback) {
+ DCHECK(!callback.is_null());
+ feature_update_callback_ = callback;
+}
+
+bool BlimpLocationProvider::StartProvider(bool enable_high_accuracy) {
+ return location_provider_->StartProvider(enable_high_accuracy);
+}
+
+void BlimpLocationProvider::StopProvider() {
+ location_provider_->StopProvider();
+}
+
+const device::Geoposition& BlimpLocationProvider::GetPosition() {
+ return location_provider_->GetPosition();
+}
+
+void BlimpLocationProvider::OnPermissionGranted() {
+ location_provider_->OnPermissionGranted();
+}
+
+void BlimpLocationProvider::OnLocationUpdate(
+ const device::Geoposition& new_position) {
+ feature_update_callback_.Run(this, new_position);
+}
+
+} // namespace client
+} // namespace blimp

Powered by Google App Engine
This is Rietveld 408576698