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

Side by Side 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, 7 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 unified diff | Download patch
« no previous file with comments | « content/browser/geolocation/geolocation_provider_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_PUBLIC_BROWSER_GEOLOCATION_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_GEOLOCATION_H_
6 #define CONTENT_PUBLIC_BROWSER_GEOLOCATION_H_ 6 #define CONTENT_PUBLIC_BROWSER_GEOLOCATION_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/callback_forward.h" 9 #include "base/callback_forward.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 struct Geoposition; 14 struct Geoposition;
15 15
16 typedef base::Callback<void(const Geoposition&)> GeolocationUpdateCallback;
17
16 // Overrides the current location for testing. This function may be called on 18 // Overrides the current location for testing. This function may be called on
17 // any thread. The completion callback will be invoked asynchronously on the 19 // any thread. The completion callback will be invoked asynchronously on the
18 // calling thread when the override operation is completed. 20 // calling thread when the override operation is completed.
19 // This should be used instead of a mock location provider for a simpler way 21 //
20 // to provide fake location results when not testing the innards of the 22 // This function allows the current location to be faked without having to
21 // geolocation code. 23 // manually instantiate a GeolocationProvider backed by a MockLocationProvider
24 // that serves a fake location.
25 //
26 // Do not use this function in unit tests. The function instantiates the
27 // singleton geolocation stack in the background and manipulates it to report
28 // a fake location. Neither step can be undone, breaking unit test isolation
29 // (crbug.com/125931).
22 void CONTENT_EXPORT OverrideLocationForTesting( 30 void CONTENT_EXPORT OverrideLocationForTesting(
23 const Geoposition& position, 31 const Geoposition& position,
24 const base::Closure& completion_callback); 32 const base::Closure& completion_callback);
25 33
34 // Requests a one-time callback when the next location update becomes available.
35 // This function may be called on any thread. The callback will be invoked on
36 // the calling thread.
37 void CONTENT_EXPORT RequestLocationUpdate(
38 const GeolocationUpdateCallback& callback);
39
26 } // namespace content 40 } // namespace content
27 41
28 #endif // CONTENT_PUBLIC_BROWSER_GEOLOCATION_H_ 42 #endif // CONTENT_PUBLIC_BROWSER_GEOLOCATION_H_
OLDNEW
« 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