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

Unified Diff: content/public/browser/geolocation.h

Issue 10344004: Add content API for requesting the current geolocation (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: *Argh*, missed another forward declaration of a struct as a class. Created 8 years, 8 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/browser/geolocation/geolocation_provider_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/browser/geolocation.h
diff --git a/content/public/browser/geolocation.h b/content/public/browser/geolocation.h
index 23868e906af2e0d2df1e0e20c5332d6a8a64be48..673b275c9f94c2aad6cc81198b9c3085a5c05a60 100644
--- a/content/public/browser/geolocation.h
+++ b/content/public/browser/geolocation.h
@@ -13,16 +13,30 @@ namespace content {
struct Geoposition;
+typedef base::Callback<void(const Geoposition&)> GeolocationUpdateCallback;
+
// Overrides the current location for testing. This function may be called on
// any thread. The completion callback will be invoked asynchronously on the
// calling thread when the override operation is completed.
-// This should be used instead of a mock location provider for a simpler way
-// to provide fake location results when not testing the innards of the
-// geolocation code.
+//
+// This function allows the current location to be faked without having to
+// manually instantiate a GeolocationProvider backed by a MockLocationProvider
+// that serves a fake location.
+//
+// Do not use this function in unit tests. The function instantiates the
+// singleton geolocation stack in the background and manipulates it to report
+// a fake location. Neither step can be undone, breaking unit test isolation
+// (crbug.com/125931).
void CONTENT_EXPORT OverrideLocationForTesting(
const Geoposition& position,
const base::Closure& completion_callback);
+// Requests a one-time callback when the next location update becomes available.
+// This function may be called on any thread. The callback will be invoked on
+// the calling thread.
+void CONTENT_EXPORT RequestLocationUpdate(
+ const GeolocationUpdateCallback& callback);
+
} // namespace content
#endif // CONTENT_PUBLIC_BROWSER_GEOLOCATION_H_
« no previous file with comments | « content/browser/geolocation/geolocation_provider_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698