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

Unified Diff: chrome/browser/geolocation/geolocation_dispatcher_host.cc

Issue 658005: Bring Geolocation to life!... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 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: chrome/browser/geolocation/geolocation_dispatcher_host.cc
===================================================================
--- chrome/browser/geolocation/geolocation_dispatcher_host.cc (revision 39892)
+++ chrome/browser/geolocation/geolocation_dispatcher_host.cc (working copy)
@@ -23,6 +23,8 @@
}
GeolocationDispatcherHost::~GeolocationDispatcherHost() {
+ if (location_arbitrator_)
+ location_arbitrator_->RemoveObserver(this);
}
bool GeolocationDispatcherHost::OnMessageReceived(
@@ -49,16 +51,8 @@
return handled;
}
-void GeolocationDispatcherHost::NotifyPositionUpdated(
+void GeolocationDispatcherHost::OnLocationUpdate(
const Geoposition& geoposition) {
- if (!ChromeThread::CurrentlyOn(ChromeThread::IO)) {
- ChromeThread::PostTask(
- ChromeThread::UI, FROM_HERE,
- NewRunnableMethod(
- this, &GeolocationDispatcherHost::NotifyPositionUpdated,
- geoposition));
- return;
- }
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
for (std::set<GeolocationServiceRenderId>::iterator geo =
@@ -99,12 +93,17 @@
void GeolocationDispatcherHost::OnStartUpdating(
int route_id, int bridge_id, bool high_accuracy) {
LOG(INFO) << "start updating" << route_id;
- // TODO(bulach): connect this with GeolocationServiceProvider.
+ if (!location_arbitrator_)
+ location_arbitrator_ = GeolocationArbitrator::GetInstance();
+ location_arbitrator_->AddObserver(
+ this, GeolocationArbitrator::UpdateOptions(high_accuracy));
}
void GeolocationDispatcherHost::OnStopUpdating(int route_id, int bridge_id) {
LOG(INFO) << "stop updating" << route_id;
- // TODO(bulach): connect this with GeolocationServiceProvider.
+ if (location_arbitrator_)
+ location_arbitrator_->RemoveObserver(this);
+ location_arbitrator_ = NULL;
}
void GeolocationDispatcherHost::OnSuspend(int route_id, int bridge_id) {
« no previous file with comments | « chrome/browser/geolocation/geolocation_dispatcher_host.h ('k') | chrome/browser/geolocation/location_arbitrator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698