diff options
author | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-26 14:29:12 +0000 |
---|---|---|
committer | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-26 14:29:12 +0000 |
commit | 9e8554820f3b972d410ae9a96b837a65ab8d0333 (patch) | |
tree | 7c02e2ed224ec282cd3662c1933b23436d47e8f3 /chrome/browser/geolocation/geolocation_dispatcher_host.cc | |
parent | 3384b14f1250e6c895fa07ea43a4b5e4b65e948d (diff) | |
download | chromium_src-9e8554820f3b972d410ae9a96b837a65ab8d0333.zip chromium_src-9e8554820f3b972d410ae9a96b837a65ab8d0333.tar.gz chromium_src-9e8554820f3b972d410ae9a96b837a65ab8d0333.tar.bz2 |
Bring Geolocation to life!
Bolt the geolocation dispatcher host up to the location arbitrator
Introduces a new method for fetching a singleton default location arbitrator with minimal fuss.
Fix bug in the geolocation dispatcher where bridge id & route id were swapped on send.
BUG=http://crbug.com/11246
TEST=run browser with --enable-geolocaiton & Open http://maps.google.co.uk/maps/m
Review URL: http://codereview.chromium.org/658005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40118 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/geolocation/geolocation_dispatcher_host.cc')
-rw-r--r-- | chrome/browser/geolocation/geolocation_dispatcher_host.cc | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/chrome/browser/geolocation/geolocation_dispatcher_host.cc b/chrome/browser/geolocation/geolocation_dispatcher_host.cc index 2ea0a48..4a5e0bc 100644 --- a/chrome/browser/geolocation/geolocation_dispatcher_host.cc +++ b/chrome/browser/geolocation/geolocation_dispatcher_host.cc @@ -23,6 +23,8 @@ GeolocationDispatcherHost::GeolocationDispatcherHost( } GeolocationDispatcherHost::~GeolocationDispatcherHost() { + if (location_arbitrator_) + location_arbitrator_->RemoveObserver(this); } bool GeolocationDispatcherHost::OnMessageReceived( @@ -49,16 +51,8 @@ bool GeolocationDispatcherHost::OnMessageReceived( 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::OnRequestPermission( 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) { |