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

Side by Side Diff: content/public/browser/geolocation_provider.h

Issue 2192683003: Revert of Reland: Geolocation: move from content/browser to device/ (patchset #2 id:20001 of https:… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2810
Patch Set: Created 4 years, 4 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
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 DEVICE_GEOLOCATION_GEOLOCATION_PROVIDER_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_GEOLOCATION_PROVIDER_H_
6 #define DEVICE_GEOLOCATION_GEOLOCATION_PROVIDER_H_ 6 #define CONTENT_PUBLIC_BROWSER_GEOLOCATION_PROVIDER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback_list.h" 10 #include "base/callback_list.h"
11 #include "device/geolocation/geolocation_export.h" 11 #include "content/common/content_export.h"
12 12
13 namespace device { 13 namespace content {
14 class GeolocationDelegate; 14 class GeolocationDelegate;
15 struct Geoposition; 15 struct Geoposition;
16 16
17 // This is the main API to the geolocation subsystem. The application will hold 17 // This is the main API to the geolocation subsystem. The application will hold
18 // a single instance of this class and can register multiple clients to be 18 // a single instance of this class and can register multiple clients to be
19 // notified of location changes: 19 // notified of location changes:
20 // * Callbacks are registered by AddLocationUpdateCallback() and will keep 20 // * Callbacks are registered by AddLocationUpdateCallback() and will keep
21 // receiving updates until the returned subscription object is destructed. 21 // receiving updates until the returned subscription object is destructed.
22 // The application must instantiate the GeolocationProvider on the UI thread and 22 // The application must instantiate the GeolocationProvider on the UI thread and
23 // must communicate with it on the same thread. 23 // must communicate with it on the same thread.
24 // The underlying location arbitrator will only be enabled whilst there is at 24 // The underlying location arbitrator will only be enabled whilst there is at
25 // least one registered observer or pending callback (and only after 25 // least one registered observer or pending callback (and only after
26 // UserDidOptIntoLocationServices). The arbitrator and the location providers it 26 // UserDidOptIntoLocationServices). The arbitrator and the location providers it
27 // uses run on a separate Geolocation thread. 27 // uses run on a separate Geolocation thread.
28 class GeolocationProvider { 28 class GeolocationProvider {
29 public: 29 public:
30 DEVICE_GEOLOCATION_EXPORT static GeolocationProvider* GetInstance(); 30 CONTENT_EXPORT static GeolocationProvider* GetInstance();
31 31
32 // Optional: provide a Delegate to override typical services. 32 // Optional: provide a Delegate to override typical services.
33 DEVICE_GEOLOCATION_EXPORT static void SetGeolocationDelegate( 33 CONTENT_EXPORT static void SetGeolocationDelegate(
34 GeolocationDelegate* delegate); 34 GeolocationDelegate* delegate);
35 35
36 typedef base::Callback<void(const Geoposition&)> LocationUpdateCallback; 36 typedef base::Callback<void(const Geoposition&)> LocationUpdateCallback;
37 typedef base::CallbackList<void(const Geoposition&)>::Subscription 37 typedef base::CallbackList<void(const Geoposition&)>::Subscription
38 Subscription; 38 Subscription;
39 39
40 // |enable_high_accuracy| is used as a 'hint' for the provider preferences for 40 // |enable_high_accuracy| is used as a 'hint' for the provider preferences for
41 // this particular observer, however the observer could receive updates for 41 // this particular observer, however the observer could receive updates for
42 // best available locations from any active provider whilst it is registered. 42 // best available locations from any active provider whilst it is registered.
43 virtual std::unique_ptr<Subscription> AddLocationUpdateCallback( 43 virtual std::unique_ptr<Subscription> AddLocationUpdateCallback(
(...skipping 15 matching lines...) Expand all
59 // Do not use this function in unit tests. The function instantiates the 59 // Do not use this function in unit tests. The function instantiates the
60 // singleton geolocation stack in the background and manipulates it to report 60 // singleton geolocation stack in the background and manipulates it to report
61 // a fake location. Neither step can be undone, breaking unit test isolation 61 // a fake location. Neither step can be undone, breaking unit test isolation
62 // (crbug.com/125931). 62 // (crbug.com/125931).
63 virtual void OverrideLocationForTesting(const Geoposition& position) = 0; 63 virtual void OverrideLocationForTesting(const Geoposition& position) = 0;
64 64
65 protected: 65 protected:
66 virtual~GeolocationProvider() {} 66 virtual~GeolocationProvider() {}
67 }; 67 };
68 68
69 } // namespace device 69 } // namespace content
70 70
71 #endif // DEVICE_GEOLOCATION_GEOLOCATION_PROVIDER_H_ 71 #endif // CONTENT_PUBLIC_BROWSER_GEOLOCATION_PROVIDER_H_
OLDNEW
« no previous file with comments | « content/public/browser/geolocation_delegate.cc ('k') | content/public/browser/location_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698