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

Unified Diff: content/renderer/geolocation_dispatcher.cc

Issue 841133002: Stop using [Client=...] feature of Mojom for GeolocationService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: improve comments Created 5 years, 11 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
« no previous file with comments | « content/renderer/geolocation_dispatcher.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/geolocation_dispatcher.cc
diff --git a/content/renderer/geolocation_dispatcher.cc b/content/renderer/geolocation_dispatcher.cc
index b59cb61f70469ffdc7d073e742ae2282f4600845..ce56f8eaa78e079d9210b7df67c76ccc7a0e45d1 100644
--- a/content/renderer/geolocation_dispatcher.cc
+++ b/content/renderer/geolocation_dispatcher.cc
@@ -32,13 +32,13 @@ GeolocationDispatcher::GeolocationDispatcher(RenderFrame* render_frame)
GeolocationDispatcher::~GeolocationDispatcher() {}
void GeolocationDispatcher::startUpdating() {
- if (!geolocation_service_.get()) {
+ if (!geolocation_service_) {
render_frame()->GetServiceRegistry()->ConnectToRemoteService(
&geolocation_service_);
- geolocation_service_.set_client(this);
}
if (enable_high_accuracy_)
geolocation_service_->SetHighAccuracy(true);
+ QueryNextPosition();
}
void GeolocationDispatcher::stopUpdating() {
@@ -53,7 +53,7 @@ void GeolocationDispatcher::setEnableHighAccuracy(bool enable_high_accuracy) {
bool has_changed = enable_high_accuracy_ != enable_high_accuracy;
enable_high_accuracy_ = enable_high_accuracy;
// We have a different accuracy requirement. Request browser to update.
- if (geolocation_service_.get() && has_changed)
+ if (geolocation_service_ && has_changed)
geolocation_service_->SetHighAccuracy(enable_high_accuracy_);
}
@@ -107,8 +107,15 @@ void GeolocationDispatcher::OnPermissionSet(
permissionRequest.setIsAllowed(status == PERMISSION_STATUS_GRANTED);
}
-void GeolocationDispatcher::OnLocationUpdate(MojoGeopositionPtr geoposition) {
- DCHECK(geolocation_service_.get());
+void GeolocationDispatcher::QueryNextPosition() {
+ DCHECK(geolocation_service_);
+ geolocation_service_->QueryNextPosition(
+ base::Bind(&GeolocationDispatcher::OnPositionUpdate,
+ base::Unretained(this)));
+}
+
+void GeolocationDispatcher::OnPositionUpdate(MojoGeopositionPtr geoposition) {
+ QueryNextPosition();
if (geoposition->valid) {
controller_->positionChanged(WebGeolocationPosition(
« no previous file with comments | « content/renderer/geolocation_dispatcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698