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/location_arbitrator.h | |
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/location_arbitrator.h')
-rw-r--r-- | chrome/browser/geolocation/location_arbitrator.h | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/chrome/browser/geolocation/location_arbitrator.h b/chrome/browser/geolocation/location_arbitrator.h index 86b6d99..96e1de2 100644 --- a/chrome/browser/geolocation/location_arbitrator.h +++ b/chrome/browser/geolocation/location_arbitrator.h @@ -5,6 +5,8 @@ #ifndef CHROME_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_H_ #define CHROME_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_H_ +#include "base/ref_counted.h" + class AccessTokenStore; class URLRequestContextGetter; struct Geoposition; @@ -17,17 +19,19 @@ struct Geoposition; // This class is responsible for handling updates from multiple underlying // providers and resolving them to a single 'best' location fix at any given // moment. -class GeolocationArbitrator { +class GeolocationArbitrator : public base::RefCounted<GeolocationArbitrator> { public: - // Creates and returns a new instance of the location arbitrator. Will use - // the default access token store implementation bound to Chrome Prefs. - static GeolocationArbitrator* Create(URLRequestContextGetter* context_getter); - // Creates and returns a new instance of the location arbitrator. As above - // but allows injectino of the access token store, for testing. + // Creates and returns a new instance of the location arbitrator. Allows + // injection of the access token store and url getter context, for testing. static GeolocationArbitrator* Create( AccessTokenStore* access_token_store, URLRequestContextGetter* context_getter); + // Gets a pointer to the singleton instance of the location arbitrator, which + // is in turn bound to the browser's global context objects. Ownership is NOT + // returned. + static GeolocationArbitrator* GetInstance(); + class Delegate { public: // This will be called whenever the 'best available' location is updated, @@ -45,8 +49,6 @@ class GeolocationArbitrator { bool use_high_accuracy; }; - virtual ~GeolocationArbitrator(); - // Must be called from the same thread as the arbitrator was created on. // The update options passed are used as a 'hint' for the provider preferences // for this particular observer, however the delegate could receive callbacks @@ -62,7 +64,16 @@ class GeolocationArbitrator { // TODO(joth): This is a stop-gap for testing; once we have decoupled // provider factory we should extract mock creation from the arbitrator. - virtual void SetUseMockProvider(bool use_mock) = 0; + static void SetUseMockProvider(bool use_mock); + + protected: + friend class base::RefCounted<GeolocationArbitrator>; + GeolocationArbitrator(); + // RefCounted object; no not delete directly. + virtual ~GeolocationArbitrator(); + + private: + DISALLOW_COPY_AND_ASSIGN(GeolocationArbitrator); }; #endif // CHROME_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_H_ |