OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_PORT_BROWSER_LOCATION_PROVIDER_H_ | 5 #ifndef CONTENT_PORT_BROWSER_LOCATION_PROVIDER_H_ |
6 #define CONTENT_PORT_BROWSER_LOCATION_PROVIDER_H_ | 6 #define CONTENT_PORT_BROWSER_LOCATION_PROVIDER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "content/public/common/geoposition.h" | 10 #include "content/public/common/geoposition.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 virtual bool StartProvider(bool high_accuracy) = 0; | 32 virtual bool StartProvider(bool high_accuracy) = 0; |
33 | 33 |
34 // Stops the provider from sending more requests. | 34 // Stops the provider from sending more requests. |
35 // Important: a LocationProvider may be instantiated and StartProvider() may | 35 // Important: a LocationProvider may be instantiated and StartProvider() may |
36 // be called before the user has granted permission via OnPermissionGranted(). | 36 // be called before the user has granted permission via OnPermissionGranted(). |
37 // This is to allow underlying providers to warm up, load their internal | 37 // This is to allow underlying providers to warm up, load their internal |
38 // libraries, etc. No |LocationProviderUpdateCallback| can be run and no | 38 // libraries, etc. No |LocationProviderUpdateCallback| can be run and no |
39 // network requests can be done until OnPermissionGranted() has been called. | 39 // network requests can be done until OnPermissionGranted() has been called. |
40 virtual void StopProvider() = 0; | 40 virtual void StopProvider() = 0; |
41 | 41 |
| 42 // The LocationProvider implementation may use the Pause/ResumeProvider API |
| 43 // to temporarily stop this provider from firing updates. By default, these |
| 44 // APIs are a no-op. |
| 45 virtual void PauseProvider() = 0; |
| 46 virtual void ResumeProvider() = 0; |
| 47 |
42 // Gets the current best position estimate. | 48 // Gets the current best position estimate. |
43 virtual void GetPosition(Geoposition* position) = 0; | 49 virtual void GetPosition(Geoposition* position) = 0; |
44 | 50 |
45 // Provides a hint to the provider that new location data is needed as soon | 51 // Provides a hint to the provider that new location data is needed as soon |
46 // as possible. | 52 // as possible. |
47 virtual void RequestRefresh() = 0; | 53 virtual void RequestRefresh() = 0; |
48 | 54 |
49 // Called everytime permission is granted to a page for using geolocation. | 55 // Called everytime permission is granted to a page for using geolocation. |
50 // This may either be through explicit user action (e.g. responding to the | 56 // This may either be through explicit user action (e.g. responding to the |
51 // infobar prompt) or inferred from a persisted site permission. | 57 // infobar prompt) or inferred from a persisted site permission. |
52 // Note: See |StartProvider()| for more information. | 58 // Note: See |StartProvider()| for more information. |
53 virtual void OnPermissionGranted() = 0; | 59 virtual void OnPermissionGranted() = 0; |
54 }; | 60 }; |
55 | 61 |
56 } // namespace content | 62 } // namespace content |
57 | 63 |
58 #endif // CONTENT_PORT_BROWSER_LOCATION_PROVIDER_H_ | 64 #endif // CONTENT_PORT_BROWSER_LOCATION_PROVIDER_H_ |
OLD | NEW |