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

Unified Diff: blimp/engine/feature/geolocation/engine_geolocation_feature.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: Put TestingLocationArbitrator out of anonymous namespace. 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 side-by-side diff with in-line comments
Download patch
Index: blimp/engine/feature/geolocation/engine_geolocation_feature.cc
diff --git a/blimp/engine/feature/geolocation/engine_geolocation_feature.cc b/blimp/engine/feature/geolocation/engine_geolocation_feature.cc
index 4cce48905ee5dd38c999ad81fc49f970beb7e981..3e8551db1b6b5b51e3e56513db08cc8ea7af1d8f 100644
--- a/blimp/engine/feature/geolocation/engine_geolocation_feature.cc
+++ b/blimp/engine/feature/geolocation/engine_geolocation_feature.cc
@@ -9,6 +9,7 @@
#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "blimp/common/create_blimp_message.h"
#include "blimp/common/proto/blimp_message.pb.h"
#include "blimp/common/proto/geolocation.pb.h"
@@ -20,6 +21,7 @@
namespace blimp {
namespace engine {
namespace {
+
class BlimpGeolocationDelegate : public device::GeolocationDelegate {
public:
explicit BlimpGeolocationDelegate(
@@ -120,7 +122,8 @@ void EngineGeolocationFeature::ProcessMessage(
void EngineGeolocationFeature::NotifyCallback(
const device::Geoposition& position) {
- geoposition_received_callback_.Run(position);
+ callback_task_runner_->PostTask(
+ FROM_HERE, base::Bind(geoposition_received_callback_, position));
}
void EngineGeolocationFeature::RequestAccuracy(
@@ -151,6 +154,9 @@ void EngineGeolocationFeature::OnPermissionGranted() {
void EngineGeolocationFeature::SetUpdateCallback(
const GeopositionReceivedCallback& callback) {
geoposition_received_callback_ = callback;
+
+ // Set |callback_task_runner_| to run on the current thread.
+ callback_task_runner_ = base::ThreadTaskRunnerHandle::Get();
}
} // namespace engine

Powered by Google App Engine
This is Rietveld 408576698