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

Unified Diff: chrome/browser/geolocation/location_arbitrator.h

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/location_arbitrator.h
===================================================================
--- chrome/browser/geolocation/location_arbitrator.h (revision 39892)
+++ chrome/browser/geolocation/location_arbitrator.h (working copy)
@@ -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 @@
// 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 @@
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 @@
// 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_
« no previous file with comments | « chrome/browser/geolocation/geolocation_dispatcher_host.cc ('k') | chrome/browser/geolocation/location_arbitrator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698